Controling pixelisation amount
Posted: 2012-07-19T13:03:55-07:00
I want to pixelate a number of files of different sizes with a given percentage e.g. 90%. The current recommendation of down/upscaling images does indeed pixelate images, but running -scale 10% -scale 1000% on a folder of images doesn't pixelate them all in the same way i.e. the pixel "tiles" are different sizes.
I've asked for help elsewhere and was given this script
(You would save this to pixelate.sh and run ./pixelate 0.9 infile.jpg outfile.jpg (where 0.9 is the percentage amount)
Although this method is effective, it changes the dimensions of images that have a dimension that ends in an odd number. Is there a way to reliably pixelate an image with a specified percentage that will not modify the image dimensions?
Also, will ImageMagick ever gain a simple -pixelate option?
I've asked for help elsewhere and was given this script
Code: Select all
#!/bin/bash
AMOUNT=$(echo "1.001 - $1" | bc -l)
INFILE=$2
OUFILE=$3
COEFF1=$(echo "100 * $AMOUNT" | bc -l)
COEFF2=$(echo "100 / $AMOUNT" | bc -l)
convert -scale $COEFF1% -scale $COEFF2% $INFILE $OUFILE
Although this method is effective, it changes the dimensions of images that have a dimension that ends in an odd number. Is there a way to reliably pixelate an image with a specified percentage that will not modify the image dimensions?
Also, will ImageMagick ever gain a simple -pixelate option?