Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does PDF's BitsPerComponent translate to Bits Per Pixel for images?

My goal is to convert a PDF into an image (specifically in TIFF).

There is a PDF property called BitsPerComponent

And According to description on the page,

This property can take the value 1, 2, 4, 8 or 16. Other values are not supported in the PDF Specification

Does that mean, 1, 2, 4, 8 or 16 translates to bits per pixel in images?

like image 394
dance2die Avatar asked Dec 29 '25 11:12

dance2die


2 Answers

Sounds more like bits per color component, where color component is one of either (Alpha)/Red/Green/Blue or Grey. So take the bits per component and multiply by the components per pixel to get bits per pixel. For example, if you're talking an RGB image you have 3 components. An RGB at 8 bit per component would be a 8 * 3 = 24bit per pixel image. If it was greyscale, e.g. one component, an 8 bit per component would be 8 bit per pixel.

like image 99
Chris Hynes Avatar answered Jan 01 '26 17:01

Chris Hynes


BitsPerPixel = 3 * BitsPerComponent if the color is stored as RGB

BitsPerPixel = 4 * BitsPerComponent if the color is stored as RGB with an alpha channel (ARGB)

RGB is a random assumption ... this will hold for every color model using 3 components and may be a alpha chanel. It will be BitsPerPixel = BitsPerComponent if it is a gray scale image.

like image 38
Daniel Brückner Avatar answered Jan 01 '26 18:01

Daniel Brückner