Foxit PDF SDK
FoxitPDFSDKPython2.Image Class Reference
Inheritance diagram for FoxitPDFSDKPython2.Image:
FoxitPDFSDKPython2.Base

Public Member Functions

def Image ()
 Constructor.
More...
 
def Image (buffer, length)
 Constructor, from a memory buffer.
More...
 
def Image (file_read)
 Constructor, with a file read callback object.
More...
 
def Image (other)
 Constructor, with another image object.
More...
 
def Image (path)
 Constructor, from an existing image file path.
More...
 
def AddFrame (bitmap)
 Add a bitmap as a frame. (Unsupported DIB formats: FoxitPDFSDKPython2.Bitmap.e_DIBRgb565 and FoxitPDFSDKPython2.Bitmap.e_DIB8bppMask )
More...
 
def GetFrameBitmap (index)
 Get a frame bitmap, specified by index.
More...
 
def GetFrameCount ()
 Get frame count.
More...
 
def GetHeight ()
 Get image height.
More...
 
def GetType ()
 Get image type.
More...
 
def GetWidth ()
 Get image width.
More...
 
def GetXDPI ()
 Get DPI for X-axis.
More...
 
def GetYDPI ()
 Get DPI for Y-axis.
More...
 
def IsEmpty ()
 Check whether current object is empty or not.
More...
 
def SaveAs (file, file_extension)
 Save current image as an image file.
More...
 
def SaveAs (file_path)
 Save current image as an image file.
More...
 
def SetDPIs (x_dpi, y_dpi)
 Set DPI for X-axis and Y-axis.
More...
 

Static Public Attributes

 e_BMP = _fsdk.Image_e_BMP
 Image type is BMP.

 
 e_GIF = _fsdk.Image_e_GIF
 Image type is GIF.

 
 e_JBIG2 = _fsdk.Image_e_JBIG2
 Image type is JBIG2.
More...
 
 e_JPG = _fsdk.Image_e_JPG
 Image type is JPG or JPEG.

 
 e_JPX = _fsdk.Image_e_JPX
 Image type is JPX or JPEG-2000.

 
 e_None = _fsdk.Image_e_None
 Not have image type yet.
More...
 
 e_PNG = _fsdk.Image_e_PNG
 Image type is PNG.

 
 e_TIF = _fsdk.Image_e_TIF
 Image type is TIF or TIFF.

 

Detailed Description

Foxit PDF SDK offers following image types:

  • BMP: bitmap image format. It only support single frame. Foxit PDF SDK supports to load image from a BMP image file, get some basic information, get its bitmap, change its bitmap and save it as an image file.
  • JPG: joint photographic experts group image format. It only support single frame. Foxit PDF SDK supports to load image from a JPG image file, get some basic information, get its bitmap, change its bitmap and save it as an image file.
  • PNG: portable network graphics image format. It only support single frame. Foxit PDF SDK supports to load image from a PNG image file, get some basic information, get its bitmap, change its bitmap and save it as an image file.
  • GIF: graphics interchange format. It supports multiple frames. Foxit PDF SDK supports to load image from a GIF image file, get its size, get its bitmap, change its bitmap and save it as an image file.
  • TIF: tagged image file format. It supports multiple frames. Foxit PDF SDK supports to load image from a TIF image file, get some basic information, get its bitmap, change its bitmap and save it as an image file.
  • JPX: JPEG-2000 image format. It only support single frame. Foxit PDF SDK supports to load image from a JPX image file, get its size, get its bitmap, change its bitmap and save it as an image file.
  • JBIG2: JBIG2 image format. It only support single frame. Foxit PDF SDK supports to load image from a JBIG2 image file, get its size, and save it as an image file. Foxit PDF SDK does not support to get its frame bitmap yet.


Constructor & Destructor Documentation

◆ Image() [1/5]

def FoxitPDFSDKPython2.Image.Image ( )

Constructor.

This constructor is to construct a new image object (without any data). The image type of this constructed image object would be FoxitPDFSDKPython2.Image.e_None .

◆ Image() [2/5]

def FoxitPDFSDKPython2.Image.Image (   path)

Constructor, from an existing image file path.

