From 183be298bd727a548ae0cc0e028d5c5be7d225eb Mon Sep 17 00:00:00 2001 From: stan Date: Mon, 14 Apr 2003 13:06:03 +0000 Subject: [PATCH] Colourises greyscale images to allow faster MPEG encoding. git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@483 e3e1d417-86f3-4887-817a-d78f3d33393f --- src/zm_config.h.z | 1 + src/zm_image.cpp | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/src/zm_config.h.z b/src/zm_config.h.z index 9c246f27e..06218675f 100644 --- a/src/zm_config.h.z +++ b/src/zm_config.h.z @@ -41,6 +41,7 @@ #define ZM_STRICT_VIDEO_CONFIG // Whether to allow errors in setting video config to be fatal #define ZM_LOCAL_BGR_INVERT // Invert BGR colours to RGB +#define ZM_COLOUR_JPEG_FILES // Colourise greyscale JPEG files #define ZM_JPEG_FILE_QUALITY // Set the JPEG quality setting for the saved event files #define ZM_JPEG_IMAGE_QUALITY // Set the JPEG quality setting for the streamed 'live' images diff --git a/src/zm_image.cpp b/src/zm_image.cpp index fe64a6345..86e7e3e15 100644 --- a/src/zm_image.cpp +++ b/src/zm_image.cpp @@ -98,6 +98,14 @@ void Image::ReadJpeg( const char *filename ) void Image::WriteJpeg( const char *filename ) const { + if ( ZM_COLOUR_JPEG_FILES && colours == 1 ) + { + Image *temp_image = new Image( *this ); + temp_image->Colourise(); + temp_image->WriteJpeg( filename ); + return; + } + struct jpeg_compress_struct cinfo; struct jpeg_error_mgr jerr; cinfo.err = jpeg_std_error(&jerr); @@ -113,6 +121,7 @@ void Image::WriteJpeg( const char *filename ) const cinfo.image_width = width; /* image width and height, in pixels */ cinfo.image_height = height; + cinfo.input_components = colours; /* # of color components per pixel */ if ( colours == 1 ) {