Page 1 of 1

Can I Use a Binary Stream as input for IM.convert?

Posted: 2008-09-17T07:55:45-07:00
by brainlord
I have a two-step conversion process for a proprietary bitmap format.

1st, I open this proprietary bitmap in VB as a binary stream, where I screw with that stream and turn it into an almost-readable Mac PICT file which I save to the HD.

Then I use IMObject.convert to further process that intermediate PICT and save its a cross-platform PNG. This all works.

But do I HAVE to *save* the PICT first?

I have the PICT data as Binary Stream IN MEMORY already, seems like a total waste of time to write that to the HD, then immediately read it off the HD (in IM) and then delete it. (These are actually three consecutive lines in the same sub.)

Is there any way to have IMObject read the stream from memory?

BTW: Thanks guys for making IM! its the fourth imaging DLL I've tried in the past week. And it was ONLY one that worked.

Re: Can I Use a Binary Stream as input for IM.convert?

Posted: 2008-09-17T09:18:07-07:00
by magick
The ImageMagick Windows source distribution has an ArrayTest.vbs source file that shows how to handle in-memory images (blobs). You might also look at the ImageMagick .Net wrapper, see http://www.imagemagick.org/script/api.php.

Re: Can I Use a Binary Stream as input for IM.convert?

Posted: 2008-09-18T14:41:05-07:00
by jcasique
Hi, do you get the solution.

I'm trying to convert image from memory stream usinsg ImageMagick and I got this error:

"convert: 400: Perform: Unsupported argument type"

I'm using VB.Net 2005 and ImageMagick 6.4.3 Q16

Thank you in advance

Re: Can I Use a Binary Stream as input for IM.convert?

Posted: 2008-09-24T07:44:35-07:00
by brainlord
the bad news:

1. ArrayTest.vbs is an example of THREE THINGS AT ONCE. and as such is not really an example of any ONE thing for a newbie . :(

2. I don't have a BLOB (a Binary Long OBject) I have an ADO stream containing binary data. I'm pretty sure you can convert a Binary Stream into a blob but I don't know how.

3. the ArrayTest example puts data into the array (not a stream) to identify the source format, but if I put any other data into my stream I screw up what is otherwise a readable PICT file.

the good news:
the null: parameter may be what i'm looking for if I can figure out the right syntax:

This DOESN'T work:
objMagImage.convert "null:", "PICT:", PICTByte, strPNGPath

where PICTByte is my data stream

I'm still writing a file, reading it and then throwing it away

Re: Can I Use a Binary Stream as input for IM.convert?

Posted: 2009-06-04T07:05:55-07:00
by MoBO
I agree, a good sample for VB.NET is missing.

Do anybody has been able to work with Binary Stream ??????
I'm able to work with "physical" images but need more to goes on.

Please HELP :?

Re: Can I Use a Binary Stream as input for IM.convert?

Posted: 2009-06-05T05:58:54-07:00
by MoBO
It's very strange to be unable to find real VB.NET or Express 2008 sample on the web about this feature.
To be honest, difficult to have anything related to ImageMagick & VB.

Is there anybody able to share a small part of a code or at least provide VB.NET sample ?

Once again... I'm begging :?

Re: Can I Use a Binary Stream as input for IM.convert?

Posted: 2009-06-08T01:53:32-07:00
by MoBO
Just a litte "up" :(

Re: Can I Use a Binary Stream as input for IM.convert?

Posted: 2010-11-26T19:18:26-07:00
by Werty
Bumping also.

We REALLY need a SIMPLE example on how to use blobs, and not just something that outputs a 1x1 pixel image :p