Parameters
[in]pathA full path of an existing image file. It should not be an empty string.

◆ Image() [3/5]

def FoxitPDFSDKPython2.Image.Image (   buffer,
  length 
)

Constructor, from a memory buffer.

Parameters
[in]bufferA memory buffer. The image file data should be fully loaded in this memory buffer. It should not be null.
[in]lengthThe size of memory buffer. It should be above 0.

◆ Image() [4/5]

def FoxitPDFSDKPython2.Image.Image (   file_read)

Constructor, with a file read callback object.

Parameters
[in]file_readA FoxitPDFSDKPython2.FileReaderCallback object which is implemented by user to load an image file. It should not be null.

◆ Image() [5/5]

def FoxitPDFSDKPython2.Image.Image (   other)

Constructor, with another image object.

Parameters
[in]otherAnother image object.

Member Function Documentation

◆ AddFrame()

def FoxitPDFSDKPython2.Image.AddFrame (   bitmap)

Add a bitmap as a frame. (Unsupported DIB formats: FoxitPDFSDKPython2.Bitmap.e_DIBRgb565 and FoxitPDFSDKPython2.Bitmap.e_DIB8bppMask )

Currently, this function does not support an image with type FoxitPDFSDKPython2.Image.e_JBIG2 , or FoxitPDFSDKPython2.Image.e_Unknown .
For supporting image types:


Parameters
[in]bitmapA valid bitmap as a frame to be added or set.
Returns
true means success, while false means failure.

◆ GetFrameBitmap()

def FoxitPDFSDKPython2.Image.GetFrameBitmap (   index)

Get a frame bitmap, specified by index.

Currently, this function does not support an image with type FoxitPDFSDKPython2.Image.e_JBIG2 . This function can only support to get a frame bitmap which is in following formats:
FoxitPDFSDKPython2.Bitmap.e_DIB8bppMask , FoxitPDFSDKPython2.Bitmap.e_DIB8bpp , FoxitPDFSDKPython2.Bitmap.e_DIBRgb , FoxitPDFSDKPython2.Bitmap.e_DIBRgb32 , FoxitPDFSDKPython2.Bitmap.e_DIBArgb .
For other unsupported DIB format, this function will return a bitmap object which's function FoxitPDFSDKPython2.Bitmap.IsEmpty returns true.

Parameters
[in]indexIndex of the frame. Valid range: from 0 to (count-1). count is returned by function FoxitPDFSDKPython2.Image.GetFrameCount .
Returns
The frame bitmap. If the return value of function FoxitPDFSDKPython2.Bitmap.IsEmpty for the returned bitmap object is true, that means the frame's DIB format is not supported.

◆ GetFrameCount()

def FoxitPDFSDKPython2.Image.GetFrameCount ( )

Get frame count.

Currently, this function does not support an image with type FoxitPDFSDKPython2.Image.e_JBIG2 .

Returns
The frame count.

◆ GetHeight()

def FoxitPDFSDKPython2.Image.GetHeight ( )

Get image height.

If the image has multiple frames, usually the first frame's size will be treated as the image size.

Returns
Image height.

◆ GetType()

def FoxitPDFSDKPython2.Image.GetType ( )

Get image type.

If current image is a new image (not constructed from any image file), its type would be FoxitPDFSDKPython2.Image.e_None .

Returns
Image type. Please refer to values starting from FoxitPDFSDKPython2.Image.e_Unknown and this would be one of these values.

◆ GetWidth()

def FoxitPDFSDKPython2.Image.GetWidth ( )

Get image width.

If the image has multiple frames, usually the first frame's size will be treated as the image size.

Returns
Image width..

◆ GetXDPI()

def FoxitPDFSDKPython2.Image.GetXDPI ( )

Get DPI for X-axis.

Currently, this function does not support an image with type FoxitPDFSDKPython2.Image.e_JPX , FoxitPDFSDKPython2.Image.e_GIF or FoxitPDFSDKPython2.Image.e_JBIG2 .
For a new image (not constructed from any image file), the default DPI for X-axis is 96.

Returns
DPI value for X-axis.

◆ GetYDPI()

