# Blob

## 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 ImageMagick.
length
  This size_t integer reflects the length in bytes of the blob.
exception
  return any errors or warnings in this structure.

## CustomStreamToImage

CustomStreamToImage() is the equivalent of ReadImage(), but reads the formatted "file" from the supplied method rather than to an actual file.

The format of the CustomStreamToImage method is:

    Image *CustomStreamToImage(const ImageInfo *image_info,
       ExceptionInfo *exception)

A description of each parameter follows:

image_info
  the image info.
exception
  return any errors or warnings in this structure.

## FileToBlob

FileToBlob() returns the contents of a file as a buffer terminated with the '\0' character. The length of the buffer (not including the extra terminating '\0' character) is returned via the 'length' parameter. Free the buffer with RelinquishMagickMemory().

The format of the FileToBlob method is:

    void *FileToBlob(const char *filename,const size_t extent,
      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.
extent
  The maximum length of the blob.
length
  On return, this reflects the actual length of the blob.
exception
  return any errors or warnings in this structure.

## FileToImage

FileToImage() write the contents of a file to an image.

The format of the FileToImage method is:

    MagickBooleanType FileToImage(Image *,const char *filename)

A description of each parameter follows:

image
  the image.
filename
  the filename.

## GetBlobProperties

GetBlobProperties() returns information about an image blob.

The format of the GetBlobProperties method is:

    const struct stat *GetBlobProperties(const Image *image)

A description of each parameter follows:

image
  the image.

## ImageToBlob

ImageToBlob() implements direct to memory image formats. It returns the image as a formatted blob and its length. The magick member of the Image structure determines the format of the returned blob (GIF, JPEG, PNG, etc.). This method is the equivalent of WriteImage(), but writes the formatted "file" to a memory buffer rather than to an actual file.

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
  return the actual length of the blob.
exception
  return any errors or warnings in this structure.

## ImageToFile

ImageToFile() writes an image to a file. It returns MagickFalse if an error occurs otherwise MagickTrue.

The format of the ImageToFile method is:

     MagickBooleanType ImageToFile(Image *image,char *filename,
       ExceptionInfo *exception)

A description of each parameter follows:

image
  the image.
filename
  Write the image to this file.
exception
  return any errors or warnings in this structure.

## ImagesToBlob

ImagesToBlob() implements direct to memory image formats. It returns the image sequence as a blob and its length. The magick member of the ImageInfo structure determines the format of the returned blob (GIF, JPEG, PNG, etc.)

Note, some image formats do not permit multiple images to the same image stream (e.g. JPEG). in this instance, just the first image of the sequence is returned as a blob.

The format of the ImagesToBlob method is:

    void *ImagesToBlob(const ImageInfo *image_info,Image *images,
      size_t *length,ExceptionInfo *exception)

A description of each parameter follows:

image_info
  the image info.
images
  the image list.
length
  return the actual length of the blob.
exception
  return any errors or warnings in this structure.

## InjectImageBlob

InjectImageBlob() injects the image with a copy of itself in the specified format (e.g. inject JPEG into a PDF image).

The format of the InjectImageBlob method is:

    MagickBooleanType InjectImageBlob(const ImageInfo *image_info,
      Image *image,Image *inject_image,const char *format,
      ExceptionInfo *exception)

A description of each parameter follows:

image_info
  the image info..
image
  the image.
inject_image
  inject into the image stream.
format
  the image format.
exception
  return any errors or warnings in this structure.

## IsBlobExempt

IsBlobExempt() returns true if the blob is exempt.

The format of the IsBlobExempt method is:

     MagickBooleanType IsBlobExempt(const Image *image)

A description of each parameter follows:

image
  the image.

## IsBlobSeekable

IsBlobSeekable() returns true if the blob is seekable.

The format of the IsBlobSeekable method is:

     MagickBooleanType IsBlobSeekable(const Image *image)

A description of each parameter follows:

image
  the image.

## IsBlobTemporary

IsBlobTemporary() returns true if the blob is temporary.

The format of the IsBlobTemporary method is:

     MagickBooleanType IsBlobTemporary(const Image *image)

A description of each parameter follows:

image
  the image.