DynaPDF.GetImage
----------------

Queries image properties or content.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [DynaPDF](component_DynaPDF.md) | [6.4](newinversion64.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "DynaPDF.GetImage"; PDF; Index; Selector { ; FileName; ImageFormat } ) 

**MBS**( **"DynaPDF.GetImage";** /\* Queries image properties or content. \*/  
**$PDF**; /\* The PDF reference returned from [DynaPDF.New](DynaPDFNew.md). \*/   
**$Index**; /\* The index of the image from 0 to [DynaPDF.GetImageCount](DynaPDFGetImageCount.md)-1. \*/   
**$Selector**; /\* Which value to query.e.g. "Picture" \*/   
**$FileName**; /\* Optional; In case we return a container value, the file name to use.e.g. "test.jpg" \*/   
**$ImageFormat**) /\* Optional; 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.e.g. "JPEG" \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| PDF | The PDF reference returned from [DynaPDF.New](DynaPDFNew.md). | $pdf |  |
| Index | The index of the image from 0 to [DynaPDF.GetImageCount](DynaPDFGetImageCount.md)-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 | 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      Added in version **10.2**. |

### 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](DynaPDFNew.md)") \]   
\# Load PDF from container   
Set Variable \[ $r ; Value: MBS ("[DynaPDF.OpenPDFFromContainer](DynaPDFOpenPDFFromContainer.md)"; $pdf ; Start::SourcePDF ) \]   
Set Variable \[ $r ; Value: MBS ("[DynaPDF.ImportPDFFile](DynaPDFImportPDFFile.md)"; $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](DynaPDFGetImageCount.md)"; $PDF ) \]   
Set Variable \[ $imageIndex ; Value: 0 \]   
If \[ $imageCount &gt; 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 &gt;= $imageCount \]   
 End Loop  
End If  
Set Variable \[ $r ; Value: MBS ("[DynaPDF.Release](DynaPDFRelease.md)"; $pdf ) \]  
### See also

- [DynaPDF.ExtractImages](DynaPDFExtractImages.md)
- [DynaPDF.GetImageCount](DynaPDFGetImageCount.md)
- [DynaPDF.ImportPDFFile](DynaPDFImportPDFFile.md)
- [DynaPDF.InsertImage](DynaPDFInsertImage.md)
- [DynaPDF.InsertImageFile](DynaPDFInsertImageFile.md)
- [DynaPDF.ListImages](DynaPDFListImages.md)
- [DynaPDF.New](DynaPDFNew.md)
- [DynaPDF.OpenPDFFromContainer](DynaPDFOpenPDFFromContainer.md)
- [DynaPDF.Parser.ListImages](DynaPDFParserListImages.md)
- [DynaPDF.Release](DynaPDFRelease.md)

### Release notes

- **Version 16.3**
    - Added JBIG2Lossy as option for DynaPDF.GetImage function.
- **Version 11.4**
    - Deprecated [DynaPDF.ExtractImages](https://www.mbsplugins.eu/DynaPDFExtractImages.shtml) and [DynaPDF.ListImages](https://www.mbsplugins.eu/DynaPDFListImages.shtml) in favor of [DynaPDF.GetImage](https://www.mbsplugins.eu/DynaPDFGetImage.shtml) function.
- **Version 11.1**
    - Added FillColor and FillColorSpace options for [DynaPDF.GetImage](https://www.mbsplugins.eu/DynaPDFGetImage.shtml) function.
- **Version 10.2**
    - Added new file format parameter for [DynaPDF.GetImage](https://www.mbsplugins.eu/DynaPDFGetImage.shtml) function.
- **Version 7.5**
    - Fixed bug with [DynaPDF.GetImage](http://www.mbsplugins.eu/DynaPDFGetImage.shtml) function complaining about non decompressed image.

### Example Databases

- [DynaPDF/Extract and analyze images](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/DynaPDF/Extract%20and%20analyze%20images.shtml#2ScriptAnchor_)
- [DynaPDF/Extract Images](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/DynaPDF/Extract%20Images.shtml#5ScriptAnchor_)
- [DynaPDF/PSD Conversion](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/DynaPDF/PSD%20Conversion.shtml#3ScriptAnchor_)

### Blog Entries

- [MBS FileMaker Plugin, version 16.3pr1](https://www.mbsplugins.de/archive/2026-06-01/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [Unlocking the Power of PDFs in FileMaker with DynaPDF and the MBS FileMaker Plugin](https://www.mbsplugins.de/archive/2024-09-16/Unlocking_the_Power_of_PDFs_in/monkeybreadsoftware_blog_filemaker)
- [Extract and analyze images with DynaPDF](https://www.mbsplugins.de/archive/2021-11-10/Extract_and_analyze_images_wit/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 11.4pr1](https://www.mbsplugins.de/archive/2021-08-02/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [Things you can do with DynaPDF](https://www.mbsplugins.de/archive/2021-07-02/Things_you_can_do_with_DynaPDF/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 11.1pr6](https://www.mbsplugins.de/archive/2021-02-24/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 10.2pr1](https://www.mbsplugins.de/archive/2020-04-01/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 7.5pr1](https://www.mbsplugins.de/archive/2017-10-01/MBS_FileMaker_Plugin_version_7/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 6.4pr3](https://www.mbsplugins.de/archive/2016-08-08/MBS_FileMaker_Plugin_version_6/monkeybreadsoftware_blog_filemaker)

### FileMaker Magazin

- [Ausgabe 5/2021, Seite 27](https://filemaker-magazin.de/neuigkeit/4158-Appetithappen-FMM_202105)

This function checks for a license.

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

  
[DynaPDF.GetGlyphOutline](DynaPDFGetGlyphOutline.md) - [DynaPDF.GetImageContainerCount](DynaPDFGetImageContainerCount.md)

[HTML Version](DynaPDFGetImage.shtml)