blob - Read or write formatted images in memory

- NAME
- SYNOPSIS
- FUNCTION DESCRIPTIONS

- AttachBlob
- BlobIsSeekable
- BlobToFile
- BlobToImage
- CloneBlobInfo
- DestroyBlob
- DestroyBlobInfo
- DetachBlob
- FileToBlob
- GetBlobClosable
- GetBlobFileHandle
- GetBlobInfo
- GetBlobStatus
- GetBlobStreamData
- GetBlobStreamHandler
- GetBlobStreamType
- GetBlobTemporary
- GetConfigureBlob
- ImageToBlob
- ImageToFile
- PingBlob
- ReferenceBlob
- SetBlobClosable
- SetBlobTemporary

# NAME

blob - Read or write formatted images in memory (BLOBs)

# SYNOPSIS

void AttachBlob( BlobInfo *blob_info, const void *blob, const size_t length );

unsigned int BlobIsSeekable( const Image *image );

unsigned int BlobToFile( const char *filename, const void *blob, const size_t length, ExceptionInfo *exception );

Image * BlobToImage( const ImageInfo *image_info, const void *blob, const size_t length, ExceptionInfo *exception );

BlobInfo * CloneBlobInfo( const BlobInfo *blob_info );

void DestroyBlob( Image *image );

void DestroyBlobInfo( BlobInfo *blob );

void DetachBlob( BlobInfo *blob_info );

void * FileToBlob( const char *filename, size_t *length, ExceptionInfo *exception );

unsigned int GetBlobClosable( const Image *image );

FILE * GetBlobFileHandle( const Image *image );

void GetBlobInfo( BlobInfo *blob_info );

int GetBlobStatus( const Image *image );

unsigned char * GetBlobStreamData( const Image *image );

const StreamHandler GetBlobStreamHandler( const Image *image );

StreamType GetBlobStreamType( const Image *image );

unsigned int GetBlobTemporary( const Image *image );

void * GetConfigureBlob( const char *filename, ExceptionInfo *exception );

void * ImageToBlob( const ImageInfo *image_info, Image *image, size_t *length, ExceptionInfo *exception );

unsigned int ImageToFile( Image *image, const char *filename, ExceptionInfo *exception );

Image * PingBlob( const ImageInfo *image_info, const void *blob, const size_t length, ExceptionInfo *exception );

BlobInfo ReferenceBlob( BlobInfo *blob_info );

void SetBlobClosable( Image *image, unsigned int closeable );

void SetBlobTemporary( Image *image, unsigned int isTemporary );

# FUNCTION DESCRIPTIONS

## AttachBlob

> AttachBlob() attaches a blob to the BlobInfo structure.

The format of the AttachBlob method is:

> void AttachBlob ( BlobInfo *blob_info, const void *blob, const size_t length );

A description of each parameter follows:

blob_info:
  Specifies a pointer to a BlobInfo structure.

blob:
  The address of a character stream in one of the image formats understood by GraphicsMagick.

length:
  This size_t integer reflects the length in bytes of the blob.

## BlobIsSeekable

> BlobIsSeekable() returns True if the blob supports seeks ( SeekBlob ( ) is functional ) .

The format of the BlobIsSeekable method is:

> unsigned int BlobIsSeekable ( const Image *image );

A description of each parameter follows:

image:
  Image to query

## BlobToFile

> BlobToFile() writes a blob to a file. It returns False if an error occurs otherwise True.

The format of the BlobToFile method is:

> unsigned int BlobToFile ( const char *filename, const void *blob, const size_t length, ExceptionInfo *exception );

A description of each parameter follows:

status:
  BlobToFile returns True on success; otherwise, it returns False if an error occurs.

filename:
  Write the blob to this file.

blob:
  The address of a blob.

length:
  This length in bytes of the blob.

exception:
  Return any errors or warnings in this structure.

## BlobToImage

> BlobToImage() implements direct to memory image formats. It returns the blob as an image.

