DynaPDF.GetImageCount
---------------------

Queries number of images in PDF.

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

MBS( "DynaPDF.GetImageCount"; PDF ) 

**MBS**( **"DynaPDF.GetImageCount";** /\* Queries number of images in PDF. \*/  
**$PDF**) /\* The PDF reference returned from [DynaPDF.New](DynaPDFNew.md). \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| PDF | The PDF reference returned from [DynaPDF.New](DynaPDFNew.md). | $pdf |

### Result

Returns number or error.

### Description

Queries number of images in PDF.  
Returns the number of image objects which were loaded with [DynaPDF](component_DynaPDF.md) functions or imported from external PDF files. This does not include inline images.  
The images can be accessed with [DynaPDF.GetImage](DynaPDFGetImage.md).  
If you need to write all files to disk, you can use [DynaPDF.ExtractImages](DynaPDFExtractImages.md) or use [DynaPDF.ListImages](DynaPDFListImages.md) to list them all with details.  
  
See also [GetImageCount](https://www.monkeybreadsoftware.com/DynaPDF-Manual/GetImageCount.shtml) function in DynaPDF manual.

### Examples

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"; $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](DynaPDFGetImage.md)"; $pdf ; $ImageIndex ; "Picture"; ""; "") \]   
 Set Field \[ List::JPEG ; MBS ("[DynaPDF.GetImage](DynaPDFGetImage.md)"; $pdf ; $ImageIndex ; "Picture"; "test.jpg"; "JPEG") \]   
 Set Field \[ List::BMP ; MBS ("[DynaPDF.GetImage](DynaPDFGetImage.md)"; $pdf ; $ImageIndex ; "Picture"; "test.bmp"; "BMP") \]   
 Set Field \[ List::PNG ; MBS ("[DynaPDF.GetImage](DynaPDFGetImage.md)"; $pdf ; $ImageIndex ; "Picture"; "test.png"; "PNG") \]   
 Set Field \[ List::TIFF ; MBS ("[DynaPDF.GetImage](DynaPDFGetImage.md)"; $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.GetFieldCount](DynaPDFGetFieldCount.md)
- [DynaPDF.GetFontCount](DynaPDFGetFontCount.md)
- [DynaPDF.GetImageFileCount](DynaPDFGetImageFileCount.md)
- [DynaPDF.GetImportPageCount](DynaPDFGetImportPageCount.md)
- [DynaPDF.GetPageLayout](DynaPDFGetPageLayout.md)
- [DynaPDF.GetTemplCount](DynaPDFGetTemplCount.md)
- [DynaPDF.New](DynaPDFNew.md)
- [DynaPDF.OpenPDFFromContainer](DynaPDFOpenPDFFromContainer.md)
- [DynaPDF.Parser.DeleteImage](DynaPDFParserDeleteImage.md)
- [DynaPDF.Release](DynaPDFRelease.md)

### 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/Replace Image](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/DynaPDF/Replace%20Image.shtml#2ScriptAnchor_)

### Blog Entries

- [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)
- [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 6.4pr3](https://www.mbsplugins.de/archive/2016-08-08/MBS_FileMaker_Plugin_version_6/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

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

  
[DynaPDF.GetImageContainerCount](DynaPDFGetImageContainerCount.md) - [DynaPDF.GetImageFileCount](DynaPDFGetImageFileCount.md)

[HTML Version](DynaPDFGetImageCount.shtml)