Loading images from a non-URL source

Jeanne A. E. DeVoto revolution at jaedworks.com
Tue Jul 20 18:00:14 EDT 2004


At 10:51 PM +0200 7/20/2004, Klaus Major wrote:
>Hi Frank,
>
>>How can I take binary image data stored in a variable (obtained 
>>programmatically,
>>usually from a database query) and display it in an image field 
>>without first storing
>>it to a file?  I can't seem to find any information on this.
>>
>>I tried this, but it doesn't seem to work:
>>
>>set the fileName of image "Logo" to empty
>>set the imageData of image "Logo" to an_obtained_value
>
>when using "the imagedata" you have to make sure that the "target" 
>image has EXACTLY
>the same dimensions as the "source" image, or you might expereince 
>ugly results...
>
>But you can:
>
>...
>put a_var_with_binary_data into img 1
>...
>
>and it will resize to the correct dimensions :-)

It's also important to know that imageData and the content of an 
image (its text property) aren't in the same format.

The imageData is an invariant format that provides the RGB data for 
each pixel. The text of the image is the image's data in whatever 
format - PNG, GIF, JPEG, or whatever format the image is encoded in.

Normally, if you get the data from some other source, it will be in 
PNG, GIF, etc., so you'll use a statement like
   put myImageData into image "My Image"
Only if you're modifying the image data yourself do you use the 
imageData, usually.
-- 
jeanne a. e. devoto ~ revolution at jaedworks.com
http://www.jaedworks.com


More information about the use-livecode mailing list