Resize without shadows ?

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
Aleksey
Posts: 1
Joined: 2017-07-07T05:41:02-07:00
Authentication code: 1151

Resize without shadows ?

Post 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 ?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Resize without shadows ?

Post 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
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Resize without shadows ?

Post by fmw42 »

-filter point is what I think snibgo is suggesting
Post Reply