Page 1 of 1

Mimic Photoshop Bicubic Automatic Resampling

Posted: 2017-10-27T09:11:35-07:00
by khavish
I am trying to get similar output in terms of quality that i get in photoshop with imagemagick while resizing an image.

Original : https://upload.wikimedia.org/wikipedia/ ... u_edit.jpg
Photoshop settings
Image

Target size: 1170x882

Here is what i have tried thus far

convert mural_orig.jpg -filter Catrom -resize 1170x882 mural_resize_khavish_catrom.png
convert mural_orig.jpg -resize 1170x882 mural_resize_khavish.png
convert mural_orig.jpg -unsharp 0.25x0.25+8+0.065 -resize 1170x882 mural_resize_khavish_unsharp.png

I think the photoshop generated resize image is better as it sharper than the others.

My aim here is better image quality that has best fidelity to the original.The filesize is not important

Resized images:
https://drive.google.com/file/d/0B_s7n4 ... sp=sharing

Re: Mimic Photoshop Bicubic Automatic Resampling

Posted: 2017-10-27T09:34:41-07:00
by snibgo
For downsizing with sharpening, I recommend the technique shown in Resampling with halo minimization. For example, this seems very close to your Photoshop example (both over-sharpened, in my view). I have renamed your input as "MuralPav.jpg".

Code: Select all

call %PICTBAT%resampHM MuralPav.jpg 1170x882 d 200 . . out.png

Re: Mimic Photoshop Bicubic Automatic Resampling

Posted: 2017-10-27T09:51:00-07:00
by khavish
I have never used a custom script with IM thus far so forgive my ignorance.I run IM on a Unix environment and not windows.Do you have a unix version of the script.If possible could you upload the downsampled image from your script so that I can also visually compare.

Thanks a ton for the help

Re: Mimic Photoshop Bicubic Automatic Resampling

Posted: 2017-10-27T10:02:27-07:00
by fmw42
Photoshop adds some unshapening but after the resize. So try

Code: Select all

convert mural_orig.jpg -filter Catrom -resize 1170x882 -unsharp 0x1+1+0.05 out.png
See http://www.imagemagick.org/script/comma ... hp#unsharp

Set radius to 0 --- that lest IM determine the best radius for the given sigma
Set sigma to around 0.5 to 1.5
Set gain to around 0.5 to 1.5
Set threshold to a small number such as 0.05

Re: Mimic Photoshop Bicubic Automatic Resampling

Posted: 2017-10-27T10:42:24-07:00
by snibgo
I've uploaded the result to:
http://snibgo.com/imforums/MuralPavOut.png

Here's the image, but mangled by bbs forum software:
Image

I wrote the BAT script, but adapted it from the bash script referenced at the top of my page.

Re: Mimic Photoshop Bicubic Automatic Resampling

Posted: 2017-10-27T22:42:10-07:00
by khavish
So far snibgo looks better and Fred's command and my attempts above make the image too sharp when compared to the original.

Re: Mimic Photoshop Bicubic Automatic Resampling

Posted: 2017-10-29T08:17:17-07:00
by Jason S
This is surely outdated, but I want to point out my writeup about Photoshop's algorithms from 2011.

Re: Mimic Photoshop Bicubic Automatic Resampling

Posted: 2017-10-29T10:06:45-07:00
by snibgo
Interesting. Thanks for that.

IM may have changed in this area since 6 years ago, but it provides some insight.

Re: Mimic Photoshop Bicubic Automatic Resampling

Posted: 2017-10-29T11:10:54-07:00
by fmw42
Catrom is the same as Keys cubic convolution. But is only one of the bicubic family. It produces a very sharp image, but has other artifacts. As both Jason S and snibgo have pointed out. You can tailor your bicubic filter in ImageMagick.

See
http://www.imagemagick.org/Usage/filter/#cubic_bc
http://www.imagemagick.org/Usage/filter/nicolas/

If one of those that looks good to you in terms of artifacts do not produce enough sharpening, then add some small amount of -unsharp.

I think only Photoshop knows exactly how they are tailoring the bicubic and unsharpening. Experimentation as snibgo or Jason S have done is the the only way to get something close.

See also
http://www.imagemagick.org/Usage/filter/#photoshop