Search code examples
imagemagickwand

Resizing is blurry


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?


Solution

  • 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