access read violation...

The MagickWand interface is a new high-level C API interface to ImageMagick core methods. We discourage the use of the core methods and encourage the use of this API instead. Post MagickWand questions, bug reports, and suggestions to this forum.
Post Reply
_dh

access read violation...

Post by _dh »

Hi All,

Soon to become plainly obvious, I'm quite new to MagickWand. I'm trying to pass output from DCRaw to MagickWand with python and can't get past a Windows error 'access violation reading 0x00000000'. Whether I pipe the output of dcraw directly into MagickReadImage() or first write the dcraw output to a file then open it with MRI() in the same thread. Only if I write the output to a file, exit the thread and start a new one to read the file do I have success. Yes, yes, that does tell me something.... but what?? ;)

I have have tried a number of methods to kill the dcraw output and move the data to some other holder but always have the same result. I think what I'm asking is what ways do people pass in-memory images to MagickWand?

Any advice is greatly appreciated.

_dh

The basics of what I have going on in python using ctypes:

Code: Select all

proc = subprocess.Popen("dcraw -c -4 -T image.dng", shell=True, stdout=subprocess.PIPE).communicate()[0]

magickWandLib = 'C:\\Program Files (x86)\\ImageMagick-6.5.3-Q16\\CORE_RL_wand_.dll'
Magick = cdll.LoadLibrary(magickWandLib)
Magick.MagickWandGenesis()
wand = Magick.NewMagickWand()
Magick.MagickReadImageFile(proc)
-> WindowsError: exception: access violation reading 0x2B2A3761
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: access read violation...

Post by magick »

You can read a DNG image directly with MagickReadImage().

The MagickReadImageFile() method signature requires a wand and a filename as the input parameter. See http://www.imagemagick.org/api/magick-i ... dImageFile.
_dh

Re: access read violation...

Post by _dh »

Thanks for the reply magick! As cool as reading a dng directly is, I need to use dcraw for the first stages of processing - white balance, interpolation, etc... At the same time as working out a MagickWand pipeline I'm also trying to master either libraw or one of the dcraw.dll's I've found. I'm going now to see if I can pass a MagickWand image instance to libraw but still need to find a way around the access violation as I currently can only get the function I need from dcraw via cmd.exe.

Thanks!
dh
_dh

Re: access read violation...

Post by _dh »

A bit of an addendum to my reply. I have looked into setting up a dcraw delegate but 2 things have kept me from thaking that route. First, it seems IM stores the delegate output as a file in /tmp and I would like to keep my entire process in memory. Second, My dcraw settings change for every image (mainly white balance) and I don't see a way to send these settings from IM to the delegate program.

Thanks again!
dh
Post Reply