Page 2 of 2
Re: Nikon D750 .nef raw conver
Posted: 2019-05-28T04:55:41-07:00
by snibgo
IM runs the delegate command, then tries to read the output from that. It expects the output from the delegate to be a file named the expansion of %o (which won't have an extension like ".tif"). So change "%u.tif" to "%o". Commands like "magick LUMINANCE:AGA_3443.NEF x.png" will then use that delegate, and work without complaint.
EDIT to add: "%u" is useful as an intermediate file when the delegate involves two or more commands, eg dcraw to write %u, then magick to read %u, process it and write %o. For example, the delegate line (for Windows)...
Code: Select all
<delegate decode="LUM2" stealth="True" command="cmd.exe /c (F:/pictures/dcrawag.exe -q 3 -o 0 -4 -r 1 1 1 1 -S 65535 -T -O "%u" "%i") & (magick TIFF:%u -colorspace Gray -resize 600x600 %o)"/>
... means the IM command ...
... creates a small grayscale version of the input raw file.
Re: Nikon D750 .nef raw conver
Posted: 2019-05-28T07:58:10-07:00
by whugemann
Although your suggestion works and solves my actual problem, I am not quite convinced: The result is pretty much the same as that of the batch file:
Code: Select all
C:\Programme\ImageMagick7\dcraw.exe -q 3 -o 0 -4 -r 1 1 1 1 -S 65535 -T -O "%~dp1temp.TIF" %1
magick "%~dp1temp.TIF" -distort barrel "0.0099 -0.0678 0.0014 1.0511" "%~dpn1.TIF"
del "%~dp1temp.TIF"
i.e. it hard-codes the conversion, whereas the intention of a delegate definition should be to define a way to turn the input file into something readable for ImageMagick – and leave me with the option to provide any command line options that come to my mind.
Or do I get something wrong?
Re: Nikon D750 .nef raw conver
Posted: 2019-05-28T08:59:52-07:00
by snibgo
whugemann wrote:... and leave me with the option to provide any command line options that come to my mind.
IM has no mechanism for taking arbitrary options from its command line and passing those to the delegate.
That's one reason why I don't use IM to call dcraw to read raw files. Instead, I use dcraw directly.
Re: Nikon D750 .nef raw conver
Posted: 2019-05-28T12:03:43-07:00
by whugemann
IM has no mechanism for taking arbitrary options from its command line and passing those to the delegate.
I don't want to pass parameters to the delegate; I would like to be to be free of choice in regard to the operations that
magick performs on the temporary file, for example scaling, a 3x3 median, embed a logo or apply a false colour palette.
Re: Nikon D750 .nef raw conver
Posted: 2019-05-28T12:12:17-07:00
by snibgo
Sorry, I don't understand your question.
IM calls the delegate and reads the result into memory. Then IM can do any command line options, such as "-flip -flop" and write the image to a file:
Code: Select all
magick LUM2:AGA_3443.NEF -flip -flop x.png
Re: Nikon D750 .nef raw conver
Posted: 2019-05-28T13:13:35-07:00
by whugemann
I think our misunderstanding arises from the point that your suggested delegate-command
Code: Select all
<delegate decode="LUM2" stealth="True" command="cmd.exe /c (F:/pictures/dcrawag.exe -q 3 -o 0 -4 -r 1 1 1 1 -S 65535 -T -O "%u" "%i") & (magick TIFF:%u -colorspace Gray -resize 600x600 %o)"/>
performs the entire job on its own. I now tried
Code: Select all
<delegate decode="LUM2" stealth="True" command="dcraw.exe -q 3 -r 1 1 1 1 -T -O "%o" "%i""/>
and found that working as you said. I see: Most entries in
delegates.xml use %o as the pivot (i.e. intermediate format), whereas the (superfluous) dng-delegate-entry is
Code: Select all
<delegate decode="dng:decode" stealth="True" command="dcraw.exe -6 -W -O "%u.ppm" "%i""/>
using %u.ppm as the pivot.
As I understand %o, it would mean that if you convert to a lossy format such as JPEG in the end, the intermediate file would also be JPEG, i.e. causing two lossy compressions (?).
Does
have any special meaning in comparison to just
?
Re: Nikon D750 .nef raw conver
Posted: 2019-05-28T14:03:26-07:00
by snibgo
whugemann wrote:I think our misunderstanding arises from the point that your suggested delegate-command ...
I invented an example to show the use of %u as in intermediate file in a delegate that used two commands. The commands I used were not important. You need only one command, so don't need to use %u. Sorry if I confused you.
whugemann wrote:As I understand %o, it would mean that if you convert to a lossy format such as JPEG in the end, the intermediate file would also be JPEG, i.e. causing two lossy compressions (?).
At the end of the IM command, you might write the image to JPEG or any other format. That has no effect on what happens within the delegate.
I don't know the difference (if any) between ...
... and ...
Re: Nikon D750 .nef raw conver
Posted: 2019-05-28T16:26:05-07:00
by fmw42
See
https://imagemagick.org/script/formats.php
It says:
DNG R Digital Negative Requires an explicit image format otherwise the image is interpreted as a TIFF image (e.g. dng:image.dng).