|
Foxit PDF SDK
|
Public Member Functions | |
| def | AddFrame (bitmap) |
| Add a bitmap as a frame. (Unsupported DIB formats: fsdk.BitmapE_DIBRgb565 and fsdk.BitmapE_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 | GetOrientation () |
| Get image orientation. 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_path) |
| Save current image as an image file. More... | |
| def | SaveAs (file, file_extension) |
| Save current image as an image file. More... | |
| def | SetDPIs (x_dpi, y_dpi) |
| Set DPI for X-axis and Y-axis. More... | |
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.
| def fsdk.Image.AddFrame | ( | bitmap | ) |
Add a bitmap as a frame. (Unsupported DIB formats: fsdk.BitmapE_DIBRgb565 and fsdk.BitmapE_DIB8bppMask )
Currently, this function does not support an image with type fsdk.ImageE_JBIG2 , or fsdk.ImageE_Unknown .
For supporting image types:
If current image's type is fsdk.ImageE_TIF , fsdk.ImageE_GIF , or fsdk.ImageE_None , this function will add the new bitmap to be the new last frame.
If current image's type is one of other types, which only contains single frame, this function will use the new bitmap to replace the first frame.
| [in] | bitmap | A valid bitmap as a frame to be added or set. |
| def fsdk.Image.GetFrameBitmap | ( | index | ) |
Get a frame bitmap, specified by index.
Currently, this function does not support an image with type fsdk.ImageE_JBIG2 . This function can only support to get a frame bitmap which is in following formats:
fsdk.BitmapE_DIB8bppMask , fsdk.BitmapE_DIB8bpp , fsdk.BitmapE_DIBRgb , fsdk.BitmapE_DIBRgb32 , fsdk.BitmapE_DIBArgb .
For other unsupported DIB format, this function will return a bitmap object which's function fsdk.Bitmap.IsEmpty returns true.
| [in] | index | Index of the frame. Valid range: from 0 to (count-1). count is returned by function fsdk.Image.GetFrameCount . |
| def fsdk.Image.GetFrameCount | ( | ) |
Get frame count.
Currently, this function does not support an image with type fsdk.ImageE_JBIG2 .
| def fsdk.Image.GetHeight | ( | ) |
Get image height.
If the image has multiple frames, usually the first frame's size will be treated as the image size.
| def fsdk.Image.GetOrientation | ( | ) |
Get image orientation.
This function only support an image with type fsdk.ImageE_JPG and fsdk.ImageE_TIF .
| def fsdk.Image.GetType | ( | ) |
Get image type.
If current image is a new image (not constructed from any image file), its type would be fsdk.ImageE_None .
| def fsdk.Image.GetWidth | ( | ) |
Get image width.
If the image has multiple frames, usually the first frame's size will be treated as the image size.
| def fsdk.Image.GetXDPI | ( | ) |
Get DPI for X-axis.
Currently, this function does not support an image with type fsdk.ImageE_JPX , fsdk.ImageE_GIF or fsdk.ImageE_JBIG2 or fsdk.ImageE_WEBP .
For a new image (not constructed from any image file), the default DPI for X-axis is 96.
| def fsdk.Image.GetYDPI | ( | ) |
Get DPI for Y-axis.
Currently, this function does not support an image with type fsdk.ImageE_JPX , fsdk.ImageE_GIF , fsdk.ImageE_JBIG2 or fsdk.ImageE_WEBP .
For a new image (not constructed from any image file), the default DPI for Y-axis is 96.
| def fsdk.Image.IsEmpty | ( | ) |
Check whether current object is empty or not.
When the current object is empty, that means current object is useless.
| def fsdk.Image.SaveAs | ( | file_path | ) |
Save current image as an image file.
If the type of current image is fsdk.ImageE_TIF , fsdk.ImageE_GIF or fsdk.ImageE_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.
If the type of the saved image file is fsdk.ImageE_WEBP , the bitmap format of the current image should be fsdk.BitmapE_DIBRgb , or .
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.
| [in] | file_path | A 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. |
Use current function to save current image object to an temporary file. Here, this temporary file is named as "temp.tmp".
Ensure that current image object has destructed.
Remove "org.bmp" and rename "temp.tmp" to "org.bmp".
| def fsdk.Image.SaveAs | ( | file, | |
| file_extension | |||
| ) |
Save current image as an image file.
If the type of current image is fsdk.ImageE_TIF , fsdk.ImageE_GIF or fsdk.ImageE_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.
If the type of the saved image file is fsdk.ImageE_WEBP , the bitmap format of the current image should be fsdk.BitmapE_DIBRgb , or .
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.
| [in] | file | A fsdk.StreamCallback object which is implemented by user to save image file. |
| [in] | file_extension | A 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. |
Use current function to save current image object to an temporary file. Here, this temporary file is named as "temp.tmp".
Ensure that current image object has destructed.
Remove "org.bmp" and rename "temp.tmp" to "org.bmp".
| def fsdk.Image.SetDPIs | ( | x_dpi, | |
| y_dpi | |||
| ) |
Set DPI for X-axis and Y-axis.
Currently, this function does not support an image with type fsdk.ImageE_JPX , fsdk.ImageE_GIF , fsdk.ImageE_JBIG2 or fsdk.ImageE_WEBP .
| [in] | x_dpi | DPI for X-axis. It should be above 0. |
| [in] | y_dpi | DPI for Y-axis. It should be above 0. |