0

I'm currently using ImageMagick to resize and sharpen images. I'm now moving to VIPS due to performance reasons.

I use imageMagick's unsharpMask (http://php.net/manual/en/imagick.unsharpmaskimage.php) feature to sharpen a photo after resizing it. I'm currently using the following settings:

Radius: 0
Sigma: .5
Amount: .25
threshold: .008

vips_sharpen (http://www.vips.ecs.soton.ac.uk/supported/7.42/doc/html/libvips/libvips-convolution.html#vips-sharpen) has a number of additional parameters which i'm trying to replicate the same sharpening results.

Does anyone know an easy way to work out the VIPS translation of the imagemagick unsharp mask settings? There must be some sort of formula?

David
  • 16,246
  • 34
  • 103
  • 162
  • In Photoshop, I think your parameters correspond to `Radius=0.5`, `Amount=25` and `Threshold=2`, so you may have more chances of getting to VIPS if anyone can do Photoshop to VIPS :-) – Mark Setchell Feb 24 '16 at 16:17

1 Answers1

0

This issue has been discussed on the vips issue tracker:

https://github.com/jcupitt/libvips/issues/393

But briefly:

  • radius is the same as sigma in IM. vips picks a radius for you based on the sigma setting.
  • x1 corresponds to threshold, though the scaling is different. The vips one is calculated on a L* difference image, I guess the IM one is in the range 0 - 1, so (probably?) multiply the IM value by 100.
  • y2 and y3 don't seem to have an IM equivalent. They are useful in printing to limit the amount of haloing you get on edges, I don't know how useful they'd be for screen output. The defaults are probably reasonable, but you could try turning them down.
  • m1 is (I think) always zero in IM, you could try making this a small value, it can make the transition from flat areas to edge areas less jarring.
  • m2 is equivalent to amount, I think, though the scaling is probably different.

There are some other differences. The vips one just operates on L* of CIELAB, that is, it's just a sharpening of the lightness channel, and it's perceptually uniform. The vips one was really designed for offset print work, so it's currently hard to make the much gentler adjustments you need for screen. There are some patches going through now which should make vips_sharpen() more suitable for display output.

Summary: there probably isn't a perfect parameter match up, since the underlying operators are rather different.

jcupitt
  • 10,213
  • 2
  • 23
  • 39