2
I have an image that contains smaller images similar to this:
------
| 1 |
------
| 2 |
------
| 3 |
------
| 4 |
------
Each sub-image is 100x200, and the whole image is 100x800
I would like to combine them all into a single animation that will loop through images 1 to 4.
I use imagemagick's convert
tool to crop the images. For example, I made a batch file
convert %1 -crop 100x200+0+0 %~n1_01.png
convert %1 -crop 100x200+0+200 %~n1_02.png
convert %1 -crop 100x200+0+400 %~n1_03.png
convert %1 -crop 100x200+0+600 %~n1_04.png
And then run it on an image called main.jpg
This creates a set of images, but when I try to convert them to a gif like so
convert *.png out.gif
Instead of a single animation of size 100x200, I get an animation of size 100x800, and the images just pop up at certain offsets.
When I identify
a couple of the cropped images, it gives me
main_01.png PNG 100x200 100x800+0+0 8-bit sRGB 4.74KB 0.000u 0:00.000
main_02.png PNG 100x200 100x800+0+200 8-bit sRGB 3.39KB 0.000u 0:00.000
Presumably, imagemagick is trying to be helpful by reading the metadata and determining that I would in fact like to use a 100x800 canvas, and each image should be placed at the specific offsets. Which is not what I want.
indeed, reading the tutorial, imagemagick does leave it in there to help you out.
That is IM retains the 'virtual canvas', 'page', or 'layering' information of the image so as to preserve it for later use. This is especially important for the correct working for GIF animation handling.
When I open each file manually in paint and then re-save it, when I re-identify main_02.png
, I get
main_02.png PNG 100x200 100x200+0+0 8-bit sRGB 4.03KB 0.000u 0:00.000
Doing this for all of the images, I do the conversion to gif again and finally it is a 100x200 gif which looks like what I want.
How can I set all of the offsets to (0, 0) so that I don't have to do it manually through paint?
1When you say "reset the offsets" what do you mean? You want to restore the offsets from the original images back into the image re-saved by paint? Or you want to remove the offsets from the original images without using paint? – Jason C – 2014-07-05T02:38:37.443
@JasonC I would like to remove the original offsets. – MxLDevs – 2014-07-05T02:40:10.893