Converting to monochrome images from RGB save little size
Posted: 2018-10-18T03:08:04-07:00
So from some grey-scale images, which are basically monochrome with antialiasing, I used GIMP fuzzy select tool with a 0 threshold then made a mask out of that to make sure I'd end up with a monochrome image, for design purpose, not to save on the file size. I'm not the most active graphic designer so later I recalled about using the right mode to save on file size and since there would be no conversion I though why not?
I based it on conversion - Converting from color to true black and white in ImageMagick? - Super User [answered Mar 25 '15 at 6:03 DavidPostill] and came up with
It turns out little file size saving has been made from this. There's 12 images which were exported, from GIMP, into both PNG & GIF so the source directory contain 24 files. Here's a comparison from the top 2 biggest files, in TSV, sizes in bytes:
(the former isn't code, I just used that tag as there doesn't seem to be another preformatted text one)
Just to make sure I was comparing the same thing, for both of the files, I created a file with in 2 layers the monochrome & RGB version in GIMP and set the 1st layer to the mode Difference and the result is transparent & black, so no difference; to make doubly sure, I offsetted the bottom layer 1 px and white was added.
Since I work on Windows, I used Cygwin to have the work done. I updated pretty soon before and to make sure there haven't been an update since I ran the setup right before starting to write this and got
Update 1: Changing /${f# into ${f#.
I based it on conversion - Converting from color to true black and white in ImageMagick? - Super User [answered Mar 25 '15 at 6:03 DavidPostill] and came up with
(What's in square brackets is replaced with the appropriate content which is only letters, underscores & dashes, and the square brackets removed in the process.)$ for f in [SOURCE_DIRECTORY]/*; do convert "$f" -negate -threshold 0 -negate "[DESTINATION_DIRECTORY]${f#[SOURCE_DIRECTORY]}"; done
It turns out little file size saving has been made from this. There's 12 images which were exported, from GIMP, into both PNG & GIF so the source directory contain 24 files. Here's a comparison from the top 2 biggest files, in TSV, sizes in bytes:
Code: Select all
monochrome RGB
25,720 29,347
24,500 25,365
Just to make sure I was comparing the same thing, for both of the files, I created a file with in 2 layers the monochrome & RGB version in GIMP and set the 1st layer to the mode Difference and the result is transparent & black, so no difference; to make doubly sure, I offsetted the bottom layer 1 px and white was added.
Since I work on Windows, I used Cygwin to have the work done. I updated pretty soon before and to make sure there haven't been an update since I ran the setup right before starting to write this and got
, here's what it is:Nothing to Install/Update
Am I doing something wrong? Is what I attempted actually is supposed to non-negligibly save file size?$ convert --version
Version: ImageMagick 6.9.10-11 Q16 x86_64 2018-09-08 https://www.imagemagick.org
Copyright: © 1999-2018 ImageMagick Studio LLC
License: https://www.imagemagick.org/script/license.php
Features: Cipher DPC OpenMP
Delegates (built-in): autotrace bzlib cairo fftw fontconfig fpx freetype gslib jbig jng jp2 jpeg lcms lzma pangocairo png ps rsvg tiff webp x xml zlib
Update 1: Changing /${f# into ${f#.