ImageMagick 7 - composite inconsistent color in output/print (need help)

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
ganapathi
Posts: 4
Joined: 2018-12-10T22:03:49-07:00
Authentication code: 1152

ImageMagick 7 - composite inconsistent color in output/print (need help)

Post by ganapathi »

Hi

We are working on a script to composite photos on a template that will be used to issue tags to people.
The color consistency of output varies while doing composite using the same command for different images , even for areas that are masked.
It is lighter than original template for some images. ( This error consistently occurs for the same image)

Not able to find the root cause. Any help would be greatly appreciated.

Details:

Below are the commands used to composite the image.

convert template.jpg image1.jpg mask.jpg -gravity North -geometry 390x370-100+20 -composite template_image1.jpg
convert template.jpg image2.jpg mask.jpg -gravity North -geometry 390x370-100+20 -composite template_image2.jpg

We are printing using Epson LS360 printer with Epson Matte paper setting.
Version: ImageMagick 7.0.8-12 Q16 x86_64 2018-09-26


The input image , mask , output image and scan of printed paper can be found in below zip file.

https://drive.google.com/file/d/1bnaZy7 ... sp=sharing

Thanks !
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: ImageMagick 7 - composite inconsistent color in output/print (need help)

Post by snibgo »

image1.jpg, template.jpg and template_image1.jpg look very similar. The same is true of image2.

The problem is that scannedAfterPrinting.jpg is different to template_image1.jpg and template_image2.jpg.

So the round trip computer-printer-scanner-computer distorts the colours. I expect this is happening because:

1. Printers use CMYK channels, and their gamut is different to computer screens which have RGB channels. Some RGB colours may not be reproducible in CMYK. There is a transformation from RGB to CMYK.

2. To manage this colour change, we can use ICC profiles that describe the printer and scanner. This is not a simple topic.
snibgo's IM pages: im.snibgo.com
ganapathi
Posts: 4
Joined: 2018-12-10T22:03:49-07:00
Authentication code: 1152

Re: ImageMagick 7 - composite inconsistent color in output/print (need help)

Post by ganapathi »

Snibgo,

Thanks for the pointers.

The scan of the printed page is only to give an idea of the color difference. We are interested only in color being consistent in the printed version.

All other process ( web cam,computer,printer,template,mask) being same the only difference b/w the two composition operation is the two different photos image1 and image2.

I am wondering

1. Why the areas of the template covered by the mask get changed.

2. What is the difference between these two images that result in this color change.


image1.jpg JPEG 390x370 390x370+0+0 8-bit sRGB 24489B 0.000u 0:00.000
image2.jpg JPEG 390x370 390x370+0+0 8-bit sRGB 31814B 0.000u 0:00.000

Thanks
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: ImageMagick 7 - composite inconsistent color in output/print (need help)

Post by snibgo »

ganapathi wrote:I am wondering ... 1. Why the areas of the template covered by the mask get changed.
I can't see any changes.

For example, I manually compare image1.jpg, template.jpg and template_image1.jpg. The corresponding parts look the same. A pixel editor says the pixel values are either exactly the same, or very close. As they are JPG, which is a lossy format, we can't expect the values to always be identical.

JPG should never be used for image processing, unless there is a very good reason for it.
snibgo's IM pages: im.snibgo.com
ganapathi
Posts: 4
Joined: 2018-12-10T22:03:49-07:00
Authentication code: 1152

Re: ImageMagick 7 - composite inconsistent color in output/print (need help)

Post by ganapathi »

Thanks Snibgo

I was using tiff format to do the processing still got the same problem for same images then changed back to jpg.

Also the change in color occurs in template_image2.jpg ( in the scanned file, this image can be seen to have a lighter red band in the side compared with template_image1.jpg and template.jpg)

Thank You !
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: ImageMagick 7 - composite inconsistent color in output/print (need help)

Post by snibgo »

I agree the scan of the print is different to the original. I have explained why, and what you can do to minimise this: use a colour-managed workflow, with ICC profiles that are specific to the printer/ink/paper, and the scanner. You also need to have an ICC profile for your computer screen.
snibgo's IM pages: im.snibgo.com
ganapathi
Posts: 4
Joined: 2018-12-10T22:03:49-07:00
Authentication code: 1152

Re: ImageMagick 7 - composite inconsistent color in output/print (need help)

Post by ganapathi »

Thanks snibgo , I will try using icc profiles and will update here if it solve the problem.

Thanks !
Post Reply