JpegComponents

class JpegComponents(val width: Int, val height: Int, val componentCount: Int, val samples: ByteArray, val adobeTransform: Int)(source)

The samples of a JPEG as the file stores them: every component after the inverse DCT and the upsampling, before any color conversion. ImageKodec.decodeJpegComponents returns it.

Nothing is inverted, transformed or multiplied in. A three-component file usually stores YCbCr, a four-component one CMYK or YCCK in Adobe's inverted convention, and the caller decides how to read them, for instance from adobeTransform or, in a PDF, from the image dictionary's ColorTransform and Decode entries. Run through ImageKodec.decode's own color conversion, these samples give exactly the pixels of ImageKodec.decodeReduced at the same reduction.

Throws

if a side is not positive, componentCount is not 1, 3 or 4, samples does not hold componentCount bytes for each pixel, or adobeTransform is outside -1 to 255

Constructors

Link copied to clipboard
constructor(width: Int, height: Int, componentCount: Int, samples: ByteArray, adobeTransform: Int)

Properties

Link copied to clipboard

the transform flag of the last Adobe APP14 marker: 0 for none (RGB or CMYK), 1 for YCbCr and 2 for YCCK. A file may store another value, which is passed on as it is, 0 to 255. -1 when the file has no Adobe marker.

Link copied to clipboard

1, 3 or 4

Link copied to clipboard
val height: Int

rows, after the reduction

Link copied to clipboard

componentCount bytes per pixel, row by row, the components of a pixel in the order the frame header lists them. Exposed directly, not copied: treat it as read-only.

Link copied to clipboard
val width: Int

pixels per row, after the reduction

Functions

Link copied to clipboard
operator fun get(x: Int, y: Int, component: Int): Int

The sample of component at (x, y), 0 to 255.

Link copied to clipboard
open override fun toString(): String