The format of the BlobToImage method is:

> Image *BlobToImage ( const ImageInfo *image_info, const void *blob, const size_t length, ExceptionInfo *exception );

A description of each parameter follows:

image_info:
  The image info.

blob:
  The address of a character stream in one of the image formats understood by GraphicsMagick.

length:
  This size_t integer reflects the length in bytes of the blob.

exception:
  Return any errors or warnings in this structure.

## CloneBlobInfo

> CloneBlobInfo() makes a duplicate of the given blob info structure, or if blob info is NULL, a new one.

The format of the CloneBlobInfo method is:

> BlobInfo *CloneBlobInfo ( const BlobInfo *blob_info );

A description of each parameter follows:

clone_info:
  Method CloneBlobInfo returns a duplicate of the given blob info, or if blob info is NULL a new one.

quantize_info:
  a structure of type info.

## DestroyBlob

> DestroyBlob() deallocates memory associated with a blob.

The format of the DestroyBlob method is:

> void DestroyBlob ( Image *image );

A description of each parameter follows:

image:
  The image.

## DestroyBlobInfo

> DestroyBlobInfo() deallocates memory associated with an BlobInfo structure. Use of DestroyBlob is preferred over this function.

The format of the DestroyBlobInfo method is:

> void DestroyBlobInfo ( BlobInfo *blob );

A description of each parameter follows:

blob:
  Specifies a pointer to a BlobInfo structure.

## DetachBlob

> DetachBlob() detaches a blob from the BlobInfo structure.

The format of the DetachBlob method is:

> void DetachBlob ( BlobInfo *blob_info );

A description of each parameter follows:

blob_info:
  Specifies a pointer to a BlobInfo structure.

## FileToBlob

> FileToBlob() returns the contents of a file as a blob. It returns the file as a blob and its length. If an error occurs, NULL is returned.

The format of the FileToBlob method is:

> void *FileToBlob ( const char *filename, size_t *length, ExceptionInfo *exception );

A description of each parameter follows:

blob:
  `FileToBlob()` returns the contents of a file as a blob. If an error occurs NULL is returned.

filename:
  The filename.

length:
  This pointer to a size_t integer sets the initial length of the blob. On return, it reflects the actual length of the blob.

exception:
  Return any errors or warnings in this structure.

## GetBlobClosable

> GetBlobClosable() returns True if the blob may be closed, or False if it is exempt from being closed.

The format of the GetBlobClosable method is:

> unsigned int GetBlobClosable ( const Image *image );

A description of each parameter follows:

image:
  Image to query

## GetBlobFileHandle

> GetBlobFileHandle() returns the stdio file handle associated with the image blob. If there is no associated file handle, then a null pointer is returned.

The format of the GetBlobFileHandle method is:

> FILE *GetBlobFileHandle ( const Image *image );

A description of each parameter follows:

image:
  Image to query

## GetBlobInfo

> GetBlobInfo() initializes the BlobInfo structure.

The format of the GetBlobInfo method is:

> void GetBlobInfo ( BlobInfo *blob_info );

A description of each parameter follows:

blob_info:
  Specifies a pointer to a BlobInfo structure.

## GetBlobStatus

> GetBlobStatus() returns the blob error status.

The format of the GetBlobStatus method is:

> int GetBlobStatus ( const Image *image );

A description of each parameter follows:

image:
  The image.

## GetBlobStreamData

> GetBlobStreamData() returns the stream data for the image. The data is only available if the data is stored on the heap, or is memory mapped. otherwise a NULL value is returned.

The format of the GetBlobStreamData method is:

> unsigned char *GetBlobStreamData ( const Image *image );

A description of each parameter follows:

image:
  The image.

## GetBlobStreamHandler

> GetBlobStreamHandler() returns the stream handler associated with the image.

The format of the GetBlobStreamHandler method is:

> const StreamHandler GetBlobStreamHandler ( const Image *image );

A description of each parameter follows:

image:
  The image.

## GetBlobStreamType

