Platforms to show: All Mac Windows Linux Cross-Platform

Back to CGImageDestinationMBS class.

CGImageDestinationMBS.kCGImageDestinationBackgroundColor as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method CoreGraphics MBS MacCG Plugin 9.5 ✅ Yes ❌ No ❌ No ✅ Yes All
One of the constant for the image destination properties.

The desired background color to composite against when writing an image that has an alpha component to a destination format that does not support alpha. If present, the value associated with this key must be a CGColorRef data type without an alpha component of its own. If not present, and if a background color is needed, a white color is used.

Available in Mac OS X v10.4 and later.

CGImageDestinationMBS.kCGImageDestinationDateTime as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method CoreGraphics MBS MacCG Plugin 13.1 ✅ Yes ❌ No ❌ No ✅ Yes All
One of the constant for the image destination properties.

Updates the DateTime parameters of the image metadata. Only values present in the original image will updated. If present, the value should be a String or a Date. If String, the value must be in Exif DateTime or ISO 8601 DateTime format. This option is mutually exclusive with kCGImageDestinationMetadata.

CGImageDestinationMBS.kCGImageDestinationEmbedThumbnail as string   New in 25.5

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method CoreGraphics MBS MacCG Plugin 25.5 ✅ Yes ❌ No ❌ No ✅ Yes All
One of the constant for the image destination properties.

Enable or disable thumbnail embedding for JPEG and HEIF.
The value should be a boolean, true or false. Defaults to false.

CGImageDestinationMBS.kCGImageDestinationEncodeAlternateColorSpace as string   New in 25.5

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method CoreGraphics MBS MacCG Plugin 25.5 ✅ Yes ❌ No ❌ No ✅ Yes All
One of the constant for the image destination properties.

One of the encode options.

CGImageDestinationMBS.kCGImageDestinationEncodeBaseColorSpace as string   New in 25.5

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method CoreGraphics MBS MacCG Plugin 25.5 ✅ Yes ❌ No ❌ No ✅ Yes All
One of the constant for the image destination properties.

One of the encode options.

CGImageDestinationMBS.kCGImageDestinationEncodeBaseIsSDR as string   New in 25.5

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method CoreGraphics MBS MacCG Plugin 25.5 ✅ Yes ❌ No ❌ No ✅ Yes All
One of the constant for the image destination properties.

One of the encode options.

CGImageDestinationMBS.kCGImageDestinationEncodeBasePixelFormatRequest as string   New in 25.5

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method CoreGraphics MBS MacCG Plugin 25.5 ✅ Yes ❌ No ❌ No ✅ Yes All
One of the constant for the image destination properties.

One of the encode options.

CGImageDestinationMBS.kCGImageDestinationEncodeGainMapPixelFormatRequest as string   New in 25.5

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method CoreGraphics MBS MacCG Plugin 25.5 ✅ Yes ❌ No ❌ No ✅ Yes All
One of the constant for the image destination properties.

One of the encode options.

CGImageDestinationMBS.kCGImageDestinationEncodeGainMapSubsampleFactor as string   New in 25.5

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method CoreGraphics MBS MacCG Plugin 25.5 ✅ Yes ❌ No ❌ No ✅ Yes All
One of the constant for the image destination properties.

One of the encode options.

CGImageDestinationMBS.kCGImageDestinationEncodeGenerateGainMapWithBaseImage as string   New in 25.5

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method CoreGraphics MBS MacCG Plugin 25.5 ✅ Yes ❌ No ❌ No ✅ Yes All
One of the constant for the image destination properties.

One of the encode options.

CGImageDestinationMBS.kCGImageDestinationEncodeIsBaseImage as string   New in 25.5

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method CoreGraphics MBS MacCG Plugin 25.5 ✅ Yes ❌ No ❌ No ✅ Yes All
One of the constant for the image destination properties.

One of the encode options.

