Page 1 of 1
Help: geometric distortion in crop + resize conversion
Posted: 2016-08-25T03:53:53-07:00
by rh744
Hi all,
Having some issues with the following conversion using ImageMagick-7.0.2-9-portable-Q16-x64 on Windows Server.
Code: Select all
convert 168032_apm_uc.psd -auto-orient -alpha transparent -clip -alpha opaque -trim -density 120 -profile 'C:/icc/sRGB.icc' +profile 'xmp' -resize 1080x1080 168032_apm_uc.psd
The problem is the geometric noise / distortion generated in the output - you can see this in the lighter regions of the below image. Interestingly, we only get this when we use both -clip and -resize in the one command. (If we do one, but not both, we get a normal transformation.) Have already tried applying some different resize filters, but no significant change.
Any tips?
Example Image
(Problem render is on left - normal is on right)
Thanks!
Re: Help: geometric distortion in crop + resize conversion
Posted: 2016-08-25T09:07:00-07:00
by snibgo
There is a kind of interference pattern, perhaps from very high frequency data. You never turn clipping off with "+clip", so trim, profile, resize etc will apply only to the clipped regions.
If that doesn't cure the problem, please provide a link to the image file.
Re: Help: geometric distortion in crop + resize conversion
Posted: 2016-08-25T21:39:18-07:00
by rh744
Thanks very much, snibgo.
A modified command of:
Code: Select all
convert 168032_apm_uc.psd -auto-orient -alpha transparent -clip -alpha opaque +clip -trim -density 120 -profile 'C:/icc/sRGB.icc' +profile 'xmp' -resize 800x800 168032_apm_uc.psd
...does indeed remove the interference pattern! However, it also seems to have introduced a loss of sharpness. See
example.
I thought it might be excessive jpg compression, so I set it to 92, and also threw in some manual sharpen.
Code: Select all
convert 168032_apm.psd -auto-orient -alpha transparent -clip -alpha opaque +clip -trim -density 1200 -profile 'C:/icc/sRGB.icc' +profile 'xmp' -resize 800x800 -unsharp 0x0.5 -quality 92 168032_SHARP92.jpg
See
example.
The result is a little better, but there is still a loss of sharpness when compared to the original. (I want to try and avoid the loss in the first place, rather than adding sharpen later.)
Compare to
Control file - desired outcome.
I would upload the source PSD, but it is 1.1Gb...
Any tips appreciated.
Thanks!
Re: Help: geometric distortion in crop + resize conversion
Posted: 2016-08-25T21:56:53-07:00
by fmw42
Instead of something like this:
Code: Select all
convert -quiet test.tif -alpha transparent -clip -alpha opaque -strip result.tif
Try something like this (unix syntax):
Code: Select all
identify -quiet -format "%[8BIM:1999,2998:#1]" test.tif |\
convert -quiet test.tif \( - -negate \) \
-alpha off -compose copy_opacity -composite \
-define tiff:alpha=associated \
result.tif
I have found this to do a better job in terms of antialiasing quality.
Same think should work for PSD, I think.
For conversion to Windows syntax, see
http://www.imagemagick.org/Usage/windows/
Remove \ from before ( and from before ) and change end of line \ to ^. I assume Windows allows pipes.
Re: Help: geometric distortion in crop + resize conversion
Posted: 2016-08-25T22:12:39-07:00
by snibgo
I couldn't download 1.1 GB!
For sharpness testing, I suggest you don't write to JPEG. It just adds another variable. Save to a lossless format such as PNG.
How did you make the control file? Photoshop is known to add a little sharpening to "pure" resizing.
My favourite method for downsizing while retaining sharpness, without adding ringing or other bad effects, is shown on my page "Resampling with halo minimization":
http://im.snibgo.com/resamphm.htm#downshp
It's a bit complex, and slow, and the results are subjective, but I do like them.
You are using Windows, so you could try my script.