Need to find RGB differences of 2 images

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
holden
Posts: 79
Joined: 2013-02-07T08:22:57-07:00
Authentication code: 6789

Need to find RGB differences of 2 images

Post by holden »

I don't think that title makes sense, but this is best explained visually. I have 2 images, an original and one that I made in Gimp using HSL and multiply. The problem is that the program that I am outputting in only has RGB sliders. Can IM tell me the difference in RGB values between two images?
Original
http://www.pasteall.org/pic/show.php?id=62852

Target
http://www.pasteall.org/pic/show.php?id=62853

Since this is a layered gimp file I can change the original to something easier to read for IM if that helps.

Thanks
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Need to find RGB differences of 2 images

Post by fmw42 »

You can separate channels and use IM compare to get a metric of the differences for each channel, such as rms. From that you can probably compute a channel multiply factor. But the real difference may not be linear.

Or you can separate channels and use -compose difference to get a visual difference between the two images. But I suspect you really want the slider values and IM has no way to tell what those sliders actually do.

By the way, the images that download are jpg.

If you want some way to convert from one to the other, you can use the HALD clut technique. You create in IM a hald image. Then take that to the system that modified the image and process it with the same settings used to modify the original image. Save as png. Then bring that back to IM and use -hald-clut to map the original into the processed version.

see
http://www.imagemagick.org/Usage/color_mods/#hald-clut
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Need to find RGB differences of 2 images

Post by snibgo »

I'm not sure what you want. If you ...

Code: Select all

identify -verbose image.jpg
... you'll get loads of information, including the mean values for each of the Red, Green and Blue channels.
However, a simple transformation in HSL may not be a simple transformation in RGB. Did you modify all three of Hue, Saturaion and Lightness? Or just two?

I have a script somewhere that can calculate a HSL transformation from one colour to another, but I'm not sure if that will help.
snibgo's IM pages: im.snibgo.com
holden
Posts: 79
Joined: 2013-02-07T08:22:57-07:00
Authentication code: 6789

Re: Need to find RGB differences of 2 images

Post by holden »

What I did was to create a layer in Gimp above the original, tweaked the HSL of it, set it to multiply, and reduced the transparency. I've tried just manually tweaking rgb for quite some time, but I'm starting to think it isn't possible without the multiply effect. I will check the identify output when I get back to it and see if that will point me in the right direction.
By the way, the images that download are jpg.
I just meant that I could make a simpler test pattern, as opposed to the sprite graphics, if it would make any IM functions more accurate.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Need to find RGB differences of 2 images

Post by fmw42 »

Are you asking for the IM equivalent to making a new layer, adjusting the HSL values and using -compose multiply? Or are you just trying to get the same HSL values? The latter would be very difficult if not impossible, in my estimation with such limited information.
holden
Posts: 79
Joined: 2013-02-07T08:22:57-07:00
Authentication code: 6789

Re: Need to find RGB differences of 2 images

Post by holden »

Basically I'm trying to achieve the same color shift using only RGB adjustments, but I don't think it will happen, there simply is not enough control.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Need to find RGB differences of 2 images

Post by snibgo »

With Gimp you have converted to HSL, made some adjustments, and converted back to RGB. (I'll ignore the multiply.)

No simple adjustment in RGB can be made equivalent to this. You may be able to find an RGB adjustment that gives a similar result, but you need to know exactly what the sliders do. The obvious technique is to play with the sliders on the input file until the result looks like the output created by Gimp.
snibgo's IM pages: im.snibgo.com
Post Reply