-
Notifications
You must be signed in to change notification settings - Fork 44
Feature Request: Filter Option for Resizing. #17
Description
Hey there! Great bit of work you've got here!
I'm currently using your plugin to downscale some PNGs for retina / non-retina support. Our artist took a great deal of care and time ensuring there was no aliasing of our PNGs for optimal compression, however, when downscaling, we run into a minor issue where Aliasing is applied.
As there is no Filter Option as part of the grunt-image-resize task, there is no easy way to pass this into GraphicsMagick, however, it seems to be a fairly trivial task to add it.
On line 89 of image_resize.js:
var resizer = gm(filepath)
.resize(imOptions.width, imOptions.height);
If I hack in:
var resizer = gm(filepath)
.filter('Point')
.resize(imOptions.width, imOptions.height);
I receive a Downscaled image with my specific use case solved for! Hooray!
Obviously, this is not the final solution for the code, I would propose we allow a new Option to be passed via Grunt, which is "filter" (Or "interpolation", I don't really care what we name it). Filter would default to what GraphicsMagick defaults to if not passed via Grunt.
Available options would include:
Point | Box | Triangle | Hermite | Hanning | Hamming | Blackman | Gaussian | Quadratic | Cubic | Catrom | Mitchell | Lanczos | Bessel | Sinc
From GraphicsMagick documentation, here: http://www.graphicsmagick.org/GraphicsMagick.html#details-filter
As most people want clean, smooth, aliased resizes which Grunt Image Resizes supports, this is definitely a unique use case, but it would be great to see it added!


