Page 1 of 1

Does imageMagick support all of the Lightroom adjustments?

Posted: 2018-03-22T02:33:45-07:00
by sushburak
I wanted to know about that does imagemagick have a function/component for applying each of the Lightroom adjustments (seen in a .xmp file)?

Re: Does imageMagick support all of the Lightroom adjustments?

Posted: 2018-03-22T03:41:22-07:00
by Bonzo
Highly unlikely.

Re: Does imageMagick support all of the Lightroom adjustments?

Posted: 2018-03-22T03:55:17-07:00
by sushburak
sorry to heard that :/ So do you know any other options for manipulating all LR adjustments programmatically?

Re: Does imageMagick support all of the Lightroom adjustments?

Posted: 2018-03-22T03:59:38-07:00
by Bonzo
I would guess you could write some code that reads the xmp file and converts it to options that Imagemagick could understand but depending how many options you wanted to support it could be a mammoth task.
So do you know any other options for manipulating all LR adjustments programmatically?
The way I read this you just want to modify the Lightroom settings in the xmp file and not apply them to an image?

Re: Does imageMagick support all of the Lightroom adjustments?

Posted: 2018-03-22T04:11:46-07:00
by sushburak
Basically what we are trying to do is applying .xmp or .lrtemplate files to images on the cloud or make the same changes programmatically without running Photoshop or Lightroom on a server. Imagemagick seems to be best way to do that but you said Imagemagick does not support all of the adjustments on LR. Also all .xmp files contain different adjustments so the solution should cover all of them.

Re: Does imageMagick support all of the Lightroom adjustments?

Posted: 2018-03-22T04:57:48-07:00
by sushburak
The way I read this you just want to modify the Lightroom settings in the xmp file and not apply them to an image?
So the answer is apply them to an image

Re: Does imageMagick support all of the Lightroom adjustments?

Posted: 2018-03-22T05:25:37-07:00
by Bonzo
So the answer is apply them to an image
That's OK I just wanted to confirm.

I do not have a lightroom xmp file handy but as I say it can be done but you would need an intermediate program in something like php.

You would read the xmp file and if for instance it said "increase contrast" you would then need to save -contrast into a file.

You would then read this file in your Imagemagick command

But it would be a lot of work!

Re: Does imageMagick support all of the Lightroom adjustments?

Posted: 2018-03-22T05:51:14-07:00
by sushburak
we can develop a program like just you said reading xmp files and create options for imagemagick to understand but the problem is we don’t know all the adjustments in the xmp files can be mapped to imagemagick. For example; contrast is contrast thats easy because its named the same everywhere but there is some fields like black2012, so is this a general adjustment or photoshop specific. The question is how can we know all these adjustments can be mapped to imagemagick ?

Here is some of the adjustments;

ChromaticAberrationB = 0,
ChromaticAberrationR = 0,
ColorNoiseReductionDetail = 50,
ColorNoiseReductionSmoothness = 50,
Defringe = 0,
DefringeGreenAmount = 0,
DefringeGreenHueHi = 60,
Dehaze = 0,
EnableTransform = true,
Exposure2012 = 1.03,
LensProfileEnable = 1,
LensProfileSetup = "LensDefaults",
LuminanceAdjustmentAqua = 0,
LuminanceAdjustmentBlue = 0,
LuminanceAdjustmentOrange = 89,
RedHue = 0,
RedSaturation = 0,
Saturation = -37,
SharpenRadius = 1,
Sharpness = 25,
SplitToningShadowHue = 225,
SplitToningShadowSaturation = 9,
ToneCurvePV2012Red = {
0,
0,
255,
255,
},
VignetteMidpoint = 50,
WhiteBalance = "Custom",
Whites2012 = -19,
orientation = "AB"

Re: Does imageMagick support all of the Lightroom adjustments?

Posted: 2018-03-22T06:10:51-07:00
by Bonzo
The question is how can we know all these adjustments can be mapped to imagemagick ?
That is a good question and I would guess it is not going to be simple to answer.

