DNG Delegate Fails When Statically Linking

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
vhmth
Posts: 13
Joined: 2014-02-06T15:49:55-07:00
Authentication code: 6789

DNG Delegate Fails When Statically Linking

Post by vhmth »

So my current setup is IM 6.8.9-5 compiled to a .a static archive file which is linked against Go -> C Bindings (https://github.com/gographics/imagick). I noticed that delegate.c contained the mapping for delegates, and I changed:

Code: Select all

"  <delegate decode=\"dng:decode\" command=\""/usr/bin/ufraw-batch" --silent --wb=camera --black-point=auto --exposure=auto --create-id=also --out-type=ppm16 "--output=%u.pnm" "%i"\"/>"
to

Code: Select all

"  <delegate decode=\"dng:decode\" command=\""ufraw-batch" --silent --wb=camera --black-point=auto --exposure=auto --create-id=also --out-type=ppm --out-depth=16 "--output=%u.ppm" "%i"\"/>"
per running into this bug: https://bugs.launchpad.net/ubuntu/+sour ... bug/371791

I also tried changing it to output PNG, based on the code I had read in coders/dng.c (it seems to try to read a .ppm file and then falls back to a png if it couldn't find one):

Code: Select all

"  <delegate decode=\"dng:decode\" command=\""ufraw-batch" --silent --wb=camera --black-point=auto --exposure=auto --create-id=also --out-type=png --out-depth=16 "--output=%u.png" "%i"\"/>"
The result of changing this line in delegate.c is that I no longer get an error saying IM couldn't find the pnm file. However, now I am able to read an image blob that represents a CR2 into a wand, but when I try to do MagickGetImageBlob, an array of length 0 is returned. Furthermore, what's weird is that the image itself is about 6.3MB, but it comes out to be about 32MB when it's read into the wand. Any ideas?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: DNG Delegate Fails When Statically Linking

Post by snibgo »

vhmth wrote:Furthermore, what's weird is that the image itself is about 6.3MB, but it comes out to be about 32MB when it's read into the wand.
I expect this is because the CR2 file is compressed, but the wand image in memory isn't.

Sorry, I can't help with your other questions.
snibgo's IM pages: im.snibgo.com
vhmth
Posts: 13
Joined: 2014-02-06T15:49:55-07:00
Authentication code: 6789

Re: DNG Delegate Fails When Statically Linking

Post by vhmth »

@snibgo Ah that makes sense. Any other magick gurus - bump? A bit of additional info: I wrote a script to watch the /tmp directory and copy any new items to my Desktop when I read the image into the wand, and it seems like the PNG is being created properly, so I'm at a lost as to what is going on.
vhmth
Posts: 13
Joined: 2014-02-06T15:49:55-07:00
Authentication code: 6789

Re: DNG Delegate Fails When Statically Linking

Post by vhmth »

Bump?
vhmth
Posts: 13
Joined: 2014-02-06T15:49:55-07:00
Authentication code: 6789

Re: DNG Delegate Fails When Statically Linking

Post by vhmth »

I'm still curious as to why this is happening, but I ended up writing a little bit of C that converted a RAW image to a TIFF with libraw (http://www.libraw.org/). I then convert from there using VIPS.
Post Reply