Flipped TGA file when Image Origin isn't BottomLeft
Posted: 2018-09-21T16:23:22-07:00
Default convert to Targa image-origin seems to be BottomLeft (using build-in stock rose image as demo):
equivalent to convert rose: -define tga:image-origin=BottomLeft rose.tga
Image isn't flipped.
Simulating Krita TGA export in ImageMagick:
(Krita outputs TGA files with Image Origin TopLeft (0x10) and Alpha channel added)
Image is flipped vertically
i.e changing -define tga:image-origin=BottomLeft to other values flips the image around.
(BottomRight for horizontal flip)
Context: I've wanted to remove alpha channel from Krita's TGA exports to save filesize,
e.g: convert rose_32bpp.tga -alpha off rose_24bpp.tga
but ImageMagick kept flipping the image vertically, making it very confusing to see what's going on before i diff'd the TGA metadata between converted TGA images.
It looks like ImageMagick preserves the origin set in TGA input to output, but uses BottomLeft internally?
I would have expected alpha channel to be removed without flipping the image.
Platform: Linux x64
convert -version
Version: ImageMagick 7.0.8-11 Q16 x86_64 2018-08-29 https://www.imagemagick.org
Copyright: © 1999-2018 ImageMagick Studio LLC
License: https://www.imagemagick.org/script/license.php
Features: Cipher DPC HDRI Modules OpenCL OpenMP
Delegates (built-in): bzlib cairo fontconfig freetype gslib heic jng jp2 jpeg lcms lqr ltdl lzma openexr pangocairo png ps raw rsvg tiff webp wmf x xml zlib
Code: Select all
convert rose: rose.tga
Image isn't flipped.
Simulating Krita TGA export in ImageMagick:
Code: Select all
convert rose: -define tga:image-origin=TopLeft -alpha on rose_32bpp.tga
Code: Select all
identify -verbose rose_32bpp.tga | grep image-origin
tga:image-origin: TopLeft
i.e changing -define tga:image-origin=BottomLeft to other values flips the image around.
(BottomRight for horizontal flip)
Context: I've wanted to remove alpha channel from Krita's TGA exports to save filesize,
e.g: convert rose_32bpp.tga -alpha off rose_24bpp.tga
but ImageMagick kept flipping the image vertically, making it very confusing to see what's going on before i diff'd the TGA metadata between converted TGA images.
It looks like ImageMagick preserves the origin set in TGA input to output, but uses BottomLeft internally?
I would have expected alpha channel to be removed without flipping the image.
Platform: Linux x64
convert -version
Version: ImageMagick 7.0.8-11 Q16 x86_64 2018-08-29 https://www.imagemagick.org
Copyright: © 1999-2018 ImageMagick Studio LLC
License: https://www.imagemagick.org/script/license.php
Features: Cipher DPC HDRI Modules OpenCL OpenMP
Delegates (built-in): bzlib cairo fontconfig freetype gslib heic jng jp2 jpeg lcms lqr ltdl lzma openexr pangocairo png ps raw rsvg tiff webp wmf x xml zlib