4

I am looking for a perspective warp that is able to distort an image in a single direction, i.e. gradually changing the scale and positions of objects within the image vertically while maintaining their horizontal scale and position.

The "perspective warp" in Photoshop and similar tools in After Effects such as "corner pin" always move objects both vertically and horizontally.

Here is an example of what I want to achieve:

enter image description here

Note how the vertical grid lines are not moved in the desired outcome.

Is there any way to achieve this in tools like Photoshop, Illustrator, After Effects, or Gimp?

I should clarify that my example is not specifically what I want to achieve but merely a demonstrational image. I want to be able to do this with any image without getting the "displacement" that the usual perspective warp brings.

5
  • 3
    That's not actually perspective.
    – Tetsujin
    Jul 30 at 17:34
  • @Tetsujin Maybe I lack the vocabulary. Would it be fair to say "perspective in one dimension and isometric in the other"?
    – Zoom
    Jul 30 at 17:38
  • Not really "isometric", but rather "perspective projection in one dimension and parallel projection in the other".
    – Wolff
    Jul 30 at 19:20
  • @Scott you should undelete your answer. Thing is, often one needs to alter the model a bit. So assuming software X does what you want is a chance. But if by using half of what it offers gets it done then you are on a road to mastery. Why? Well every time you do something irs better to have a mental model that gets you home than betting on somebody having your particular usecase as the primary goal. It will eventually happen that your goal is not the most common goal.
    – joojaa
    Jul 30 at 20:21
  • @joojaa m'kay... :)
    – Scott
    Jul 30 at 21:01
6

I assume you want it works with any image, not only with rectangular boxes. The distortion you want is not perspective, you want Y scaling which depends linearly on X. Some programs allow it without having any plugins nor writing a script. The one I know is Affinity Photo. There you can use distortion with equations - you write a formula for coordinates from where in the original image pixel (x,y) is taken to the distorted image.

This is my original:

enter image description here

It's 1100 pixels wide and 400 pixels high. I placed it to start from x=0, y=0 (that's the top left corner) to have easy formulas with no offsets.

One distortion example:

enter image description here

pixel (x,y) is taken from the original image coordinates

(x, y/(1-x/2200))

Example 2:

enter image description here

pixel (x,y) is taken from the original image coordinates

(x, y/(1+x/1100))

The shown formulas are quite elementary, but Photoshop and GIMP do not have a way to use them without plugins or scripts. Unfortunately I'm not a programmer, but someone surely knows how to program them as a script.

Using add-on "G'MIC filter pack"

G'MIC is available for GIMP, Photoshop, Krita and Paint.NET. It has image mapping with math formulas at least in the deformation category filters. There are "Cartesian transform" and "Conformal mapping". The first one uses x and y formulas. The latter leans on complex numbers, so the wanted function at least needs some not so obvious math. At least name "Conformal" hints it's not designed to give results you want - conformal means keeping angles at least locally. Check this if you are familiar with math functions https://gmic.eu/reference/mathematical_expressions.html#top

G'MIC Command line version users with math and programming knowledge may see easily how to use these effectively. I skip further guessing.

A couple of tests revealed that Cartesian transform can do the same as Affinity Photo's Distort with Equations. An example:

enter image description here

Point (x,y) in the distorted image is taken from (x, y(1-x/(2w)). Parameters w and h present the width and height of the image in pixels.

Illustrator's Envelope Distortion with 1x1 mesh could be used. The idea is already said in general form by user Julian Steinman. But I want to add that Envelope Distortion works as well with vectors and raster images.

As said it can be tiresome to get it right, even with 1x1 mesh. But you can release the envelope distortion and use the same mesh for other images by applying Envelope Distortion > Make with Top Object. The mesh can be stretched to new size for a new image and it still works.

1
  • Yes you are correct in that I want it to work for any image, I should clarify that. I am afraid, like you said, that it is not possible in PS/GIMP without plugins. I think I will be able to write a plugin for it since I have wanted this transformation previously but it will just take time... Thanks for clearing up the semantics of my question. I will leave it up a bit longer to see if anyone can find a way in Adobe/GIMP, otherwise I will check out Affinity!
    – Zoom
    Jul 30 at 19:43
3

For Gimp there is the ofn-trapeze-transform script/plugin. After installation check in Filters > Distorts The plugin is fairly slow since it processes the image line of pixels after lines of pixels.

Note that what you want distorts straight lines:

enter image description here

In fact this plugin has been written to demonstrate all the bad side effects of such a transform :)

2

Separate the verticals.

What you are after is not perspective. In actual perspective what is closer to the viewer gets elongated, larger, as it moves away. What you've shown as "desired" is actually the opposite of this.

Using Illustrator..

  • Separate the internal verticals so they are not part of the grid
  • Warp the horizontals
  • Use Pathfinder > Divide to create individual boxes

enter image description here

I'd never do this with Photoshop. Photoshop is simply not geared for these types of path operations. I can be done, but there's no Pathfinder in Photoshop, so there would need to be a lot of manual path alterations. You can always do this with Illustrator then copy/paste to Photoshop as a smart object or Shape layer.

3
  • I should clarify that my example is not specifically what I want to achieve but merely a demonstrational image. I want to be able to do this with any image without getting the "displacement" that the usual perspective warp brings.
    – Zoom
    Jul 30 at 19:46
  • You are as fast as the light. Impressive.
    – Sebastiano
    Jul 30 at 22:02
  • RE: Down voter -- realize it was only after I posted this answer that the questioner made it clear the question was only representational.
    – Scott
    Aug 1 at 17:16
0

You can do that with 'warp' transformation

Very fiddly to do so but I am pretty sure that there is no other way....

You will have to set the grid to default so you have less points to move about (pretty new feature to change grid may not be there if version is not up-to-date)

enter image description here

2
  • 1
    Yes I have discovered this method as well but all that fiddling will still not amount to a perfect warp.
    – Zoom
    Jul 30 at 18:54
  • You can get it perfect. But just takes forever... My approach probably would be to draw some guidelines and work out where all the warp points have to be positioned. After all if I can get it almost done in 20 seconds you should be able to get it all perfect in some way or other if you spend an hour on it. – no easy way to do this sorry... not a common transformation – I never needed to do this before Jul 30 at 19:09

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.