def FoxitPDFSDKPython2.Image.GetYDPI ( )

Get DPI for Y-axis.

Currently, this function does not support an image with type FoxitPDFSDKPython2.Image.e_JPX , FoxitPDFSDKPython2.Image.e_GIF or FoxitPDFSDKPython2.Image.e_JBIG2 .
For a new image (not constructed from any image file), the default DPI for Y-axis is 96.

Returns
DPI value for Y-axis.

◆ IsEmpty()

def FoxitPDFSDKPython2.Image.IsEmpty ( )

Check whether current object is empty or not.

When the current object is empty, that means current object is useless.

Returns
true means current object is empty, while false means not.

◆ SaveAs() [1/2]

def FoxitPDFSDKPython2.Image.SaveAs (   file,
  file_extension 
)

Save current image as an image file.

If the type of current image is FoxitPDFSDKPython2.Image.e_TIF , FoxitPDFSDKPython2.Image.e_GIF or FoxitPDFSDKPython2.Image.e_None , and the saved image file type does not support multiply frames, only the first frame of current image will be saved to the image file.
For an image object (not constructed from any image file), please ensure to add at least one valid frame bitmap to the image object before using this function; otherwise this function will fail.

Parameters
[in]fileA FoxitPDFSDKPython2.StreamCallback object which is implemented by user to save image file.
[in]file_extensionA full path of the saved image file. It should not be an empty string.
Currently, this function supports following extension names:
.bmp, .jpg, .jpeg, .png, .tif, .tiff, .jpx, .jp2.
Returns
true means success, while false means failure.
Note
This function does not support to save current image object just back to the image file which is used to construct current image object. In order to do so, user is recommended to do as following steps:
Assume that current image object is constructed from an image file named "org.bmp".
  1. Use current function to save current image object to an temporary file. Here, this temporary file is named as "temp.tmp".
  2. Ensure that current image object has destructed.
  3. Remove "org.bmp" and rename "temp.tmp" to "org.bmp".

◆ SaveAs() [2/2]

def FoxitPDFSDKPython2.Image.SaveAs (   file_path)

Save current image as an image file.

If the type of current image is FoxitPDFSDKPython2.Image.e_TIF , FoxitPDFSDKPython2.Image.e_GIF or FoxitPDFSDKPython2.Image.e_None , and the saved image file type does not support multiply frames, only the first frame of current image will be saved to the image file.
For an image object (not constructed from any image file), please ensure to add at least one valid frame bitmap to the image object before using this function; otherwise this function will fail.

Parameters
[in]file_pathA full path of the saved image file. It should not be an empty string.
Currently, this function supports following extension names:
.bmp, .jpg, .jpeg, .png, .tif, .tiff, .jpx, .jp2.
Returns
true means success, while false means failure.
Note
This function does not support to save current image object just back to the image file which is used to construct current image object. In order to do so, user is recommended to do as following steps:
Assume that current image object is constructed from an image file named "org.bmp".
  1. Use current function to save current image object to an temporary file. Here, this temporary file is named as "temp.tmp".
  2. Ensure that current image object has destructed.
  3. Remove "org.bmp" and rename "temp.tmp" to "org.bmp".

◆ SetDPIs()

def FoxitPDFSDKPython2.Image.SetDPIs (   x_dpi,
  y_dpi 
)

Set DPI for X-axis and Y-axis.

Currently, this function does not support an image with type FoxitPDFSDKPython2.Image.e_JPX , FoxitPDFSDKPython2.Image.e_GIF , or FoxitPDFSDKPython2.Image.e_JBIG2 .

Parameters
[in]x_dpiDPI for X-axis. It should be above 0.
[in]y_dpiDPI for Y-axis. It should be above 0.
Returns
None.

Member Data Documentation

◆ e_JBIG2

FoxitPDFSDKPython2.Image.e_JBIG2 = _fsdk.Image_e_JBIG2
static

Image type is JBIG2.

Note
Currently, only few functions in class Image support this type.

◆ e_None

FoxitPDFSDKPython2.Image.e_None = _fsdk.Image_e_None
static

Not have image type yet.

Note
This is only for a new image object, which is not constructed from any image file or retrieved from other object.