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

你离开我真会死。 提交于 2019-12-24 08:26:55

问题


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?


回答1:


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.




回答2:


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.




回答3:


No, it translates into bits per color channel. When you have a grayscale image this is essentially bits per pixel as well.

When you have an RGB image with 16 bits per channel you have a total of 48 bits per pixel (or even 64 if you have an alpha channel, too).




回答4:


There are already lots of tools out there which can convert PDFs to images. If you want to write your own, you are going to have to learn a huge spec and build a rasterizer. Why do you need to build a custom solution?



来源:https://stackoverflow.com/questions/757265/how-does-pdfs-bitspercomponent-translate-to-bits-per-pixel-for-images

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!