0

I would like to warp/distort a rectangle into a circle, by squeezing all its outermost points (corners) inwards and pulling its innermost points (edge midpoints) outwards.

Effects like bulge, liquify tool's grow/expand, ImageMagick's implode/explode, don't seem to move the edges of the image. They just distort its centre regions leading to ugly images, not how I want them to look.

The way I imagine the output would be how some shape of concave mirror would have reflected the scene the image depicts, oriented (concave mirror reflections might be upside down).

Sorry for the poor sketch, but I hope it can get the idea across visually:

enter image description here

I don't mind which tool/editor answers use.

1
  • The only options I can think of are Photoshop's Polar Coordinates filter - which typically won't distort AND retain clarity... or manual alteration. – Scott Jun 19 '20 at 16:19
3

Illustrator's envelope distortion makes it:

enter image description here

In the left there's your rectangular drawing.

In the middle there's a circle.

In the right there's the result when both are selected and Object > Envelope distortion > Make with top object is applied. NOTE: There's no need to have a square image. The mapping will work in the same way if you stretch the image to square before applying the envelope distortion.

Polar coordinates and mapping on a revolved surface in Illustrator probably give in an unwanted way distorted results. I skip them because others seem to have written about it and there's an older case about them: Want to make a concave lens effect

There's also tried plain manual warping in Photoshop.

To make the envelope distorted version look like it's on concave surface needs proper shading and some spherizing distortion. The shading can be stolen (=used with blending mode multiply or hard light) from a rendered concave surface.

If this is a mirror, no shading is needed, but the distortion is probably useful. It can be inserted in Photoshop after the envelope distortion. The images can be copied and basted between Photoshop and Illustrator to bot directions.

Photoshop has distorting filters spherize and pinch. Also misusing manual lens distortion correction can be used.

ADD due a comment:

The questioner said that the envelope distortion packs stuff too densely from the corners. He wanted to know how a custom mapping can be defined. He didn't ask the equations, only a framework where he could use his own mapping equations.

Affinity Photo has user writable image mapping equations. Enter to the equation input mode by selecting the pixel layer which contains the image, in this case your rectangular drawing. Have a copy because the result will be written to the original layer.

Select Filter > Distort > Equations. The next dialog is opened:

enter image description here

Here the image is scaled to 50% but only horizontally. Y-scaling is intact.

The written equations define for every point (x,y) in the modified image which are the coordinates of the content of (x,y) in the original image. x=2x, y=y means that the content for point (x,y) is taken from point (2x,y). It squeezes the image horizontally to 50%.

x and y are in the rectangular mode the actual pixel numbers starting from zero. I guess you could write something usable in polar coordinate mode. I'm afraid the space between my ears is too narrow for that job.

ADD2: Reading more carefully the question declared that reflection from a concave mirror is the wanted result, so my talks about right shading for the apparent concave surface were useless.

But there's more useless writing and part of it is in the question. Perfect concave mirror reflects like a perfect convex lens refracts. When watched from distant enough one can see a squeezed upside down image.

Now a fact: If the lens or the mirror were circular the squeezed upside down image would cropped to circular. It presents a bigger round area of the environment, no mapping from an rectangular area to circle happens. The lens or the mirror should be rectangular to show rectangular area.

If it still should be a rectangular area mapped into a circle perfectly placing the edge to the edge and keeping locally the proportions, the corners must be tightened. That's because in circle the distance from the center to the edge is constant. In a rectangle the corners are further from the center than the midpoints of the sides. I guess you do not find any acceptable workaround for this ice cold math fact.

People who understand math maybe would see a problem in keeping the local proportions. 90 degrees corners are transformed to 180 degrees. Intuitively it looks like the smaller distance to a corner in the rectangular image the bigger loss of proportions in the mapped image.

7
  • Adding empty canvas around image allows one to spherize the way op describes. – joojaa Jun 19 '20 at 17:42
  • Envelope Distort squashes the corners more than I'd like. The stuff near corners becomes too close to the edge of the circle – theonlygusti Jun 19 '20 at 21:48
  • @joojaa what do you mean? – theonlygusti Jun 19 '20 at 21:52
  • @theonlygusti If you can say as calculation formulas from which coordinates of the rectangular image any point (x,y) inside the circle should be taken you can input the formulas to a custom mapping function. Using them for custom distortions is possible at least in Affinity Photo. – user287001 Jun 19 '20 at 22:09
  • @user287001 please can you turn that into a step-by-step answer? I don't think it's necessary for your answer to include the formula itself, which I'd have to come up with, but I'd love to know how to apply a formula to an image. – theonlygusti Jun 19 '20 at 22:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.