Scrolling a tiling image that repeats

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
LDAsh
Posts: 35
Joined: 2015-04-27T23:10:58-07:00
Authentication code: 6789

Scrolling a tiling image that repeats

Post by LDAsh »

"Version: ImageMagick 7.0.7-28 Q16 x64 2018-03-25"
Hi, I'm trying to figure out how to scroll a tiling image, so when I shift/translate it x/y, whatever exceeds the bounds of the image will repeat on the opposite side.
Something like this:-
https://www.parallelcube.com/wp_install ... roll-0.gif

I can't figure it out, so at the moment I am making a matrix of 3x3, using "page" and then cropping the center tile. This works but is likely a workaround and much slower.
Is there a quicker way to do this that doesn't rely on always creating a 3x3 matrix and just retains the original resolution of the image?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Scrolling a tiling image that repeats

Post by snibgo »

You have linked to an animated gif that doesn't seem related to your question.

I don't understand your method of "making a matrix of 3x3, using "page" and then cropping the center tile". If you showed actual commands, I might understand.

Perhaps "-roll" is what you need. See http://www.imagemagick.org/script/comma ... s.php#roll
snibgo's IM pages: im.snibgo.com
LDAsh
Posts: 35
Joined: 2015-04-27T23:10:58-07:00
Authentication code: 6789

Re: Scrolling a tiling image that repeats

Post by LDAsh »

Thanks, "roll" was exactly what I was looking for!

Now I have a new issue with it, I wanted to do it by a percentage, like 1/8 or 1/16, so 0.125%% or 0.0625%%, but it seems like the command-line doesn't like it for this operation, or doesn't like these kind of percentages. The issue is, I don't know exactly what resolution the file might be (thus what roll "pixels" I should be using) but a percentage would always give me the number of frames I want.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Scrolling a tiling image that repeats

Post by snibgo »

Percentages work fine with recent versions of IM. For example, with 7.0.7-28:

Code: Select all

magick logo: -roll +50%+0 x.png
Note that 1/8 is 12.5%, not 0.125%. If used in Windows BAT scripts, double the percentage sign.
snibgo's IM pages: im.snibgo.com
LDAsh
Posts: 35
Joined: 2015-04-27T23:10:58-07:00
Authentication code: 6789

Re: Scrolling a tiling image that repeats

Post by LDAsh »

Oh wow, how silly of me. Helps if I get the percentages correct, hey. :P
Thanks snibgo!!!
Post Reply