Page 1 of 1

Shepards distort performance improvement?

Posted: 2019-03-26T08:06:32-07:00
by tresorjoe
Hello,

I am facing performance issues on large RGB files (example 20000px by 12000px). The Shepards distort takes >30 minutes to process such kind of files. I have tried with TIF format (with and without LZW compression) as well as PSD file format. Also tried Q8 version of ImageMagick but the improvement is minimal. Working on a virtual Windows 10 (2017 Macbook Pro fully powered, running Parallels Desktop with 2GB RAM, 2 CPUs). Might that be too low?

Are there any tricks to drastically improve the performance? The final intention is to run files with approx. 60000px by 30000px in under a minute with "standard" hardware.

PS: I have tried to run it natively on Mac, here are the results:
TIF (no LZW): 1:54.809
TIF (LZW): 1:55.719
PSD: 1:50.549

Thanks,
Joe

Re: Shepards distort performance improvement?

Posted: 2019-03-26T08:25:17-07:00
by snibgo
You have large images (20000px by 12000px is 240 megapixels, which needs about 2 GB memory) on a machine with only 2 GB memory? Then IM will store the pixe cache on disk, which is very slow. I suggest you use a machine with more memory.

How many control points are in the Shepards distortion? Every output pixel depends on every control point, so reducing that number will improve performance.

Re: Shepards distort performance improvement?

Posted: 2019-03-26T08:37:14-07:00
by tresorjoe
That makes sense, thanks for the info.
There are 7 control points in Shepards distortion, where the 4 corner points are fixed (input = output) and 3 points are moved (left-center, center-center, right-center). I think I need all of these 7 points to obtain the distortion that I need. Further ideas?
Thanks again

Re: Shepards distort performance improvement?

Posted: 2019-03-26T09:06:35-07:00
by snibgo
Here's a simple test, with just two control points:

Code: Select all

magick -size 20000x12000 xc: -distort Shepards "0,0,0,0 19999,0,19999,0" NULL:
On my 12 GB Windows 8.1 laptop, this uses disk for pixel caches (2 files each 2.8 GB), and takes 3 minutes. (So 7 control points would need 10.5 minutes on my computer.)

Halving the width doesn't use the disk, and takes 20 seconds. (So 7 control points would need 70 seconds.)

Based on this, I'm fairly sure you don't have enough memory, and that increasing this will solve your performance problem.