Converting from/to BLOB

ImageMagickObject is a Windows COM+ interface to ImageMagick. COM+, Visual Basic, and Delphi users should post to this discussion group.
Post Reply
Xandros
Posts: 28
Joined: 2009-10-02T09:19:49-07:00
Authentication code: 8675309

Converting from/to BLOB

Post by Xandros »

Hello again

After long tinkering with the VBS ArrayTest example, I can't achieve what i'm trying to do ...

The thing is that in VBS all variables are quite loosely typed, which is not the case in let's say Delphi (which only importants standard windows com types).

I have a variable which contains an image (or pdf) as a simple byte array (read from DB). I know there are ImageFromBlob functions but those are not available via COM+.

I just want to use a simple convert/resize on that image data and save it to a file. (or even better to another byte array).

I tried various things in Delphi and no luck so far ... The code is roughly this

Code: Select all

var 
 cmd, src : Variant;
 Params : PSafeArray;
 Source : RawByteString; // image byte array in here

...
cmd := VarArrayCreate([0,5], varVariant);
src := VarArrayCreate([0,1], varVariant);

src[0] := 'JPG:';
src[0] := Source;

cmd[0] := src;
cmd[1] := '-resize';
cmd[2] := '200x200';
cmd[3] := 'PNG24:';
cmd[4] := DestPath; // destination file

Params := PSafeArray(TVarData(cmd).VArray);

Img.Convert(Params);

if I replace cmd[0] := src; by cmd[0] := 'logo:'; it works though ...


Any ideas how to achieve this simple thing please ?

Help very much appreciated :)
Post Reply