Page 1 of 1

*Windows cmd* - Batch Process B&W thumbnails

Posted: 2015-06-22T04:05:54-07:00
by Masa
Hey!

I have something like 9000 small (64pxx64px) thumbnails that I need to convert into Black and White.
I tried Irfanview, but it lost some of the information during batch process.
The problem occurs with images that has transparent backgrounds, counter colors Green Lines and Cyan text.

Then I started browsing and found out that ImageMagick could do the job more efficiently and without losing the details.

Anyhow. I don't seem to find a proper command to do the job.

What I've done so far is:
- Open cmd
- Enter the folder where the images are
- type: Mogrify -type Grayscale *.png
- This seems to save all the colors, but the problem is that I'm losing the background transparency AND the images are in grayscale, not straight B&W.

So, could someone with better knowledge, tell me what should I write in the cmd to do the trick:
- All images in B&W
- Transparent Backgrounds as it is before the conversion

Thank you in advance!

-Masa-

Re: *Windows cmd* - Batch Process B&W thumbnails

Posted: 2015-06-22T04:48:58-07:00
by snibgo
One of the easiest way to convert greyscale into black and white is with "-threshold", eg:

Code: Select all

mogrify -format tiff -colorspace Gray -threshold 50% xx.png
This shouldn't remove transparency.

Re: *Windows cmd* - Batch Process B&W thumbnails

Posted: 2015-06-22T05:01:27-07:00
by Masa
Thanks.
I think I finally understood at least a bit what I should do there.
I tried this command and it seemed to work as intended aka B&W the images and leave transparent bg's alone:

Code: Select all

mogrify -threshold 90%  *.PNG
Is there a way to write that command so that it only transforms 32x32 and 64x64 images, but leaves all the other png's alone?
Since I noticed that there's also some larger images in the same folder that I don't want to transform into B & W.

Re: *Windows cmd* - Batch Process B&W thumbnails

Posted: 2015-06-22T05:09:24-07:00
by snibgo
Is there a way to write that command so that it only transforms 32x32 and 64x64 images, but leaves all the other png's alone?
No. The easiest way would be to move or copy the 32x32 and 64x64 images to another directory, and process all the files in that directory. Move or copy by hand or a script.

Re: *Windows cmd* - Batch Process B&W thumbnails

Posted: 2015-06-22T05:18:58-07:00
by Masa
snibgo wrote:
Is there a way to write that command so that it only transforms 32x32 and 64x64 images, but leaves all the other png's alone?
No. The easiest way would be to move or copy the 32x32 and 64x64 images to another directory, and process all the files in that directory. Move or copy by hand or a script.
Ok. That's what I thought and started already going trough the images one by one.. Tedious work I tell you! :D

One more thing.
Is there any clear instructions how to use the program since it seems to have very high potential?
...if I just learn to use it correctly! :D

If I understood correctly, you can run a lot more difficult scripts with this too, but not from cmd.. or?

Re: *Windows cmd* - Batch Process B&W thumbnails

Posted: 2015-06-22T06:50:07-07:00
by snibgo
For "how to use" guides, see:
http://www.imagemagick.org/Usage/
http://www.imagemagick.org/Usage/basics/

That documentation is now quite old, and doesn't always include new features. The examples are mostly for bash.

For examples with Windows BAT, see my pages.

Like any program, IM can be run by typing at the command prompt, or by running a script.

Re: *Windows cmd* - Batch Process B&W thumbnails

Posted: 2015-06-22T09:05:09-07:00
by fmw42

Re: *Windows cmd* - Batch Process B&W thumbnails

Posted: 2015-06-22T10:06:21-07:00
by Masa
Thank you very much!

Re: *Windows cmd* - Batch Process B&W thumbnails

Posted: 2015-06-22T10:09:55-07:00
by fmw42