Page 1 of 1

Resize without shadows ?

Posted: 2017-07-07T05:48:30-07:00
by Aleksey
I have a big set of small png pictures that contain only white and black pixels

I use this command to resize them:

find . -name '*.png' -execdir mogrify -resize 28x28 -background white -gravity center -extent 28x28 {} \;

It processes them by 4000 files per minute. But _it makes some pixels grey_, not black and not white.
I need only black and white, so tried to use another command:

find . -name '*.png' -execdir mogrify -resize 28x28 -background white -gravity center -extent 28x28 -colors 2 -depth 8 -alpha off {} \;

This command processes them 300 files per minute and this is too slow for me.

What should I do? Is it possible to resize without making shadows ?

Re: Resize without shadows ?

Posted: 2017-07-07T06:19:07-07:00
by snibgo
These aren't shadows, but antialiasing, caused by IM taking some weighted average of black and white. A cure is to use a "-filter" setting. I forget which; perhaps point or box. (This will also be faster.)

See http://www.imagemagick.org/script/comma ... php#filter

Re: Resize without shadows ?

Posted: 2017-07-07T09:14:15-07:00
by fmw42
-filter point is what I think snibgo is suggesting