Bytearray to Image control? 
Author Message
 Bytearray to Image control?

I have saved some pictures (jpg) in a database as bytearrays. Now I get them
into an Image control by first getting the bytearray from database, then
persisting it to a temporary file and finally loading the file into the
Image control. This seems inefficient, so I have tried to get the bytearray
to the Clipboard. However, I get either Type mismatch or Object variable not
set -error when I try to do this. How do I convert a bytearray into an image
that Clipboard will understand? Or even better: How do I get the bytearray
directly into the Image control?

Many thanks,

Janne



Sun, 18 Dec 2005 13:15:57 GMT  
 Bytearray to Image control?

Quote:
> I have saved some pictures (jpg) in a database as bytearrays. Now I get
them
> into an Image control by first getting the bytearray from database, then
> persisting it to a temporary file and finally loading the file into the
> Image control. This seems inefficient, so I have tried to get the
bytearray
> to the Clipboard. However, I get either Type mismatch or Object variable
not
> set -error when I try to do this. How do I convert a bytearray into an
image
> that Clipboard will understand? Or even better: How do I get the bytearray
> directly into the Image control?

If you're storing the image data as simply the file's bytes then you can use
OLE to display it for you.  For an example of this, have a look at
the"graphicload.zip" demo over on:
http://www.mvps.org/btmtz/_misc/index.htm
If on the other hand you're storing the image data as just the DIB bytes
then you can use SetDIBitsToDevice() to display the image, there's an
example here:
http://groups.google.co.uk/groups?selm=%23k%24rgYcODHA.2316%40TK2MSFT...
Hope this helps,

    Mike

 - Microsoft Visual Basic MVP -

WWW: Http://www.mvps.org/EDais/



Sun, 18 Dec 2005 17:11:05 GMT  
 Bytearray to Image control?
Thank you, Mike, this works fine!

Janne



Quote:
> > I have saved some pictures (jpg) in a database as bytearrays. Now I get
> them
> > into an Image control by first getting the bytearray from database, then
> > persisting it to a temporary file and finally loading the file into the
> > Image control. This seems inefficient, so I have tried to get the
> bytearray
> > to the Clipboard. However, I get either Type mismatch or Object variable
> not
> > set -error when I try to do this. How do I convert a bytearray into an
> image
> > that Clipboard will understand? Or even better: How do I get the
bytearray
> > directly into the Image control?

> If you're storing the image data as simply the file's bytes then you can
use
> OLE to display it for you.  For an example of this, have a look at
> the"graphicload.zip" demo over on:
> http://www.mvps.org/btmtz/_misc/index.htm
> If on the other hand you're storing the image data as just the DIB bytes
> then you can use SetDIBitsToDevice() to display the image, there's an
> example here:

http://groups.google.co.uk/groups?selm=%23k%24rgYcODHA.2316%40TK2MSFT...

- Show quoted text -

Quote:
> Hope this helps,

>     Mike

>  - Microsoft Visual Basic MVP -

> WWW: Http://www.mvps.org/EDais/



Sun, 18 Dec 2005 17:33:52 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. ? Displaying image from ByteArray?

2. Image Control Supplied By Image List Control

3. Assigning an image to an image control

4. Fill in Image controls from SQL image fields

5. Image Controls - Image Basic

6. Loading Images from Access into Image Control

7. load a Jpeg image into a picturebox or image control

8. binding a datafield of type image to an image control

9. Putting Image binary data into an image control

10. resizing an image with an image control

11. Image Control for image map?

12. Large images in Picture or Image Control

 

 
Powered by phpBB® Forum Software