Offset issue in PNG and GIF using "import"

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
Skippy

Offset issue in PNG and GIF using "import"

Post by Skippy » 2009-09-01T04:45:49-07:00

Hi,

When using the "import" command for creating a PNG or a GIF image, then selecting a part of the screen, the resulting image bounds will not correspond to the selected zone. In particular :

* import file.png : the resulting file will have correct dimensions, but the selected zone will be outside the image.
* import file.gif : the resulting file will have the same dimensions as the screen, and the selected zone will be a small part of it.

When opening the PNG image with the Gimp, it will prompt you that "the PNG file specifies an offset that caused the layer to be positioned outside the image".

In each case, the empty zone being transparent. There seems to be no issue with JPG images.

I'm currently using Fedora 10, and :
Version: ImageMagick 6.4.0 07/27/08 Q16

However, I have encountered this behaviour on Scientific Linux (4?) as well, with this version :
Version: ImageMagick 6.0.7 04/17/08 Q16

User avatar
magick
Site Admin
Posts: 10686
Joined: 2003-05-31T11:32:55-07:00

Re: Offset issue in PNG and GIF using "import"

Post by magick » 2009-09-01T06:10:17-07:00

Add +repage to your command line to remove the virtual page offset from your image.

Skippy

Re: Offset issue in PNG and GIF using "import"

Post by Skippy » 2009-09-02T02:25:31-07:00

Thanks for the tip ! :D

Hopefully this thread will be helpful for other people in the same case.

However, the +repage option should be the default, for at least two good reasons :

1/ What is the point of selecting an area if the final image doesn't fit ? This is not the expected behaviour.
2/ The behaviour is different depending on the file format, which does not make sense.

So, is there a reason for which it is an option ?

Skippy

Re: Offset issue in PNG and GIF using "import"

Post by Skippy » 2009-09-04T05:58:37-07:00

BTW, the +repage option does not seem to exist for the old version (6.0.7, see first post). Is there any workaround ? (Upgrading is not an option)

User avatar
magick
Site Admin
Posts: 10686
Joined: 2003-05-31T11:32:55-07:00

Re: Offset issue in PNG and GIF using "import"

Post by magick » 2009-09-04T06:11:45-07:00

Try -page +0+0.

Skippy

Re: Offset issue in PNG and GIF using "import"

Post by Skippy » 2009-09-04T09:16:10-07:00

Forgot to mention, actually I made an alias so that import calls mogrify :

Code: Select all

alias import 'import \!:1; mogrify +repage \!:1'
(This is tcsh.)

NB : And I just tested your suggestion on my local version (the one where the +repage option exists), it does not seem to work. Anyway the alias works, so this is not a problem anymore (but again, +repage *should* be the default on the current release).

Post Reply