CGImageDestinationMBS.kCGImageDestinationEncodeRequest as string   New in 25.5

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method CoreGraphics MBS MacCG Plugin 25.5 ✅ Yes ❌ No ❌ No ✅ Yes All
One of the constant for the image destination properties.

One of the encode options.

CGImageDestinationMBS.kCGImageDestinationEncodeRequestOptions as string   New in 25.5

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method CoreGraphics MBS MacCG Plugin 25.5 ✅ Yes ❌ No ❌ No ✅ Yes All
One of the constant for the image destination properties.

One of the encode options.

CGImageDestinationMBS.kCGImageDestinationEncodeToISOGainmap as string   New in 25.5

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method CoreGraphics MBS MacCG Plugin 25.5 ✅ Yes ❌ No ❌ No ✅ Yes All
One of the constant for the image destination properties.

One of the encode options.

CGImageDestinationMBS.kCGImageDestinationEncodeToISOHDR as string   New in 25.5

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method CoreGraphics MBS MacCG Plugin 25.5 ✅ Yes ❌ No ❌ No ✅ Yes All
One of the constant for the image destination properties.

One of the encode options.

CGImageDestinationMBS.kCGImageDestinationEncodeTonemapMode as string   New in 25.5

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method CoreGraphics MBS MacCG Plugin 25.5 ✅ Yes ❌ No ❌ No ✅ Yes All
One of the constant for the image destination properties.

One of the encode options.

CGImageDestinationMBS.kCGImageDestinationEncodeToSDR as string   New in 25.5

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method CoreGraphics MBS MacCG Plugin 25.5 ✅ Yes ❌ No ❌ No ✅ Yes All
One of the constant for the image destination properties.

One of the encode options.

CGImageDestinationMBS.kCGImageDestinationImageMaxPixelSize as string   New in 25.5

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method CoreGraphics MBS MacCG Plugin 25.5 ✅ Yes ❌ No ❌ No ✅ Yes All
One of the constant for the image destination properties.

Rescale the image to the maximum width and height in pixels.
If present, this value of this key must be a number.

CGImageDestinationMBS.kCGImageDestinationLossyCompressionQuality as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method CoreGraphics MBS MacCG Plugin 9.5 ✅ Yes ❌ No ❌ No ✅ Yes All
One of the constant for the image destination properties.

The desired compression quality to use when writing to an image destination. If present, the value associated with this key must be a double in the range 0.0 to 1.0. A value of 1.0 specifies to use lossless compression if destination format supports it. A value of 0.0 implies to use maximum compression.

Available in Mac OS X v10.4 and later.

Some examples using this method:

CGImageDestinationMBS.kCGImageDestinationMergeMetadata as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method CoreGraphics MBS MacCG Plugin 13.1 ✅ Yes ❌ No ❌ No ✅ Yes All
One of the constant for the image destination properties.
Example
// Change rotation in an image file

// files
Var dpath as folderitem = SpecialFolder.Desktop.Child("test.jpg")
Var opath as folderitem = dpath.parent.Child("output.jpg")

// open source
Var imageSource as new cgimagesourcembs(dpath)

// read image
Var img as cgimagembs = imageSource.createimageatindex(0)

// global properties
Var globalprop as dictionary = imageSource.properties
// per image properties
Var p as Dictionary = imageSource.PropertiesAtIndex(0)

Var imageDest as new CGImageDestinationMBS(opath,"public.jpeg",1)

'const orientation = 1 // top left
const orientation = 3 // bottom right

// set globals
imageDest.SetProperties(globalprop)

// now set new orientation
p.value(imageDest.kCGImageDestinationOrientation) = orientation
p.value(imageDest.kCGImageDestinationMergeMetadata) = true

// change tiff dictionary, if present
Var dTIFF as Dictionary = p.lookup(imageSource.kCGImagePropertyTIFFDictionary, nil)
if dTIFF <> nil then
dTIFF.value(imageSource.kCGImagePropertyTIFFOrientation) = orientation
end if

