Topics
All
MacOS
(Only)
Windows
(Only)
Linux
(Only, Not)
iOS
(Only, Not)
Components
Crossplatform Mac & Win
Server
Client
Old
Deprecated
Guides
Examples
Videos
New in version:
9.3
9.4
9.5
10.0
10.1
10.2
10.3
10.4
10.5
10.6
Statistic
FMM
Blog
CGImageSource.ThumbnailAtIndex
Creates a thumbnail image of the image located at a specified location in an image source.
| Component | Version | macOS | Windows | Linux | Server | FileMaker iOS SDK |
| CGImageSource | 3.4 | Yes | No | No | Yes, macOS only | Yes |
Parameters
| Parameter | Description | Example | Flags |
|---|---|---|---|
| Ref | The image source reference number returned by CGImageSource.CreateWithData, CGImageSource.CreateWithPath or CGImageSource.CreateWithURL | $ref | |
| Index | The index of the image to query. -1 for global properties. Else a number from 0 to CGImageSource.Count-1. | 0 | |
| ImageType | The type of image to return. Either JPEG, PNG, GIF or BMP. Default is JPEG. |
"JPEG" | Optional |
| FileName | The filename to use for the picture. Default is "image" with the extension matching the image type. |
"test.jpg" | Optional |
Result
Returns image or error message.
Description
Creates a thumbnail image of the image located at a specified location in an image source.If the image source is a PDF, this function creates a 72 dpi image of the PDF page specified by the index that you pass.
Maximum thumbnail size is 512 pixel.
This function can be used to query previews of various image formats including RAW images. (everything Preview app can also open)
Examples
Create a thumbnail:
Set Variable [$ref; Value:MBS("CGImageSource.CreateWithData"; MyTable::ImageFile)]
Set Variable [$image; Value:MBS("CGImageSource.ThumbnailAtIndex"; $ref; 0; "JPEG"; "thumbnail.jpg")]
Set Variable [$r; Value:MBS("CGImageSource.Release"; $ref)]
Create thumbnail from a file on disk:
Set Variable [ $path ; Value: "/Users/cs/Pictures/IMG_3625.jpg" ]
Set Variable [ $img ; Value: MBS( "CGImageSource.CreateWithPath"; $path ) ]
Set Field [ test::output ; MBS( "CGImageSource.ThumbnailAtIndex"; $img; 0; "JPEG"; "thumbnail.jpg")]
Set Variable [ $r ; Value: MBS( "CGImageSource.Release"; $img ) ]
See also
- CGImageSource.Count
- CGImageSource.CreateWithData
- CGImageSource.CreateWithPath
- CGImageSource.CreateWithURL
- CGImageSource.ImageAtIndex
- CGImageSource.Release
Blog Entries
Created 18th August 2014, last changed 29th September 2020
CGImageSource.SupportedTypes - CGImageSource.Type
Feedback: Report problem or ask question.
Links
MBS FileMaker Plugins