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:
10.1
10.2
10.3
10.4
10.5
11.0
11.1
11.2
11.3
11.4
Statistic
FMM
Blog
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 |
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 ) ]
Created 18th August 2014, last changed 29th September 2020
CGImageSource.SupportedTypes - CGImageSource.Type
Feedback: Report problem or ask question.