Page 1 of 1

Convert RGB Tif (black & white pixels only)

Posted: 2019-02-28T05:36:04-07:00
by tresorjoe
Hi,

I created a 2 pixel file in RGB, 8bit, TIFF format, sRGB ICC profile embedded, with one pixel being RGB 0,0,0 and the other one RGB 255,255,255. If I use following command the resulting output TIF file is converted to Grayscale:

Code: Select all

convert RGB-black-and-white-pixel.tif RGB-black-and-white-pixel_out.tif
Any chance I can force that RGB is preserved for the output? Tried -colorspace RGB or -colorspace sRGB but always the output results in Grayscale.
PS: If using png as the output format the output is 1bit bitmap.

Thanks,
Joe

Re: Convert RGB Tif (black & white pixels only)

Posted: 2019-02-28T05:41:14-07:00
by snibgo
Try "-type TrueColor", eg:

Code: Select all

f:\web\im>%IM%convert xc:Black xc:White -type TrueColor x.tiff

f:\web\im>exiftool x.tiff
ExifTool Version Number         : 10.97
File Name                       : x.tiff
:
:
Image Width                     : 1
Image Height                    : 1
Bits Per Sample                 : 16 16 16

Re: Convert RGB Tif (black & white pixels only)

Posted: 2019-02-28T23:49:58-07:00
by tresorjoe
Great, worked fine. Thanks. Even preserved the embedded ICC profile.