setCompression(_:factor:)
Sets the bitmap image representation’s compression type and compression factor.
Declaration
func setCompression(_ compression: NSBitmapImageRep.TIFFCompression, factor: Float)Parameters
- compression:
An
enumconstant that identifies one of the supported compression types as described in Tiffcompression. - factor:
A floating point value that is specific to the compression type. Many types of compression don’t support varying degrees of compression and thus ignore
factor. JPEG compression allows a compression factor ranging from 0.0 to 1.0, with 0.0 being the lowest and 1.0 being the highest.
Discussion
When an NSBitmapImageRep is created, the instance stores the compression type and factor for the source data. The tiffRepresentation property and tiffRepresentationOfImageReps(in:) class method try to use the stored compression type and factor. Use this method to change the compression type and factor.