Virtual zoom effect?

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
Brashquido
Posts: 2
Joined: 2020-01-24T17:33:23-07:00
Authentication code: 1152

Virtual zoom effect?

Post by Brashquido »

Apologies for what is probably a super simple task, very first time trying something like this. I would like to use ImageMagick to process all images in a specified directory as a batch file (or similar) and apply a linear incremental crop to each image to create a virtual zoom effect. Aspect ratio would need to be locked and preferably I'd like to be able to specify XY offset values as well which would also have an equivalent linear increment to keep the effect smooth.

I'm looking to use this on some of my star trail astrophotography to create a vortex effect similar to what is shown here using LRTimelapse.

https://youtu.be/_XiIRozt8iU

Any assistance would be really appreciated, thanks.

snibgo
Posts: 12656
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Virtual zoom effect?

Post by snibgo »

What version of IM, on what platform?

Suppose you have 101 images of stars, photographed over a couple of hours with the camera on a tripod. (Or you could cheat: do it from a single photo, duplicated 100 times, with rotations).

For each frame, I would use "-distort SRT" with four parameters. See https://www.imagemagick.org/script/comm ... hp#distort . X,Y is the coordinates of the pole star; Scale is the scale factor; Angle is zero.

The Scale will vary, perhaps from 1.0 for the first image to, say, 4.0 for the last. It should vary by a constant factor (multiplier), not a constant term (adder).

So, the first scale is 4^(0/100) = 1.0. The second is 4^(1/100), the third is 4^(2/100) and so on until the 101st is 4^(100/100) = 4. This can be done in a %[fx:...] expression.

The images are probably large, so I would create the new zoomed frames in a shell loop, with one "magick" command per frame.

Finally, combine all the frames, eg with "-compose Lighten -layers merge" to pick the lightest pixels from each frame, so the star motions merge into trails.

This doesn't give the "comet" effect of stars being significantly brighter at the start or end of each trail. Without experimenting (no time tonight), I don't know the best way for that.
snibgo's IM pages: im.snibgo.com

Brashquido
Posts: 2
Joined: 2020-01-24T17:33:23-07:00
Authentication code: 1152

Re: Virtual zoom effect?

Post by Brashquido »

Wow, thanks.

I'm using IM v7 x64 on Windows 10.

Will take a look at what you suggested and see if I can make heads or tails of it. Had never thought of taking one image and rotating it for trails. Would solve the issues such as removing plane trails from the images manually. I'll be taking a full session of 300+ photos anyway as I like to generate video time-lapse sequences as well. Stacking them up to make a trails composition is just kinda a bonus if the framing is right.

Thanks again.

snibgo
Posts: 12656
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Virtual zoom effect?

Post by snibgo »

See also Animation with SRT, where I show Windows BAT commands to make frames that pan, zoom, scale and rotate to make simple animations from a single input photo.

Your goal is a single image, not an animation, but the process of making individual frames is the same.
snibgo's IM pages: im.snibgo.com

Post Reply