Converts a Planar8 image to a Planar1 image.


func vImageConvert_Planar8toPlanar1(_ src: UnsafePointer<vImage_Buffer>, _ dest: UnsafePointer<vImage_Buffer>, _ tempBuffer: UnsafeMutableRawPointer!, _ dither: Int32, _ flags: vImage_Flags) -> vImage_Error



A pointer to the source vImage buffer object.


A pointer to the destination vImage buffer object. Because the source pixel format is smaller than a byte, there are multiple pixels in each byte of the data buffer. These pixels are interpreted as being in big endian order (that is, the low-indexed pixel is in the high-order bits of the byte).

Sub-byte indexing of scanlines is unsupported, because the data and rowBytes fields of the buffer are specified in whole bytes.

Widths, however, are measured in pixels, so a scanline may end in the middle of a byte. If this occurs, the contents of any unused bits of the final byte are ignored.


A pointer to temporary buffer for the routine to use for scratch space. If non-NULL, the buffer must be at least as large as the value returned by calling this function with the kvImageGetTempBufferSize flag. If NULL, this function will still work, but may allocate and free a scratch buffer internally.


Type of dithering, if any, to apply to the image.


The options to use when performing the operation. If you plan to perform your own tiling or use multithreading, pass kvImageDoNotTile.

Return Value

kvImageNoError; otherwise, one of the error codes described in Data Types and Constants.


This function supports the following dithering options:


This option applies no dithering. Input values are rounded to the nearest value representable in the destination format.


Precomputed blue noise is added to the image before the values are rounded to the destination format. The offset into the blue noise is randomized per call to avoid visible artifacts if you do your own tiling or call the function on sequential frames of video.


Precomputed blue noise is added to the image before the values are rounded to the destination format. The offset into the blue noise is the same for every call to allow users to get reproducible results.


Floyd-Steinberg dithering is applied to the image.


Atkinson dithering is applied to the image.

You can further influence the ordered dither methods by shaping the noise distribution using the Gaussian and uniform options below. These options are OR-ed with kvImageConvert_DitherOrdered or kvImageConvert_DitherOrderedReproducible:


When using an ordered dither pattern, distribute the noise according to a Gaussian distribution. This generally gives more pleasing images—less noisy and perhaps a little more saturated—but color fidelity can suffer. Its effect is between kvImageConvert_DitherNone and kvImageConvert_DitherOrdered | kvImageConvert_DitherUniform. This option is the default for kvImageConvert_DitherOrdered and kvImageConvert_DitherOrderedReproducible.


When using an ordered dither pattern, distribute the noise uniformly. This generally gives the best color fidelity, but the resulting image is noisier and more obviously dithered. This is usually the best choice when low bit depth content is drawn next to high bit depth content and in other circumstances where subtle changes to color arising from the conversion could be easily noticed. It may be a poor choice when the image is likely to be enlarged—which would cause the noise to become more evident—and for very flat or synthetic content with little inherent noise. You can avoid the enlargement problem by enlarging first at high bit depth, then converting to lower bit depth.

See Also

Converting Between Planar Formats

func vImageConvert_PlanarFtoPlanar8(UnsafePointer<vImage_Buffer>, UnsafePointer<vImage_Buffer>, Pixel_F, Pixel_F, vImage_Flags) -> vImage_Error

Converts a PlanarF image to a Planar8 image, clipping values to the provided minimum and maximum values.