How does PDF BitsPerComponent translate into bits per pixel for images?

My goal is to convert PDF to image (in particular, to TIFF).

There is a PDF property called BitsPerComponent

And as described on the page

This property can be 1, 2, 4, 8, or 16. Other values ​​are not supported in the PDF specification.

Does this mean that 1, 2, 4, 8, or 16 is converted to bit per pixel in images?

+1
source share
4 answers

It sounds more like a beat on a color component, where the color component is one of (Alpha) / Red / Green / Blue or Gray. So take a bit by component and multiply by components by pixel to get a bit by pixel. For example, if you are talking about an RGB image, you have 3 components. RGB with 8 bits per component will be 8 * 3 = 24 bits per pixel of the image. If it's shades of gray, for example. one component, 8 bits per component will be 8 bits per pixel.

+3
source

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

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

RGB is a random assumption ... this will be done for each color model using 3 components and may be an alpha channel. This will be BitsPerPixel = BitsPerComponent if it is a grayscale image.

+3
source

No, it is converted to bits on a color channel. When you have an image in grayscale, it is essentially a bit per pixel.

If you have an RGB image with 16 bits per channel, you only have 48 bits per pixel (or even 64 if you have an alpha channel).

+2
source

There are already many tools that can convert PDF files to images. If you want to write your own, you will need to study the huge specification and create a rasterizer. Why do you need to create your own solution?

0
source

Source: https://habr.com/ru/post/1386159/


All Articles