From: Pavel Charvat Date: Wed, 1 Nov 2006 13:52:57 +0000 (+0100) Subject: image-tool uses RGB automatically when converting non-RGB jpegs X-Git-Tag: holmes-import~507^2~30 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=926b7db85c2f2f34bf734ee1bcbfeea9a0d01808;p=libucw.git image-tool uses RGB automatically when converting non-RGB jpegs to gif/png --- diff --git a/images/image-tool.c b/images/image-tool.c index 758000ab..5063d9b6 100644 --- a/images/image-tool.c +++ b/images/image-tool.c @@ -216,6 +216,15 @@ main(int argc, char **argv) io.flags |= IMAGE_IO_USE_BACKGROUND; if (jpeg_quality) io.jpeg_quality = jpeg_quality; + uns output_fmt = output_format ? : image_file_name_to_format(output_file_name); + uns output_cs = io.flags & IMAGE_COLOR_SPACE; + if (output_fmt != IMAGE_FORMAT_JPEG && + output_cs != COLOR_SPACE_GRAYSCALE && + output_cs != COLOR_SPACE_RGB) + { + MSG("Forcing RGB color space"); + io.flags = (io.flags & ~IMAGE_COLOR_SPACE) | COLOR_SPACE_RGB; + } TRY(image_io_read_data(&io, 0)); bclose(io.fastbuf); MSG("Writing %s", output_file_name);