0

Windows 10

ImageMagick 7.0.10-12 Q16x64 2020-05-15

Wand 0.6.1

I do:

i.resize(width=new_width, height=new_heigh, filter='triangle', blur=-1)

Result: blurry with the comparable image size. Say, original width is 640, new width is 610. Filter and blur params don't seem to infulence anything. I tried blur=0, blur=0.1. As for filter, i tried filter=undefined.

enter image description here

enter image description here

How can I cope with this blurry problem?

halfer
  • 19,824
  • 17
  • 99
  • 186
Michael
  • 4,273
  • 3
  • 40
  • 69

1 Answers1

2

Your issue is that blur values are >0. You have specified a negative value. If you want sharpening, use values between 0 and 1.

The documentation at http://docs.wand-py.org/en/0.5.9/wand/image.html says:

blur (numbers.Real) – the blur factor where > 1 is blurry, < 1 is sharp. default is 1

So in Python/Wand it would be for example:

Input:

enter image description here

from wand.image import Image
from wand.display import display

with Image(filename='pigeons.jpg') as img:
    img.resize(width=550, height=350, filter='triangle', blur=0.5)
    img.save(filename='pigeons_resized.png')
    display(img)


Result:

enter image description here

Note that you might get better results using filter=lanczos

fmw42
  • 46,825
  • 10
  • 62
  • 80
  • I'd advise against using filters like blur by default. It's best to choose the right scaling algorithm (https://legacy.imagemagick.org/Usage/resize/) in the first place, which depends on the operation (upsampling, downsampling by a little, by a lot) and the type of image (photo, vector art). For this particular case, resize with the Lanczos filter would be the best. For downsampling vectors with alpha, Lanczos would generate ringing artifacts, so Box or Triangle would be better, but I'd probably use the "scale" operation, not "resize", which uses a different sampling algorithm. – blade Sep 08 '22 at 07:59