Newbie: Help with Arc distortion variant

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
Turing Complete

Newbie: Help with Arc distortion variant

Post by Turing Complete »

I want to do the following distortion:

Image

Is there a specific name for this?

Is there a built in tool to do it?

If I need to use -fx, could someone give me a hand with it?

Thanks all.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Newbie: Help with Arc distortion variant

Post by fmw42 »

see barrel distortion http://www.imagemagick.org/Usage/distorts/#barrel

see Anthony's rose examples

you need to combine half of two images, top half of bulge (barrel) and bottom half of pinch (pincushion)

rose.jpg
Image

convert rose.jpg -matte -virtual-pixel transparent \
-distort Barrel "0.0 0.0 0.0 1.0 0.0 0.0 0.5 0.5" \
barrel_bulge.png
Image

convert rose.jpg -matte -virtual-pixel transparent \
-distort Barrel "0.0 0.0 0.0 1.0 0.0 0.0 -0.5 1.9" \
barrel_pinch.png
Image


convert barrel_bulge.png[70x23+0+0] barrel_pinch.png[70x23+0+23] -append barrel_bulge_pinch.png
Image


In one long command line it would be:

convert rose.jpg \
\( -clone 0 -matte -virtual-pixel transparent \
-distort Barrel "0.0 0.0 0.0 1.0 0.0 0.0 0.5 0.5" -crop 70x23+0+0 +repage \) \
\( -clone 0 -matte -virtual-pixel transparent \
-distort Barrel "0.0 0.0 0.0 1.0 0.0 0.0 -0.5 1.9" -crop 70x23+0+23 +repage \) \
-delete 0 -append barrel_bulge_pinch.png


see http://www.imagemagick.org/Usage/basics/#image_seq
for parenthesis and image sequence processing

Good reading at:

http://www.imagemagick.org/Usage/

and

http://www.imagemagick.org/script/comma ... ptions.php
Turing Complete

Re: Newbie: Help with Arc distortion variant

Post by Turing Complete »

Thanks for taking the time to answer my question. Unfortunately your suggestion gives

Image

when what I'm looking for is

Image

Is there something else to try?
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Newbie: Help with Arc distortion variant

Post by anthony »

Use the older -wave distortion.

http://www.imagemagick.org/Usage/distorts/#wave

this offsets each column of the image according to the sine-wave you specified. A half cycle sin wave looks exactly like what you want.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply