Page 1 of 1

access read violation...

Posted: 2009-08-04T19:24:18-07:00
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

Re: access read violation...

Posted: 2009-08-04T20:32:59-07:00
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.

Re: access read violation...

Posted: 2009-08-05T12:50:22-07:00
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

Re: access read violation...

Posted: 2009-08-05T13:06:10-07:00
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