Foxit PDF SDK
fsdk.ImageObject Class Reference

Public Member Functions

def CloneBitmap (graphics_objects)
 
def CloneBitmap (page, graphics_objects)
 Clone the bitmap from current image graphics object. More...
 
def GetColorSpace ()
 Get color space. More...
 
def GetMask ()
 Get the PDF object that represents the mask of current image graphics object. More...
 
def GetStream ()
 Get image stream. More...
 
def IsImageMask ()
 Check if current image object is treated as mask. More...
 
def SetBitmap (bitmap, mask)
 Set a bitmap to current image graphics object. More...
 
def SetImage (image, frame_index)
 Set one frame of an image to current image graphics object. More...
 

Detailed Description

Image graphics object is a kind of PDF graphics object, so class ImageObject is derived from class GraphicsObject . It offers functions to get/set image graphics object's data.
To create a new image graphics object, please use function fsdk.ImageObjectCreate and then use setting functions to set information to the new image graphics object.

See also
GraphicsObject

Member Function Documentation

◆ CloneBitmap() [1/2]

def fsdk.ImageObject.CloneBitmap (   graphics_objects)
Deprecated:
This function is deprecated. Use function fsdk.ImageObject.CloneBitmap with two parameters instead.

Currently, the bitmap can be cloned from image graphics object only when the bitmap format is one of following formats:
fsdk.BitmapE_DIB8bppMask , fsdk.BitmapE_DIB8bpp , fsdk.BitmapE_DIBRgb , fsdk.BitmapE_DIBRgb32 , fsdk.BitmapE_DIBArgb , fsdk.BitmapE_DIBCmyk .
If the return value of function fsdk.Bitmap.IsEmpty for the returned bitmap object is true, that means the DIB format of the bitmap is unsupported.

Parameters
[in]graphics_objectsA valid fsdk.GraphicsObjects object. Please ensure that current image graphics object just belongs to this fsdk.GraphicsObjects object (it may be a PDF page).
Returns
The new cloned bitmap object. If the return value of function fsdk.Bitmap.IsEmpty for the returned bitmap object is true, that means the DIB format of the bitmap is unsupported.

◆ CloneBitmap() [2/2]

def fsdk.ImageObject.CloneBitmap (   page,
  graphics_objects 
)

Clone the bitmap from current image graphics object.

Currently, the bitmap can be cloned from image graphics object only when the bitmap format is one of following formats:
fsdk.BitmapE_DIB8bppMask , fsdk.BitmapE_DIB8bpp , fsdk.BitmapE_DIBRgb , fsdk.BitmapE_DIBRgb32 , fsdk.BitmapE_DIBArgb , fsdk.BitmapE_DIBCmyk .
If the return value of function fsdk.Bitmap.IsEmpty for the returned bitmap object is true, that means the DIB format of the bitmap is unsupported.

Parameters
[in]pageA valid PDF page object. Please ensure that current image graphics object just belongs to this page.
[in]graphics_objectsA valid fsdk.GraphicsObjects object. Please ensure that current image graphics object just belongs to this fsdk.GraphicsObjects object (it may be a PDF page).
Returns
The new cloned bitmap object. If the return value of function fsdk.Bitmap.IsEmpty for the returned bitmap object is true, that means the DIB format of the bitmap is unsupported.

◆ GetColorSpace()

def fsdk.ImageObject.GetColorSpace ( )

Get color space.

Returns
Color space. Please refer to values starting from fsdk.E_ColorSpaceDeviceGray and this would be one of these values.

◆ GetMask()

def fsdk.ImageObject.GetMask ( )

Get the PDF object that represents the mask of current image graphics object.

The mask can be either a PDF dictionary or a PDF array:

  • A PDF dictionary represents an image mask to be applied to this image.

  • A PDF array represents a range of colors to be applied to it as a color key mask.

Please refer to Section 4.8.4 "Image Dictionaries" in <PDF Reference 1.7> for more details.

Returns
A PDF object that represents the mask. If fsdk.ImageObject.IsImageMask returns true, this function will return null.

◆ GetStream()

def fsdk.ImageObject.GetStream ( )

Get image stream.

Returns
A fsdk.PDFStream that represents the image stream. If there is any error, this function will return null.

◆ IsImageMask()

def fsdk.ImageObject.IsImageMask ( )

Check if current image object is treated as mask.

Returns
true means current object is treated as mask, while false means not.

◆ SetBitmap()

def fsdk.ImageObject.SetBitmap (   bitmap,
  mask 
)

Set a bitmap to current image graphics object.

Parameters
[in]bitmapA valid bitmap object to be set to current image.
[in]maskMask bitmap. Default value: A bitmap object by default constructor and not set any value, which means no mask is used.
If this is valid, its format should be fsdk.BitmapE_DIB8bppMask .
This is useful only when parameter bitmap does not have an alpha channel.
Returns
None
Note
When this function succeeds, function fsdk.GraphicsObjects.GenerateContent should be called. Please refer to function fsdk.GraphicsObjects.GenerateContent for more details.

◆ SetImage()

def fsdk.ImageObject.SetImage (   image,
  frame_index 
)

Set one frame of an image to current image graphics object.

Input image may contain multiple frames, and only one frame of the image can be set to current image graphics object.

Parameters
[in]imageA valid image object. This image should contain at least one frame and the image type should not be fsdk.ImageE_Unknown .
[in]frame_indexFrame index used to decide which frame of parameter image is to be set. Valid range: from 0 to (count-1). count is returned by function fsdk.Image.GetFrameCount .
Returns
None
Note
When this function succeeds, function fsdk.GraphicsObjects.GenerateContent should be called. Please refer to function fsdk.GraphicsObjects.GenerateContent for more details.