I would start with what you can find as standard commands and then move onto searching the forum. I would guess some options would be quite complicated and may need masks and some you may not be able to replicate at all.

For instance on the forum fmw42 has suggested this for removing a haze: viewtopic.php?f=1&t=27856&p=123002&hilit=Dehaze#p123002
But how dose Dehaze=0 equate to -contrast-stretch 1x1%?

Re: Does imageMagick support all of the Lightroom adjustments?

Posted: 2018-03-22T20:18:09-07:00
by snibgo
IM contains most primitives that we need to do almost any conceivable image processing, by a suitable combination of those primitives. For some operations the "suitable combination" is a complex script, and sometimes this is more easily done by writing a process module, thus creating a new primitive.

As sushburak says, the real difficulty is "how can we know all these adjustments can be mapped to imagemagick?"

They probably can be mapped to ImageMagick, but only after we know what those adjustments do. For example, what does "LuminanceAdjustmentOrange = 89" do? A web search finds https://digital-photography-school.com/ ... e-hsl-tab/ , which suggests this adjusts the luminance (as in HSL) of the hue=orange parts of an image. Perhaps "89" is on a scale of 0-200 where "100" means no change.

Is Lightroom's HSL the same as IM's HSL? I'll assume so, though HCL is generally a better match for what our eyes see.

Many image effects (adjustments) break down into two parts:
1. Where is the effect applied? Perhaps it is applied 100% where the hue is exactly orange, ramping down to zero where the hue is red or yellow. Perhaps the ramp isn't linear. Perhaps it is applied 100% over a (narrow) range of hues. This gives a mask of where to apply the effect.

2. What is the effect? Perhaps it is a multiplication of the colour channels by 0.89. Or it multiplies the L of HSL by 0.89. Or perhaps it is something else.

Only when those questions are answered can an IM equivalent be written, and tested against the Lightroom adjustment. For example, making a few assumptions:

As a percentage of hue (Red=0=100), Orange is 8.33%. The transition from red to orange, and from orange to yellow, is also 8.33%.

Code: Select all

rem Multiply lightness by 0.89 where the hue is orange.

set SRC=toes.png

set centHue=8.33
set rangeHue=0
set transHue=8.33

%IMG7%magick ^
  %SRC% ^
  +write mpr:ORIG ^
  -colorspace HSL ^
  -separate ^
  ( -clone 0 ^
    -evaluate AddModulus %%[fx:50-%centHue%]%% ^
    -solarize 50%% ^
    -evaluate Multiply 2 ^
    -level %%[fx:100-%rangeHue%-2*%transHue%],%%[fx:100-%rangeHue%]%% ^
    +write mpr:MASK ^
+write m.png ^
  ) ^
  ( -clone 2 ^
    -evaluate Multiply 0.89 ^
  ) ^
  ( -clone 0,1,4 ^
    -combine ^
    -set colorspace HSL ^
    -colorspace sRGB ^
    +write mpr:ADJ_HSL ^
+write a.png ^
  ) ^
  -delete 0--1 ^
  mpr:ORIG ^
  mpr:ADJ_HSL ^
  mpr:MASK ^
  -compose Over -composite ^
  out.png
m.png and a.png are for debugging only.

Re: Does imageMagick support all of the Lightroom adjustments?

Posted: 2018-03-22T21:38:06-07:00
by fmw42
If the adjustments from Lightroom are spatially independent (no blurs or convolutions), then you can take a 3D HAld CLUT from Imagemagick, apply the processing, save with the name of the effect, then bring that back to Imagemagick and then apply the HALD image to any other image to recreate the exact same result as on Lightroom.

Re: Does imageMagick support all of the Lightroom adjustments?

Posted: 2018-03-26T13:56:43-07:00
by snibgo
It seems that darktable includes some "decoding" of Lightroom XML. See the source code in https://github.com/darktable-org/darkta ... ightroom.c , or https://www.darktable.org/ for the complete program.