// change iptc dictionary, if present
Var dIPTC as Dictionary = p.lookup(imageSource.kCGImagePropertyIPTCDictionary, nil)
if dIPTC <> nil then
dIPTC.value(imageSource.kCGImagePropertyIPTCImageOrientation) = orientation
end if

// write out image
imageDest.AddImage(img,p)
call imageDest.Finalize

If true, The metadata will be copied from the source and merged with the tags specified in kCGImageDestinationMetadata. If a tag does not exist in the source, it will be added. If the tag exists in the source, it will be updated. A metadata tag can be removed by setting the tag's value to nil. If present, the value of this key is a Boolean. The default is False.

CGImageDestinationMBS.kCGImageDestinationMetadata as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method CoreGraphics MBS MacCG Plugin 13.1 ✅ Yes ❌ No ❌ No ✅ Yes All
One of the constant for the image destination properties.

Set the metadata tags for the image destination. If present, the value of this key is a CGImageMetadata. By default, all EXIF, IPTC, and XMP tags will be replaced. Use kCGImageDestinationMergeMetadata to merge the tags with the existing tags in the image source.

CGImageDestinationMBS.kCGImageDestinationOptimizeColorForSharing as string   New in 25.5

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method CoreGraphics MBS MacCG Plugin 25.5 ✅ Yes ❌ No ❌ No ✅ Yes All
One of the constant for the image destination properties.

Create an image using a colorspace, that has is compatible with older devices
The value should be True or False
Defaults to False = don't do any color conversion

CGImageDestinationMBS.kCGImageDestinationOrientation as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method CoreGraphics MBS MacCG Plugin 13.1 ✅ Yes ❌ No ❌ No ✅ Yes All
One of the constant for the image destination properties.
Example
// Change rotation in an image file

// files
Var dpath as folderitem = SpecialFolder.Desktop.Child("test.jpg")
Var opath as folderitem = dpath.parent.Child("output.jpg")

// open source
Var imageSource as new cgimagesourcembs(dpath)

// read image
Var img as cgimagembs = imageSource.createimageatindex(0)

// global properties
Var globalprop as dictionary = imageSource.properties
// per image properties
Var p as Dictionary = imageSource.PropertiesAtIndex(0)

Var imageDest as new CGImageDestinationMBS(opath,"public.jpeg",1)

'const orientation = 1 // top left
const orientation = 3 // bottom right

// set globals
imageDest.SetProperties(globalprop)

// now set new orientation
p.value(imageDest.kCGImageDestinationOrientation) = orientation
p.value(imageDest.kCGImageDestinationMergeMetadata) = true

// change tiff dictionary, if present
Var dTIFF as Dictionary = p.lookup(imageSource.kCGImagePropertyTIFFDictionary, nil)
if dTIFF <> nil then
dTIFF.value(imageSource.kCGImagePropertyTIFFOrientation) = orientation
end if

// change iptc dictionary, if present
Var dIPTC as Dictionary = p.lookup(imageSource.kCGImagePropertyIPTCDictionary, nil)
if dIPTC <> nil then
dIPTC.value(imageSource.kCGImagePropertyIPTCImageOrientation) = orientation
end if

// write out image
imageDest.AddImage(img,p)
call imageDest.Finalize

Updates the orientation in the image metadata. The image data itself will not be rotated. If present, the value should be a Integer from 1 to 8. This option is mutually exclusive with kCGImageDestinationMetadata.

CGImageDestinationMBS.kCGImageDestinationPreserveGainMap as string   New in 25.5

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method CoreGraphics MBS MacCG Plugin 25.5 ✅ Yes ❌ No ❌ No ✅ Yes All
One of the constant for the image destination properties.

For CGImageDestinationAddImageFromSource: when set to True, a HEIF-embedded GainMap will be preserved.
If the destination image is scaled (using kCGImageDestinationImageMaxPixelSize), the GainMap will be scaled accordingly.
The value should be True or False
Defaults to False

