Error getting tags :
error 404Error getting tags :
error 404 imageData | revDocs | RunRev
Welcome Guest (Log in)
Product Edition
Version
imageData
Basics
Expander triangle
Type
Property
Syntax

set the imageData of image to binaryData

Introduced
1.1
Environment
Desktop, Web and Server
Platform Support
MacOS,Mac OS X,Windows,Linux
Security
None required
Summary
Specifies the binary data that makes up the picture in an image object.
Examples

put the imageData of image ID 3577 into dateToAnalyze
set the imageData of the mouseControl to the personalImage of this card

Additional Comments
Expander triangle

Use the imageData property to process an image and display the processed version.

Value:

The imageData of an image consists of a sequence of binary values.

Comments:

The imageData consists of the picture data presented in a standard form. The form of the imageData property, unlike the content, does not depend on what format the image is recorded in; it's always in the same form, which specifies the color of each pixel in the image, four bytes per pixel.

Each pixel is represented by 32 bits (4 bytes) of image data, with pixels numbered from the top left corner of the image, left to right, then top to bottom. The first byte consists of zeroes, and the last three bytes encode the amount of red, green, and blue respectively.

Since each pixel is represented by 4 bytes (4 characters), you can obtain the numeric value of any of the color channels for a given pixel using the charToNum function. For example, the numeric value of the red channel for the tenth pixel is given by the expression charToNum(char ((4 * 9) + 2) of the imageData of image). The numeric value of the green channel is charToNum(char (4 * 9) + 3 of the imageData of image); and the numeric value of the blue channel is charToNum(char (4 * 9) + 4 of the imageData of image).

Important! When changing the imageData property, make sure the new data is the correct size: 4 bytes per pixel in the image. If you set an image's imageData property to data whose total length is incorrect, the image appearance will be distorted.

The imageData property is related to the content of the image--changing either one changes what's displayed in the image--but they're not identical: the imageData property and the image content are in different forms, have different sizes, and include overlapping but not identical information about the picture.

The imageData, unlike the contents of the image container, is based on the picture as it's presented on the screen, not stored in the image object. This means that if you resize an image, the content of the image does not change, but its imageData does. If you create an image and then reduce its size, its imageData reflects the scaled-down, displayed image, not the original full-scale image. If you create a second image and set its imageData property to the imageData of the original image, resizing the first image back to the original dimensions displays the original image at full resolution, but resizing the second image does not, because setting its imageData transferred only the scaled-down version of the original.

Tip: To copy the information in an image at full resolution, regardless of whether its height and width have been changed, use a statement like the following:

put image "Full Resolution" into image "Copied Image"

Important! Since the imageData of an image is binary data rather than text, trying to display the data in a field may cause unexpected behavior.

User Comments
Expander triangle
User thumbnail
Hans Behrens
StarStarStarStarStar
Apr 2, 2010
You cannot load format-specific (GIF, PNG, JPG, etc) binary images using 'set the imageData'. You should instead use the "put" command, as an extrapolation of the "Full resolution" tip above.
For example, let's say you have an image file "Forest.png" and you decide that you don't want to 'import from file'. You could instead do the following:


put URL "binfile:Forest.png" into tImageData
put tImageData into image "Image Viewer"

This has several ancillary benefits over imageData as well: 1) Failing to set the height and width of the target image before importation will not cause graphical corruption. 2) Formatted images are usually considerably more compact than the raw imageData.