How?: colorspace/gamma aware resize for Grayscale Images
Posted: 2012-04-02T03:58:17-07:00
I am playing with the large ring image http://www.imagemagick.org/Usage/resize ... g_orig.png again.... this time with version 6.7.6-3-Q16-windows http://www.imagemagick.org/download/bin ... indows.zip
[1] convert.exe rings_lg_orig.png -distort resize 150x150! 01.png
[2] convert.exe rings_lg_orig.png -depth 16 -distort resize 150x150! -depth 8 02.png
[3] convert.exe rings_lg_orig.png -depth 16 -colorspace RGB -distort resize 150x150! -colorspace sRGB -depth 8 03.png
[4] convert.exe rings_lg_orig.png rings_lg_orig.png rings_lg_orig.png -combine -depth 16 -colorspace RGB -distort resize 150x150! -colorspace sRGB -depth 8 04.png
[5] convert.exe rings_lg_orig.png -depth 16 -gamma 0.454545 -distort resize 150x150! -gamma 2.2 -depth 8 05.png
=> [1] and [2] are classical non-gamma-aware resize.
=> [3] is simply wrong. It seems "-colorspace RGB" is not for grayscale.
=> [4] tries to combine 3 images into one RGB image, but the output is too bright.
=> [5] gives the best output.
Nevertheless, if I convert rings_lg_orig.png to RGB 24bit file in XnView, saving it as, say, "rings_lg_orig_as_24bit.png".
[6] convert.exe rings_lg_orig_as_24bit.png -depth 16 -colorspace RGB -distort resize 150x150! -colorspace sRGB -depth 8 06.png
=> [6] gives the intended output too!
Can I achieve the same thing with the grayscale "rings_lg_orig.png" using "-colorspace"?
----------------------------
BTW, 06.png generated in [6] is saved as a grayscale 8bit PNG but not a RGB 24bit PNG. Actually, a trivial "convert.exe rings_lg_orig_as_24bit.png directsave.png" also gives a grayscale 8bit PNG. Is this behavior by-design?
[1] convert.exe rings_lg_orig.png -distort resize 150x150! 01.png
[2] convert.exe rings_lg_orig.png -depth 16 -distort resize 150x150! -depth 8 02.png
[3] convert.exe rings_lg_orig.png -depth 16 -colorspace RGB -distort resize 150x150! -colorspace sRGB -depth 8 03.png
[4] convert.exe rings_lg_orig.png rings_lg_orig.png rings_lg_orig.png -combine -depth 16 -colorspace RGB -distort resize 150x150! -colorspace sRGB -depth 8 04.png
[5] convert.exe rings_lg_orig.png -depth 16 -gamma 0.454545 -distort resize 150x150! -gamma 2.2 -depth 8 05.png
=> [1] and [2] are classical non-gamma-aware resize.
=> [3] is simply wrong. It seems "-colorspace RGB" is not for grayscale.
=> [4] tries to combine 3 images into one RGB image, but the output is too bright.
=> [5] gives the best output.
Nevertheless, if I convert rings_lg_orig.png to RGB 24bit file in XnView, saving it as, say, "rings_lg_orig_as_24bit.png".
[6] convert.exe rings_lg_orig_as_24bit.png -depth 16 -colorspace RGB -distort resize 150x150! -colorspace sRGB -depth 8 06.png
=> [6] gives the intended output too!
Can I achieve the same thing with the grayscale "rings_lg_orig.png" using "-colorspace"?
----------------------------
BTW, 06.png generated in [6] is saved as a grayscale 8bit PNG but not a RGB 24bit PNG. Actually, a trivial "convert.exe rings_lg_orig_as_24bit.png directsave.png" also gives a grayscale 8bit PNG. Is this behavior by-design?