CGImageDestinationMBS.kCGImageMetadataShouldExcludeGPS as string   New in 25.5

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method CoreGraphics MBS MacCG Plugin 25.5 ✅ Yes ❌ No ❌ No ✅ Yes All
One of the constant for the image destination properties.

If true, GPS metadata will not be written to EXIF data or the corresponding EXIF tags in XMP. This flag cannot filter any proprietary location data that could be stored in a manufacturer's EXIF MakerNote or custom XMP properties.
If present, the value for this key is a boolean. The default is False.

CGImageDestinationMBS.kCGImageMetadataShouldExcludeXMP as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method CoreGraphics MBS MacCG Plugin 13.1 ✅ Yes ❌ No ❌ No ✅ Yes All
One of the constant for the image destination properties.

XMP data will not be written to the destination. If used in conjunction with kCGImageDestinationMetadata, EXIF and/or IPTC tags will be preserved, but an XMP packet will not be written to the file. If present, the value for this key is a Boolean. The default is False.

CGImageDestinationMBS.kCGImagePropertyASTCBlockSize as string   New in 25.5

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method CoreGraphics MBS MacCG Plugin 25.5 ✅ Yes ❌ No ❌ No ✅ Yes All
One of the constant for the image destination properties.

For ASTC / KTX(ASTC) files: Specifies ASTC block size.
The value of this key must be either kCGImagePropertyASTCBlockSize4x4 or kCGImagePropertyASTCBlockSize8x8.

CGImageDestinationMBS.kCGImagePropertyASTCBlockSize4x4 as string   New in 25.5

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method CoreGraphics MBS MacCG Plugin 25.5 ✅ Yes ❌ No ❌ No ✅ Yes All
One of the constant for the image destination properties.

For ASTC / KTX(ASTC) files: Specifies ASTC block size.

CGImageDestinationMBS.kCGImagePropertyASTCBlockSize8x8 as string   New in 25.5

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method CoreGraphics MBS MacCG Plugin 25.5 ✅ Yes ❌ No ❌ No ✅ Yes All
One of the constant for the image destination properties.

For ASTC / KTX(ASTC) files: Specifies ASTC block size.

CGImageDestinationMBS.kCGImagePropertyASTCEncoder as string   New in 25.5

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method CoreGraphics MBS MacCG Plugin 25.5 ✅ Yes ❌ No ❌ No ✅ Yes All
One of the constant for the image destination properties.

One of the encoders for KTX files.

CGImageDestinationMBS.kCGImagePropertyBCEncoder as string   New in 25.5

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method CoreGraphics MBS MacCG Plugin 25.5 ✅ Yes ❌ No ❌ No ✅ Yes All
One of the constant for the image destination properties.

One of the encoders for KTX files.

CGImageDestinationMBS.kCGImagePropertyBCFormat as string   New in 25.5

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method CoreGraphics MBS MacCG Plugin 25.5 ✅ Yes ❌ No ❌ No ✅ Yes All
One of the constant for the image destination properties.

For BC / KTX(BC) / DDS files:
Specifies the specific pixel format to be encoded.
The value of this key must be an integer CFNumberRef, containing a OpenGL format enum.

CGImageDestinationMBS.kCGImagePropertyEncoder as string   New in 25.5

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method CoreGraphics MBS MacCG Plugin 25.5 ✅ Yes ❌ No ❌ No ✅ Yes All
One of the constant for the image destination properties.

For KTX files:
The key 'kCGImagePropertyEncoder' can be used with AddImage...() to specify the encoder to be used.

CGImageDestinationMBS.kCGImagePropertyPVREncoder as string   New in 25.5

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method CoreGraphics MBS MacCG Plugin 25.5 ✅ Yes ❌ No ❌ No ✅ Yes All
One of the constant for the image destination properties.

One of the encoders for KTX files.

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


The biggest plugin in space...