Platforms to show: All Mac Windows Linux Cross-Platform

Back to CGImageSourceMBS class.

CGImageSourceMBS.Constructor(data as string, options as dictionary = nil)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreGraphics MBS MacCG Plugin 9.5 ✅ Yes ❌ No ❌ No ✅ Yes All
Creates an image source that reads from a string.

data: The data string to read from.
options: A dictionary that specifies additional creation options. For example kCGImageSourceTypeIdentifierHint.

On success the handle value is not zero.
Available in Mac OS X version 10.4 and later.

See also:

CGImageSourceMBS.Constructor(file as folderitem, options as dictionary = nil)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreGraphics MBS MacCG Plugin 9.5 ✅ Yes ❌ No ❌ No ✅ Yes All
Creates an image source that reads from a location specified by a file.

url: The URL to read from.

options: A dictionary that specifies additional creation options. For example kCGImageSourceTypeIdentifierHint.

On success the handle value is not zero.

Available in Mac OS X version 10.4 and later.

See also:

CGImageSourceMBS.Constructor(options as dictionary = nil)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreGraphics MBS MacCG Plugin 9.5 ✅ Yes ❌ No ❌ No ✅ Yes All
Create an incremental image source.

options: A dictionary that specifies additional creation options. For example kCGImageSourceTypeIdentifierHint.

Returns an image source object.

The constructor creates an empty image source container to which you can add data later by calling the function UpdateData. You don't provide data when you call this function.

An incremental image is an image that is created in chunks, similar to the way large images viewed over the web are loaded piece by piece.

Available in Mac OS X version 10.4 and later.

See also:

CGImageSourceMBS.CreateImageAtIndex(index as Integer, options as dictionary = nil) as CGImageMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreGraphics MBS MacCG Plugin 9.5 ✅ Yes ❌ No ❌ No ✅ Yes All
Creates a CGImage object for the image data associated with the specified index in an image source.
Example
dim file as FolderItem = SpecialFolder.Desktop.Child("test.jpg")
dim c as new CGImageSourceMBS(file)
dim img as CGImageMBS = c.CreateImageAtIndex(0)

Backdrop=img.Picture

index: The index that specifies the location of the image. The index is zero-based.

options: A dictionary that specifies additional creation options.

Returns a CGImage object.

Available in Mac OS X version 10.4 and later.

Some examples using this method:

CGImageSourceMBS.CreateThumbnailAtIndex(index as Integer, options as dictionary = nil) as CGImageMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreGraphics MBS MacCG Plugin 9.5 ✅ Yes ❌ No ❌ No ✅ Yes All
Creates a thumbnail image of the image located at a specified location in an image source.
Example
dim file as FolderItem = SpecialFolder.Desktop.Child("test.jpg")
dim c as new CGImageSourceMBS(file)

dim d as new Dictionary
d.Value(c.kCGImageSourceThumbnailMaxPixelSize)=200
d.Value(c.kCGImageSourceCreateThumbnailFromImageIfAbsent)=true

dim img as CGImageMBS = c.CreateThumbnailAtIndex(0,d)

Backdrop=img.Picture

index: The index that specifies the location of the image. The index is zero-based.

options: A dictionary that specifies additional creation options.

Returns a CGImageMBS.

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. You must, however, pass an options dictionary that contains either the kCGImageSourceCreateThumbnailFromImageIfAbsent or kCGImageSourceCreateThumbnailFromImageAlways keys, with the value of the key set to TRUE.

Available in Mac OS X version 10.4 and later.

Some examples using this method:

CGImageSourceMBS.Properties(options as dictionary = nil) as dictionary

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreGraphics MBS MacCG Plugin 9.5 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the properties of the image source.
Example
dim inputfile as FolderItem = SpecialFolder.Desktop.Child("test.jpg")

// reading the picture
dim c as new CGImageSourceMBS(inputfile)
dim img as CGImageMBS = c.CreateImageAtIndex(0)
dim propertiesGlobal as Dictionary = c.Properties
dim propertiesImage as Dictionary = c.PropertiesAtIndex(0)

