ImageMagick produces different results compared to GPUimage
Posted: 2015-10-06T09:04:21-07:00
I'm currently using GPUimage to change the color(RGB) channels of images to produce "filter like" effects. The values I use for GPUImage are the X,Y values of the points of the color curve tool in photoshop. So for example I might have these points:
Photoshop curve tool. Please note that the image here doesn't represent
the current data points that I am using
**I am using the im_fx_curves script found here to convert the points to the expression.**
So my process would normally look like this:
These are the coefficients made by im_fx_curves with the -c option.
However the results are slightly different. And I'm confused on why this is happening. I would gladly take any tips on what I might be doing wrong!
I've already using different options of colorspace but it mostly seem to make it worse.
This is the comparisation between the results where only GPUimage handles my curve points exactly like Photoshop:
Desired result:
Photoshop curve tool. Please note that the image here doesn't represent
the current data points that I am using
GPUImage handles these points without problems, however since Imagemagick doesn't support direct input of these values I have to convert each channel points to the curve's expression like this:Red:
0,0
0.1176,0.0196
0.2275,0.098
0.3294,0.3333
0.4392,0.549
0.7451,0.8627
1,1
Green:
0,0
0.0784,0.0196
0.1961,0.2431
0.5176,0.5882
0.7451,0.8039
1,1
Blue:
0,0.2549
0.1569,0.3529
0.3333,0.451
0.8314,0.7255
1,0.8039
Code: Select all
Red: -237.407*u^6 + 634.277*u^5 - 615.934*u^4 + 261.501*u^3 - 44.054*u^2 + 2.617*u
Green: -32.880*u^5 + 80.544*u^4 - 68.222*u^3 + 22.707*u^2 - 1.148*u
Blue: -0.382*u^4 + 0.744*u^3 - 0.498*u^2 + 0.686*u + 0.255
So my process would normally look like this:
Code: Select all
convert test_image.png \
\( -channel Red -fx "`perl im_fx_curves.pl 0,0 0.1176,0.0196 0.2275,0.098 0.3294,0.3333 0.4392,0.549 0.7451,0.8627 1,1`" \) \
\( -channel Green -fx "`perl im_fx_curves.pl 0,0 0.0784,0.0196 0.1961,0.2431 0.5176,0.5882 0.7451,0.8039 1,1`" \) \
\( -channel Blue -fx "`perl im_fx_curves.pl 0,0.2549 0.1569,0.3529 0.3333,0.451 0.8314,0.7255 1,0.8039`" \) result.png
Code: Select all
R: -237.407,634.277,-615.934,261.501,-44.054,2.617,0.000
G: -32.880,80.544,-68.222,22.707,-1.148,-0.000
B: 0.263,0.041,-0.155,-0.155,0.652,0.255
I've already using different options of colorspace but it mostly seem to make it worse.
This is the comparisation between the results where only GPUimage handles my curve points exactly like Photoshop:
Desired result: