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
MBS( "DynaPDF.GetImage"; PDF; Index; Selector { ; FileName; ImageFormat } )   More

Parameters

Parameter Description Example Flags
PDF The PDF reference returned from DynaPDF.New. $pdf
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:
BufSizeThe size of the image buffer in bytes.
BufferThe image data as JPEG or FILE.
PictureThe image as a picture container. Either JPEG or TIFF.
FilterThe 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.
OrgFilterThe 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.
ColorSpaceThe color space refers either to the image buffer or to the color table if set.
NumComponentsThe number of components stored in the image buffer.
MinIsWhiteIf 1, the colors of 1 bit images are reversed.
ColorCountThe number of colors in the color table.
WidthImage width in pixel.
HeightImage height in pixel.
ScanLineLengthThe length of a scanline in bytes.
InlineImageIf 1, the image is an inline image.
InterpolateIf 1, image interpolation should be performed.
TransparentThe 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.
IntentThe rendering intent. Default is none.
MetadataSizeLength of Metadata in bytes.
ResolutionXImage resolution on the x-axis.
ResolutionYImage resolution on the y-axis.
MetadataOptional XML Metadata stream as text.
ICCProfileICC Color Profile of the colorspace (can be empty).
MaskImageIf set, a 1 bit image is used as a transparency mask. Returns index of that image.
SoftMaskIf set, a grayscale image is used as alpha channel. Returns index of that image.
FillColorThe current fill color. An image mask is drawn with the current fill color.
FillColorSpaceThe 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

Release notes

Example Databases

Blog Entries

This function checks for a license.

Created 5th August 2016, last changed 9th November 2021


DynaPDF.GetGlyphOutline - DynaPDF.GetImageContainerCount