Resizing a Gray TIFF file - conversion to linear colorspace required?
Posted: 2018-01-16T20:59:18-07:00
New IM user and first post.
IM 7.0.7-19 Q16 x64 on a Windows 10 64-bit machine
I'm building a Windows batch script to handle downsizing of high resolution B&W TIFF files (originally produced on my drum scanner). The source files are TIFF, 16-bit, in Gray Gamma 2.2 colorspace. Output files will have the same attributes: TIFF, 16-bit, in Gray Gamma 2.2 colorspace (no change from input).
Here's an example of how I am currently doing the resize:
magick -quiet "filename.tif" -filter Quadratic -distort Resize 10800 -set density 720x720 "filename_720.tif"
This downsizes to a new width of 10800 pixels (height calculated by IM) and sets a new resolution of 720ppi into the output image. This command works fine, producing a new TIFF file with the desired 16-bit depth and Gray Gamma 2.2 colorspace ( as verified with "magick identify").
In Photoshop, a comparison of the source and output files shows image tonal values appear to have been extremely well preserved (though I will need to add some small amount of sharpening). However, I'm wondering whether I should be converting to a linear colorspace before doing the resize, then convert back. For color images (multi-channel) it's clear this is recommended. But for grayscale TIFF files, is it also recommended to do the colorspace conversion? What am I giving up if I don't do the conversion?
Assuming I should do the conversion, which of these would be better:
magick -quiet "filename.tif" -filter Quadratic -gamma 0.454545 -distort Resize 10800 -gamma 2.2 . . .
or
magick -quiet "filename.tif" -filter Quadratic -colorspace LinearGray -distort Resize 10800 -colorspace Gray . . .
Thanks,
Dave
IM 7.0.7-19 Q16 x64 on a Windows 10 64-bit machine
I'm building a Windows batch script to handle downsizing of high resolution B&W TIFF files (originally produced on my drum scanner). The source files are TIFF, 16-bit, in Gray Gamma 2.2 colorspace. Output files will have the same attributes: TIFF, 16-bit, in Gray Gamma 2.2 colorspace (no change from input).
Here's an example of how I am currently doing the resize:
magick -quiet "filename.tif" -filter Quadratic -distort Resize 10800 -set density 720x720 "filename_720.tif"
This downsizes to a new width of 10800 pixels (height calculated by IM) and sets a new resolution of 720ppi into the output image. This command works fine, producing a new TIFF file with the desired 16-bit depth and Gray Gamma 2.2 colorspace ( as verified with "magick identify").
In Photoshop, a comparison of the source and output files shows image tonal values appear to have been extremely well preserved (though I will need to add some small amount of sharpening). However, I'm wondering whether I should be converting to a linear colorspace before doing the resize, then convert back. For color images (multi-channel) it's clear this is recommended. But for grayscale TIFF files, is it also recommended to do the colorspace conversion? What am I giving up if I don't do the conversion?
Assuming I should do the conversion, which of these would be better:
magick -quiet "filename.tif" -filter Quadratic -gamma 0.454545 -distort Resize 10800 -gamma 2.2 . . .
or
magick -quiet "filename.tif" -filter Quadratic -colorspace LinearGray -distort Resize 10800 -colorspace Gray . . .
Thanks,
Dave