Tony Gutierrez
Tony Gutierrez

Reputation: 771

How to do an Imagemagick barrel distort and maintain full photo data without autocrop?

I am applying barrel distortion to an image in imagemagick. The desired resulting image would look something like this: enter image description here

As you can see, the photo is no longer a square, and the voids are filled with black. I cannot figure out how to do this in imagemagick. All my distorts are always auto cropped to a square.

magick in.jpg -virtual-pixel Black -distort Barrel "0 0 -0.3" out.png

enter image description here

I realize I can manually add pixels to the image, but I really want it to just auto grow to the resulting size of the distort. I have tried various things I have found online, to no avail.

Upvotes: -1

Views: 40

Answers (1)

Tony Gutierrez
Tony Gutierrez

Reputation: 771

The answer seems to be using the 4th (D) parameter to specify the zoom out.

The formula is defaultD = 1-(A + B + C). Then increase defaultD slightly to zoom out.

Upvotes: 0

Related Questions