Resize 'blur' option not working on 'wand' library.
Posted: 2019-04-19T17:42:27-07:00
First of all, i'm not sure I'm in the right place
I'm trying to use the Python 'Wand' binding: http://docs.wand-py.org/en/0.5.2/
Is this the right forum?
To get my feet wet, I've ported this script to python:
http://old.dylanbeattie.net/magick/filters/result.html
Unfortunately, the 'blur' parameter on resize seems to have no effect. All images for a given filter are a binary match to each other.
Actually, I was surprised to see 'blur' as a parameter to resize().. since that doesn't seem to reflect the commandline version of ImageMagick.
This page: https://imagemagick.org/script/command- ... essing.php
...identifies -blur as an image _Operator_ while -filter is an image _Setting_. I'd expect settings to be surfaced as parameters and operators as methods. Maybe that's just me.
Am I missing something?
I'm trying to use the Python 'Wand' binding: http://docs.wand-py.org/en/0.5.2/
Is this the right forum?
To get my feet wet, I've ported this script to python:
http://old.dylanbeattie.net/magick/filters/result.html
Unfortunately, the 'blur' parameter on resize seems to have no effect. All images for a given filter are a binary match to each other.
Actually, I was surprised to see 'blur' as a parameter to resize().. since that doesn't seem to reflect the commandline version of ImageMagick.
This page: https://imagemagick.org/script/command- ... essing.php
...identifies -blur as an image _Operator_ while -filter is an image _Setting_. I'd expect settings to be surfaced as parameters and operators as methods. Maybe that's just me.
Am I missing something?
Code: Select all
# Implementing something like http://old.dylanbeattie.net/magick/filters/result.html
# to test various imagemagick filters
#
from wand.image import Image
from wand.image import FILTER_TYPES
# infile = "gray.png"
infile = "face.jpg"
preamble = """
<html>
<head>
<title>ImageMagick Filters</title>
<link href="styles.css" rel="stylesheet" type="text/css">
</head>
<body>
<h1>ImageMagick Resize Filters</h1>
<p>This page demonstrates the results of resampling three images using the various resize filters and blur settings available in ImageMagick, and the file size of the resulting thumbnail images. Click the image filename at the top of each section to see the fullsize image.</p>
<p>based on this <a href="filters.pl">Perlmagick script</a> with many thanks to original author</p>
<hr>
<h1>The Results</h1>
"""
#
#
def createHTML():
# doc header
print(preamble)
# table header
print("<table cellpadding=\"5\" border=\"1\">")
print("<tr><td>Filter:</td>")
colcount = 1
blur = 0.125
while(blur <= 4):
print("<td>Blur {}</td>".format(blur))
blur = blur * 2
colcount += 1
print("</tr>")
# original image line
print('<tr><td colspan={}><a href="{}"/a> (Click for original image)</td></tr>'.format(colcount, infile, infile))
# the table
with Image(filename = infile) as imgOrg:
for filter in FILTER_TYPES:
print("<tr><td>{}</td>".format(filter));
blur = 0.125
while(blur <= 4):
blur = blur * 2
with imgOrg.clone() as img:
img.resize(128, 128, filter, blur)
newfn="img/f_{}_b_{}_org_{}".format(filter, blur, infile)
img.save(filename = newfn)
print('<td><img src="{}"></td>'.format(newfn))
print("</tr>")
# finish doc
print("</td>")
print("</body>")