> GetBlobStreamType() returns the stream type for the image.

The format of the GetBlobStreamType method is:

> StreamType GetBlobStreamType ( const Image *image );

A description of each parameter follows:

image:
  The image.

## GetBlobTemporary

> GetBlobTemporary() returns True if the file associated with the blob is a temporary file and should be removed when the associated image is destroyed.

The format of the GetBlobTemporary method is:

> unsigned int GetBlobTemporary ( const Image *image );

A description of each parameter follows:

image:
  Image to query

## GetConfigureBlob

> GetConfigureBlob() returns the specified configure file as a blob.

The format of the GetConfigureBlob method is:

> void *GetConfigureBlob ( const char *filename, ExceptionInfo *exception );

A description of each parameter follows:

filename:
  The configure file name.

path:
  return the full path information of the configure file.

length:
  This pointer to a size_t integer sets the initial length of the blob. On return, it reflects the actual length of the blob.

exception:
  Return any errors or warnings in this structure.

## ImageToBlob

> ImageToBlob() implements direct to memory image formats. It returns the image as a blob and its length. The magick member of the Image structure determines the format of the returned blob ( GIG, JPEG, PNG, etc. )

The format of the ImageToBlob method is:

> void *ImageToBlob ( const ImageInfo *image_info, Image *image, size_t *length, ExceptionInfo *exception );

A description of each parameter follows:

image_info:
  The image info..

image:
  The image.

length:
  This pointer to a size_t integer sets the initial length of the blob. On return, it reflects the actual length of the blob.

exception:
  Return any errors or warnings in this structure.

## ImageToFile

> ImageToFile() copies the input image from an open blob stream to a file. It returns False if an error occurs otherwise True. This function is used to handle coders which are unable to stream the data in using Blob I/O. Instead of streaming the data in, the data is streammed to a temporary file, and the coder accesses the temorary file directly.

The format of the ImageToFile method is:

> unsigned int ImageToFile ( Image *image, const char *filename, ExceptionInfo *exception );

A description of each parameter follows:

status:
  ImageToFile returns True on success; otherwise, it returns False if an error occurs.

image:
  The image.

filename:
  Write the image to this file.

exception:
  Return any errors or warnings in this structure.

## PingBlob

> PingBlob() returns all the attributes of an image or image sequence except for the pixels. It is much faster and consumes far less memory than BlobToImage ( ) . On failure, a NULL image is returned and exception describes the reason for the failure.

The format of the PingBlob method is:

> Image *PingBlob ( const ImageInfo *image_info, const void *blob, const size_t length, ExceptionInfo *exception );

A description of each parameter follows:

image_info:
  The image info.

blob:
  The address of a character stream in one of the image formats understood by GraphicsMagick.

length:
  This size_t integer reflects the length in bytes of the blob.

exception:
  Return any errors or warnings in this structure.

## ReferenceBlob

> ReferenceBlob() increments the reference count associated with the pixel blob returning a pointer to the blob.

The format of the ReferenceBlob method is:

> BlobInfo ReferenceBlob ( BlobInfo *blob_info );

A description of each parameter follows:

blob_info:
  The blob_info.

## SetBlobClosable

> SetBlobClosable() enables closing the blob if True is passed, and exempts the blob from being closed if False is passed. Blobs are closable by default ( default True ) .

The format of the SetBlobClosable method is:

> void SetBlobClosable ( Image *image, unsigned int closeable );

A description of each parameter follows:

image:
  Image to update

closeable:
  Set to FALSE in order to disable closing the blob.

## SetBlobTemporary

> SetBlobTemporary() sets a boolean flag ( default False ) to specify if the file associated with the blob is a temporary file and should be removed when the associated image is destroyed.

The format of the SetBlobTemporary method is:

> void SetBlobTemporary ( Image *image, unsigned int isTemporary );

A description of each parameter follows:

image:
  Image to update

isTemporary:
  Set to True to indicate that the file associated with the blob is temporary.