Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
Creates a thumbnail image of the image located at a specified location in an image source.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
CGImageSource | 3.4 | ✅ Yes | ❌ No | ❌ No | ✅ Yes, on macOS | ✅ Yes |
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 |
DesiredSize | Available in MBS FileMaker Plugin 14.0 or newer. The desired thumbnail size. Default is automatic mode to either return existing thumbnail (if exists in the file) or to create one with 512 pixel width and height. If you specify here a different size, we will request to create one with that size. |
512 | Optional |
Returns image or error message.
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 ) ]
This function checks for a license.
Created 18th August 2014, last changed 21st December 2023