4D v16.3

BLOB TO PICTURE

Home

 
4D v16.3
BLOB TO PICTURE

BLOB TO PICTURE 


 

BLOB TO PICTURE ( pictureBlob ; picture {; codec} ) 
Parameter Type   Description
pictureBlob  BLOB in BLOB containing a picture
picture  Picture in Picture from BLOB
codec  String in Picture codec ID

The BLOB TO PICTURE command inserts a picture stored in a BLOB into a 4D picture variable or field, regardless its original format.

This command is similar to the command READ PICTURE FILE, it just applies to a BLOB instead of a file. It allows you to display pictures stored in native format into BLOBs. You can load a picture into a BLOB using, for example, the command DOCUMENT TO BLOB or PICTURE TO BLOB.

A BLOB variable or field containing a picture is passed in the pictureBlob parameter. The picture can be in any format supported natively by 4D. You can obtain the list of available formats using the PICTURE CODEC LIST command. If you pass the optional codec parameter, 4D will use the value provided in this parameter to decode the BLOB (see the specific functioning of the command with this third parameter below).

Pass in the picture parameter the 4D picture field or variable which should display the picture.

Note: The internal picture format will be stored within the 4D variable or field.

Once the command has been executed, if the BLOB was correctly decoded, the picture parameter contains the picture to display.

The optional codec parameter lets you specify the codec to be used for decoding the BLOB.

If you pass a codec recognized by 4D in codec (returned by the PICTURE CODEC LIST command), it is applied to the BLOB and the picture is returned in the picture field or variable.

If you pass a codec that is not recognized by 4D in codec, a new codec is recorded dynamically with the ID passed in the parameter. 4D then returns a picture that encapsulates the BLOB and the OK variable is set to 1. In this case, to retrieve the BLOB, you will need to use the PICTURE TO BLOB command with the same custom ID. This particular mechanism can be used to meet two specific needs:

  • encapsulation of a BLOB (that is not a picture) into a picture,
  • loading a picture without using a codec.

The implementation of these mechanisms allows, more specifically, the creation of "BLOB arrays" via picture arrays. This technique must be used with caution because, since the arrays are loaded entirely into memory, working with large sized BLOBs can affect the functioning of the application.

Note: A BLOB created by the VARIABLE TO BLOB command is managed automatically; it is not necessary to pass a codec to encapsulate it since the BLOB is "signed." In this case, for the opposite operation, you will need to pass ".4DVarBlob" to the PICTURE TO BLOB command as the codec ID.

If the command has been executed correctly, the system variable OK is set to 1. If the conversion has failed (QuickTime is not installed, the BLOB does not contain a readable picture, the codec parameter recognized but BLOB not validated, etc.), OK is set to 0 and the 4D picture variable or field is returned empty.



See also 

_o_PICTURE TYPE LIST
PICTURE CODEC LIST
PICTURE TO BLOB
READ PICTURE FILE

 
PROPERTIES 

Product: 4D
Theme: Pictures
Number: 682

The OK variable is changed by the command

 
HISTORY 

Modified: 4D v11 SQL Release 2

 
ARTICLE USAGE

4D Language Reference ( 4D v16)
4D Language Reference ( 4D v16.1)
4D Language Reference ( 4D v16.2)
4D Language Reference ( 4D v16.3)