TGA to PNG conversion problem

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
Aquanox
Posts: 1
Joined: 2013-01-11T09:47:03-07:00
Authentication code: 6789

TGA to PNG conversion problem

Post by Aquanox »

Hello,

I'm using ImageMagick tool in my server application to automatically convert raw data images in TGA format to PNG for displaying.
The most of images is converted fine, but the part of images containing transparen parts is converted wrong. I tried various convertion parameters (transparency/transparencyColor/background) but it didnt helped.

I'm using ImageMagick 6.3.9 Q16 via im4java wrapper.

Source file http://puu.sh/1Ms2P

Code: Select all

d:\Programs\ImageMagick-6.3.9-Q16>identify.exe -verbose img_src.tga
Image: img_src.tga
  Format: TGA (Truevision Targa image)
  Class: DirectClass
  Geometry: 128x128+0+0
  Resolution: 72x72
  Print size: 1.77778x1.77778
  Units: Undefined
  Type: TrueColor
  Endianess: Undefined
  Colorspace: RGB
  Depth: 8-bit
  Channel depth:
    Red: 8-bit
    Green: 8-bit
    Blue: 8-bit
  Channel statistics:
    Red:
      Min: 0 (0)
      Max: 255 (1)
      Mean: 56.1252 (0.220099)
      Standard deviation: 68.0981 (0.267051)
    Green:
      Min: 0 (0)
      Max: 255 (1)
      Mean: 39.5311 (0.155024)
      Standard deviation: 50.1294 (0.196586)
    Blue:
      Min: 0 (0)
      Max: 239 (0.937255)
      Mean: 31.3704 (0.123021)
      Standard deviation: 40.7389 (0.15976)
  Rendering intent: Undefined
  Interlace: None
  Background color: white
  Border color: rgb(223,223,223)
  Matte color: grey74
  Transparent color: black
  Page geometry: 128x128+0+0
  Dispose: Undefined
  Iterations: 0
  Compression: None
  Orientation: Undefined
  Properties:
    Signature: 6f21d64285a2a5985b9bb09b420a6dbd22ba04cac7f68863106bee4bd19e1694
  Artifacts:
    Verbose: true
  Tainted: False
  Filesize: 64.0176kb
  Number pixels: 16kb
  Version: ImageMagick 6.3.9 02/24/08 Q16 http://www.imagemagick.org
Expected result (converted via Paint.NET)

Image

Code: Select all

d:\Programs\ImageMagick-6.3.9-Q16>identify.exe -verbose img_out.png
Image: img_out.png
  Format: PNG (Portable Network Graphics)
  Class: DirectClass
  Geometry: 128x128+0+0
  Resolution: 37.79x37.79
  Print size: 3.38714x3.38714
  Units: PixelsPerCentimeter
  Type: TrueColor
  Endianess: Undefined
  Colorspace: RGB
  Depth: 8-bit
  Channel depth:
    Red: 8-bit
    Green: 8-bit
    Blue: 8-bit
  Channel statistics:
    Red:
      Min: 0 (0)
      Max: 255 (1)
      Mean: 185.399 (0.727053)
      Standard deviation: 79.7285 (0.312661)
    Green:
      Min: 0 (0)
      Max: 255 (1)
      Mean: 168.842 (0.662124)
      Standard deviation: 92.2153 (0.361629)
    Blue:
      Min: 0 (0)
      Max: 255 (1)
      Mean: 160.662 (0.630048)
      Standard deviation: 98.8518 (0.387654)
  Rendering intent: Saturation
  Gamma: 0.45455
  Chromaticity:
    red primary: (0.64,0.33)
    green primary: (0.3,0.6)
    blue primary: (0.15,0.06)
    white point: (0.3127,0.329)
  Interlace: None
  Background color: white
  Border color: rgb(223,223,223)
  Matte color: grey74
  Transparent color: black
  Page geometry: 128x128+0+0
  Dispose: Undefined
  Iterations: 0
  Compression: Zip
  Orientation: Undefined
  Properties:
    Signature: a232d1fde07b090260d61c9f0541c91cfe32ff760612dd049da04698ac5be631
    Software: Paint.NET v3.5.10
  Artifacts:
    Verbose: true
  Tainted: False
  Filesize: 10.2031kb
  Number pixels: 16kb
  Version: ImageMagick 6.3.9 02/24/08 Q16 http://www.imagemagick.org
Produced with convert

Image

Code: Select all

d:\Programs\ImageMagick-6.3.9-Q16>identify.exe -verbose img_convert_out.png
Image: img_convert_out.png
  Format: PNG (Portable Network Graphics)
  Class: DirectClass
  Geometry: 128x128+0+0
  Resolution: 72x72
  Print size: 1.77778x1.77778
  Units: Undefined
  Type: TrueColor
  Endianess: Undefined
  Colorspace: RGB
  Depth: 8-bit
  Channel depth:
    Red: 8-bit
    Green: 8-bit
    Blue: 8-bit
  Channel statistics:
    Red:
      Min: 0 (0)
      Max: 255 (1)
      Mean: 56.1252 (0.220099)
      Standard deviation: 68.0981 (0.267051)
    Green:
      Min: 0 (0)
      Max: 255 (1)
      Mean: 39.5311 (0.155024)
      Standard deviation: 50.1294 (0.196586)
    Blue:
      Min: 0 (0)
      Max: 239 (0.937255)
      Mean: 31.3704 (0.123021)
      Standard deviation: 40.7389 (0.15976)
  Rendering intent: Undefined
  Interlace: None
  Background color: white
  Border color: rgb(223,223,223)
  Matte color: grey74
  Transparent color: black
  Page geometry: 128x128+0+0
  Dispose: Undefined
  Iterations: 0
  Compression: Zip
  Orientation: Undefined
  Properties:
    Signature: 6f21d64285a2a5985b9bb09b420a6dbd22ba04cac7f68863106bee4bd19e1694
  Artifacts:
    Verbose: true
  Tainted: False
  Filesize: 14.7891kb
  Number pixels: 16kb
  Version: ImageMagick 6.3.9 02/24/08 Q16 http://www.imagemagick.org
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: TGA to PNG conversion problem

Post by snibgo »

Your version of IM is very old.

A more recent version, 6.7.9, creates a transparent margin on the right and bottom.
snibgo's IM pages: im.snibgo.com
Post Reply