Mimic Photoshop Bicubic Automatic Resampling

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
khavish
Posts: 12
Joined: 2017-10-27T07:37:54-07:00
Authentication code: 1151

Mimic Photoshop Bicubic Automatic Resampling

Post 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
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Mimic Photoshop Bicubic Automatic Resampling

Post 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
snibgo's IM pages: im.snibgo.com
khavish
Posts: 12
Joined: 2017-10-27T07:37:54-07:00
Authentication code: 1151

Re: Mimic Photoshop Bicubic Automatic Resampling

Post 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
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Mimic Photoshop Bicubic Automatic Resampling

Post 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
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Mimic Photoshop Bicubic Automatic Resampling

Post 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.
snibgo's IM pages: im.snibgo.com
khavish
Posts: 12
Joined: 2017-10-27T07:37:54-07:00
Authentication code: 1151

Re: Mimic Photoshop Bicubic Automatic Resampling

Post 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.
Jason S
Posts: 103
Joined: 2010-12-14T19:42:12-07:00
Authentication code: 8675308

Re: Mimic Photoshop Bicubic Automatic Resampling

Post by Jason S »

This is surely outdated, but I want to point out my writeup about Photoshop's algorithms from 2011.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Mimic Photoshop Bicubic Automatic Resampling

Post by snibgo »

Interesting. Thanks for that.

IM may have changed in this area since 6 years ago, but it provides some insight.
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Mimic Photoshop Bicubic Automatic Resampling

Post 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
Post Reply