Page 1 of 1

Option for TGA format image origin

Posted: 2015-09-07T02:00:18-07:00
by tgd
I can not find an option for specifiying the image origin for TGA files.
I am using convert.exe to crop a TGA file. It has the origin in top-left corner. After the crop the origin is bottom-left.
Is there an option to preserve the original setting?

Regarding the origin, i am talking about the header information in the file:

header[17] bits 5 and 4, being 01 means origin is at bottom-left.
header[17] bits 5 and 4, being 10 means origin is at top-left.

Information from here:
https://github.com/processing/processing/issues/1682

See also:
https://en.wikipedia.org/wiki/Truevision_TGA#Header

Thanks for any hints.
I have tried +repage and also -extent with no luck.

Re: Option for TGA format image origin

Posted: 2015-09-08T17:31:51-07:00
by Jason S
As far as I can tell, there is no such feature, as of ImageMagick 6.9.2-0. IM only ever sets the descriptor/attributes byte to 0, 1, or 8; so bits 5 and 4 are always 0, and the orientation is always bottom-left. (You said bottom-left is 01, but I'm pretty sure it's 00.)

Re: Option for TGA format image origin

Posted: 2015-09-11T15:39:00-07:00
by tgd
Jason S wrote: (You said bottom-left is 01, but I'm pretty sure it's 00.)
Just quoted that guy, can not verify: https://github.com/processing/processing/issues/1682
Anyway it is a pity that IM does not honour that attribute :(

Re: Option for TGA format image origin

Posted: 2015-09-11T15:58:04-07:00
by fmw42
Post a request in the Developers Forum.

Re: Option for TGA format image origin

Posted: 2015-09-11T23:08:42-07:00
by dlemstra
I just committed a patch to our GIT repository to make sure we preserve the image origin of TGA files. This will be available in the next release of ImageMagick (6.9.2-1). You can also change it yourself by defining 'tga:image-origin', below is an example.

Code: Select all

convert logo: -define tga:image-origin=TopRight logo.tga

Re: Option for TGA format image origin

Posted: 2015-09-15T00:41:46-07:00
by tgd
Works like a charm, thank you.