dim outputFile as FolderItem = SpecialFolder.Desktop.Child("output.jpg")
dim d as new CGImageDestinationMBS(outputFile, "public.jpeg", 1)

// writing the picture and include metadata
d.SetProperties(propertiesGlobal)
d.AddImage(img, propertiesImage)
if d.FinalizeMT then
outputFile.Launch
else
MsgBox "Failed to write jpeg."
end if

options: A dictionary you can use to request additional options.
Returns a dictionary that contains the properties associated with the image source container.
These properties apply to the container in general but not necessarily to any individual image contained in the image source.
Available in Mac OS X version 10.4 and later.

CGImageSourceMBS.PropertiesAtIndex(index as Integer, options as dictionary = nil) as dictionary

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreGraphics MBS MacCG Plugin 9.5 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the properties of the image at a specified location in an image source.
Example
dim file as FolderItem = SpecialFolder.Desktop.Child("test.jpg")
dim c as new CGImageSourceMBS(file)

dim d as Dictionary = c.PropertiesAtIndex(0)

dim e as Dictionary
e=d.Value(c.kCGImagePropertyExifDictionary)

if e<>Nil then
dim keys(-1) as Variant = e.Keys
dim lines(-1) as string

for each key as string in keys
lines.Append key+": "+e.Value(key)
next

MsgBox "Exif: "+EndOfLine+EndOfLine+Join(lines,EndOfLine)
end if

e=d.Value(c.kCGImagePropertyGPSDictionary)

if e<>Nil then
dim keys(-1) as Variant = e.Keys
dim lines(-1) as string

for each key as string in keys
lines.Append key+": "+e.Value(key)
next

MsgBox "GPS: "+EndOfLine+EndOfLine+Join(lines,EndOfLine)
end if

index: The index of the image whose properties you want to obtain. The index is zero-based.
options: A dictionary you can use to request additional options.
Returns a dictionary that contains the properties associated with the image.
Available in Mac OS X version 10.4 and later.

Some examples using this method:

CGImageSourceMBS.PropertiesAtIndexCF(index as Integer, options as Variant = nil) as Variant

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreGraphics MBS MacCG Plugin 13.5 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the properties of the image at a specified location in an image source.

index: The index of the image whose properties you want to obtain. The index is zero-based.
options: A dictionary or CFDictionaryMBS you can use to request additional options.
Returns a CFDictionaryMBS that contains the properties associated with the image.
Available in Mac OS X version 10.4 and later.

CGImageSourceMBS.PropertiesCF(options as Variant = nil) as Variant

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreGraphics MBS MacCG Plugin 13.5 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the properties of the image source.

options: A dictionary or CFDictionaryMBS you can use to request additional options.
Returns a CFDictionaryMBS that contains the properties associated with the image source container.
These properties apply to the container in general but not necessarily to any individual image contained in the image source.
Available in Mac OS X version 10.4 and later.

CGImageSourceMBS.StatusAtIndex(index as Integer) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreGraphics MBS MacCG Plugin 9.5 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the current status of an image that is at a specified location in an image source.

index: The index of the image whose status you want to obtain. The index is zero-based.

Returns the current status of the image.

The status is particularly informative for incremental image sources, but may also be used by clients that provide non-incremental data.

Available in Mac OS X version 10.4 and later.

CGImageSourceMBS.UpdateData(data as string, final as boolean)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreGraphics MBS MacCG Plugin 9.5 ✅ Yes ❌ No ❌ No ✅ Yes All
Updates an incremental image source with new data.

data: The data to add to the image source. Each time you call the function UpdateData, the data parameter must contain all of the image file data accumulated so far.

final: A value that specifies whether the data is the final set. Pass true if it is, false otherwise.

Available in Mac OS X version 10.4 and later.

The items on this page are in the following plugins: MBS MacCG Plugin.


The biggest plugin in space...