Reproduce Photoshop warping effect accurately with ImageMagick

44 Views Asked by At

I'm trying to distort an image using ImageMagick that will reproduce an effect in that was done in Photoshop.

Trying various approaches but nothing quite matches the original very closely, which is what I'm after. I'd also love to be able to have a way to "translate" the Photoshop effects into ImageMagick, even if it requires some manual poking and picking and writing down coordinates.

Given these images, I'm essentially trying to go from source to target by inferring as much as possible from the warp source.

What I've tried so far:

  • Using a 3rd order polynomial distortion mapping each of the control points (green squares) from the source image to the result image. It's probably the closest I have so far, but it's visibly different and requires manual fidgeting in the numbers.
  • A Shepards distortion using various vertices and power parameter (probably most unreliable of them all)
  • A perspective distortion of the four source corners to the four resulting corners, followed up by a Shepards distortion on the middle top and bottom vertices (moving them up), while also locking the corners so they don't move

Next on my last was to multiply the photoshop a good chunk of times so I have maybe not 16, but 128 or more vertices, which I could mark and find using some processing script. I was planning give Barrel distortions a chance, applying them to specific edges, probably in combination with a 4-point Perspective distortion, but I'm probably going to take a step back and take a break first.

Am I overthinking this? Is there a simpler, more robust way to achieve this? Searching the internet I also stumbled upon BigWarp, which was probably the simplest (and most fun) in terms of getting the warp transform reproducible using Landmark mode and re-applying it to other images using the saved landmarks file, but it requires more tooling and it's GPL-licensed so that will probably be the last resort if I can't get it up and running with pure ImageMagick.

Thanks for any pointers or help as I've been banging my head against a wall for a while now :)

0

There are 0 best solutions below