Page 1 of 1

create gif animation by scrolling a big image

Posted: 2020-05-21T10:26:56-07:00
by manit
hi,
I am using

Code: Select all

magick -version
Version: ImageMagick 7.0.7-25 Q16 x86 2018-03-04 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2015 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Visual C++: 180040629
Features: Cipher DPC HDRI
Delegates (built-in): bzlib cairo flif freetype gslib heic jng jp2 jpeg lcms lqr openexr pangocairo png ps raw rsvg tiff webp xml zlib
in windows OS.

My idea is as follows
Given :- I have an image that is 500x50 wide with a number in each 100x100 block starting from the corner.

Code: Select all

magick -background white -fill black -font "Comic-Sans-MS-Bold" -size 40x40  caption:1  caption:2  caption:3  caption:4  caption:5  caption:6  caption:7  caption:8  caption:9  caption:10 miff:- |magick montage - -tile 10x -geometry +5+5 one-to-ten.png
Now, I want to roll this image across a 50x50 pixel window so that numbers go by one after another in field of view .
If you consider one-to-ten.png and scrolling is left to right then 10 will appears first followed by nine,eight,.. upto one.
How can I accomplish this ?


Thanks.

Re: create gif animation by scrolling a big image

Posted: 2020-05-21T11:56:35-07:00
by fmw42
See -roll

Re: create gif animation by scrolling a big image

Posted: 2020-05-21T12:40:24-07:00
by snibgo
The question is vague. How many frames should the output contain? Ten, or 450, or some other number? How large should each output frame be? 50x50 or some other size?

Re: create gif animation by scrolling a big image

Posted: 2020-05-22T07:38:30-07:00
by manit
to fmw42,
did you mean http://www.imagemagick.org/Usage/warping/#roll ?
How do I use it in my case ?

to snibgo,
output frame size should be 50x50.
Number of frames should be 50 so that each number appears in 5 frames.
Thank you.

Re: create gif animation by scrolling a big image

Posted: 2020-05-22T09:11:35-07:00
by snibgo
How about this Windows BAT script:

Code: Select all

magick ^
  one-to-ten.png ^
  -duplicate 49 ^
  -crop 50x50+%%[fx:450-t*9]+0 +repage ^
  one-to-ten_1.gif
Image

Re: create gif animation by scrolling a big image

Posted: 2020-05-23T01:38:29-07:00
by manit
snibgo wrote:
2020-05-22T09:11:35-07:00
How about this Windows BAT script:

Code: Select all

magick ^
  one-to-ten.png ^
  -duplicate 49 ^
  -crop 50x50+%%[fx:450-t*9]+0 +repage ^
  one-to-ten_1.gif
Image
looks fine.
First you make 49 duplicates of original image then it seems you are cropping 50x50 frames with starting x position of crop decreasing with successive images.
+repage makes every crop in top left corner.
Then you combine all those 50x50 frames to make gif.
Is that so ?
what does t stand for ?
One thing - '1' goes away very quickly ?

Re: create gif animation by scrolling a big image

Posted: 2020-05-23T02:57:06-07:00
by snibgo
Yes, that's how it works. Adjust the expression to suit, eg instead of 9, use 10 or 9.5 or whatever. "t" is the index of the image in the list, so has the value 0, 1, 2, ... 49. See https://www.imagemagick.org/script/fx.php

EDIT: See also Animation with SRT which uses "-distort SRT" to give smoother results than "-crop".