NSBitmapImageRep
An object that renders an image from bitmap data.
Declaration
class NSBitmapImageRepOverview
Supported bitmap data formats include GIF, JPEG, TIFF, PNG, and various permutations of raw bitmap data.
Alpha Premultiplication and Bitmap Formats
When creating a bitmap using a premultiplied format, if a coverage (alpha) plane exists, the bitmap’s color components are premultiplied with it. In this case, if you modify the contents of the bitmap, you are therefore responsible for premultiplying the data. Note that premultiplying generally has negligible effect on output quality. For floating-point image data, premultiplying color components is a lossless operation, but for fixed-point image data, premultiplication can introduce small rounding errors. In either case, more rounding errors may appear when compositing many premultiplied images; however, such errors are generally not readily visible.
For this reason, you should not use an NSBitmapImageRep object if you want to manipulate image data. To work with data that is not premultiplied, use the Core Graphics framework instead. (Specifically, create images using the init(width:height:bitsPerComponent:bitsPerPixel:bytesPerRow:space:bitmapInfo:provider:decode:shouldInterpolate:intent:) function and CGImageAlphaInfo.last parameter.) Alternatively, include the NSAlphaNonpremultipliedBitmapFormat flag when creating the bitmap.
Topics
Creating Bitmap Representations of Images
imageReps(with:)colorize(byMappingGray:to:blackMapping:whiteMapping:)init(bitmapDataPlanes:pixelsWide:pixelsHigh:bitsPerSample:samplesPerPixel:hasAlpha:isPlanar:colorSpaceName:bitmapFormat:bytesPerRow:bitsPerPixel:)init(bitmapDataPlanes:pixelsWide:pixelsHigh:bitsPerSample:samplesPerPixel:hasAlpha:isPlanar:colorSpaceName:bytesPerRow:bitsPerPixel:)init(cgImage:)init(ciImage:)init(data:)init(forIncrementalLoad:)init(focusedViewRect:)
Getting Information About Images
bitmapFormatNSBitmapImageRep.FormatbitsPerPixelbytesPerPlanebytesPerRowisPlanarnumberOfPlanessamplesPerPixel
Getting the Bitmap Data
Producing Other Representations of Images
tiffRepresentationOfImageReps(in:)tiffRepresentationOfImageReps(in:using:factor:)tiffRepresentationtiffRepresentation(using:factor:)representationOfImageReps(in:using:properties:)representation(using:properties:)NSDrawBitmap(_:_:_:_:_:_:_:_:_:_:_:)
Managing Compression Types
getTIFFCompressionTypes(_:count:)localizedName(forTIFFCompressionType:)canBeCompressed(using:)setCompression(_:factor:)getCompression(_:factor:)setProperty(_:withValue:)value(forProperty:)NSBitmapImageRep.TIFFCompressionNSBitmapImageRep.PropertyKey