Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
DynaPDF.GetImage
Queries image properties or content.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
DynaPDF | 6.4 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
Parameters
Parameter | Description | Example | Flags |
---|---|---|---|
The PDF reference returned from DynaPDF.New. | |||
Index | The index of the image from 0 to DynaPDF.GetImageCount-1. | $index | |
Selector | Which value to query. | "Picture" | |
FileName | In case we return a container value, the file name to use. | "test.jpg" | Optional |
ImageFormat | Available in MBS FileMaker Plugin 10.2 or newer. Which image file format to use for the image returned. Default is to use JPEG for JPEG images and TIFF for other formats. Value can be TIFF, JPEG, PNG, BMP or JPC. |
"JPEG" | Optional |
Result
Returns value or error.
Description
Queries image properties or content.Retrieves the properties of an image as well as the decompressed image buffer if needed. By default all images are returned decompressed, with exception of image types which are already stored in a valid file format like JPEG and JPEG 2000 images.
If all image types should be decompressed set the flag pfDecompressAllImages.
Selectors include:
BufSize | The size of the image buffer in bytes. |
Buffer | The image data as JPEG or FILE. |
Picture | The image as a picture container. Either JPEG or TIFF. |
Filter | The format of image: Required decode filter if the image is compressed. Possible values are dfDCTDecode (JPEG), dfJPXDecode (JPEG2000), and dfJBIG2Decode. Other filters are already removed by DynaPDF since a conversion to a native file format is then always required. |
OrgFilter | The image was compressed with this filter in the PDF file. This info is useful to determine which compression filter should be used when creating a new image file from the image buffer. |
BitsPerPixel | Bit depth of the image buffer. Possible values are 1, 2, 4, 8, 24, 32, and 64. |
ColorSpace | The color space refers either to the image buffer or to the color table if set. |
NumComponents | The number of components stored in the image buffer. |
MinIsWhite | If 1, the colors of 1 bit images are reversed. |
ColorCount | The number of colors in the color table. |
Width | Image width in pixel. |
Height | Image height in pixel. |
ScanLineLength | The length of a scanline in bytes. |
InlineImage | If 1, the image is an inline image. |
Interpolate | If 1, image interpolation should be performed. |
Transparent | The meaning is different depending on the bit depth and whether a color table is available. If the image is a 1 bit image and if no color table is available, black pixels must be drawn with the current fill color. If the image contains a color table, ColorMask contains the range of indexes in the form min/max index which should appear transparent. If no color table is present ColorMask contains the transparent ranges in the form min/max for every color component. |
Intent | The rendering intent. Default is none. |
MetadataSize | Length of Metadata in bytes. |
ResolutionX | Image resolution on the x-axis. |
ResolutionY | Image resolution on the y-axis. |
Metadata | Optional XML Metadata stream as text. |
ICCProfile | ICC Color Profile of the colorspace (can be empty). |
MaskImage | If set, a 1 bit image is used as a transparency mask. Returns index of that image. |
SoftMask | If set, a grayscale image is used as alpha channel. Returns index of that image. |
FillColor | The current fill color. An image mask is drawn with the current fill color. |
FillColorSpace | The color space in which FillColor is defined. |
This function allows to extract images from PDF with DynaPDF Lite or higher license.
Examples
Query colorspace of an image:
MBS( "DynaPDF.GetImage"; $pdf; $ImageIndex; "ColorSpace")
Loop and get all images in various formats:
Go to Layout [ “Start” (Start) ; Animation: None ]
Set Variable [ $pdf ; Value: MBS("DynaPDF.New") ]
# Load PDF from container
Set Variable [ $r ; Value: MBS("DynaPDF.OpenPDFFromContainer"; $pdf; Start::SourcePDF) ]
Set Variable [ $r ; Value: MBS("DynaPDF.ImportPDFFile"; $pdf) ]
# Put result in records
Go to Layout [ “List” (List) ; Animation: None ]
Delete All Records [ With dialog: Off ]
Set Variable [ $imageCount ; Value: MBS( "DynaPDF.GetImageCount"; $PDF ) ]
Set Variable [ $imageIndex ; Value: 0 ]
If [ $imageCount > 0 ]
Loop
New Record/Request
Set Field [ List::Index ; $imageIndex ]
Set Field [ List::Image ; MBS("DynaPDF.GetImage"; $pdf; $ImageIndex; "Picture"; ""; "") ]
Set Field [ List::JPEG ; MBS("DynaPDF.GetImage"; $pdf; $ImageIndex; "Picture"; "test.jpg"; "JPEG") ]
Set Field [ List::BMP ; MBS("DynaPDF.GetImage"; $pdf; $ImageIndex; "Picture"; "test.bmp"; "BMP") ]
Set Field [ List::PNG ; MBS("DynaPDF.GetImage"; $pdf; $ImageIndex; "Picture"; "test.png"; "PNG") ]
Set Field [ List::TIFF ; MBS("DynaPDF.GetImage"; $pdf; $ImageIndex; "Picture"; "test.tif"; "TIFF") ]
Commit Records/Requests [ With dialog: On ]
Set Variable [ $imageIndex ; Value: $imageIndex + 1 ]
Exit Loop If [ $imageIndex >= $imageCount ]
End Loop
End If
Set Variable [ $r ; Value: MBS("DynaPDF.Release"; $pdf) ]
See also
- DynaPDF.ExtractImages
- DynaPDF.GetImageContainerCount
- DynaPDF.GetImageCount
- DynaPDF.InsertImage
- DynaPDF.InsertImageFile
- DynaPDF.ListImages
- DynaPDF.New
- DynaPDF.OpenPDFFromContainer
- DynaPDF.Release
- DynaPDF.RenderPage
Release notes
- Version 11.4
- Deprecated DynaPDF.ExtractImages and DynaPDF.ListImages in favor of DynaPDF.GetImage function.
- Version 11.1
- Added FillColor and FillColorSpace options for DynaPDF.GetImage function.
- Version 10.2
- Added new file format parameter for DynaPDF.GetImage function.
- Version 7.5
- Fixed bug with DynaPDF.GetImage function complaining about non decompressed image.
Example Databases
Blog Entries
- Unlocking the Power of PDFs in FileMaker with DynaPDF and the MBS FileMaker Plugin
- Extract and analyze images with DynaPDF
- MBS FileMaker Plugin, version 11.4pr1
- Things you can do with DynaPDF
- MBS FileMaker Plugin, version 11.1pr6
- MBS FileMaker Plugin, version 10.2pr1
- MBS FileMaker Plugin, version 7.5pr1
- MBS FileMaker Plugin, version 6.4pr3
FileMaker Magazin
This function checks for a license.
Created 5th August 2016, last changed 9th November 2021