Option for TGA format image origin

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
tgd
Posts: 3
Joined: 2015-09-07T01:46:30-07:00
Authentication code: 1151

Option for TGA format image origin

Post 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.
Jason S
Posts: 103
Joined: 2010-12-14T19:42:12-07:00
Authentication code: 8675308

Re: Option for TGA format image origin

Post 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.)
tgd
Posts: 3
Joined: 2015-09-07T01:46:30-07:00
Authentication code: 1151

Re: Option for TGA format image origin

Post 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 :(
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Option for TGA format image origin

Post by fmw42 »

Post a request in the Developers Forum.
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Option for TGA format image origin

Post 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
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
tgd
Posts: 3
Joined: 2015-09-07T01:46:30-07:00
Authentication code: 1151

Re: Option for TGA format image origin

Post by tgd »

Works like a charm, thank you.
Post Reply