unidoc / unipdf

Golang PDF library for creating and processing PDF files (pure go)
https://unidoc.io
Other
2.58k stars 251 forks source link

[BUG] Unable to convert pdf images to grayscale "invalidBitsPerComponent" #570

Open rcorry opened 2 hours ago

rcorry commented 2 hours ago

Description

Following this example from the documentation, an xobject is failing to convert to an image due to an invalid number of bits per component, in this case the error says there are 4. When printing out the value of the ximg.BitsPerComponent I can see the value is actually 8. This results in an error and the pdf is not converted to grayscale.

Expected Behavior

The xobject should be converted to an image and subsequently converted to grayscale before being added back to the pdf.

Actual Behavior

Steps to reproduce the behavior:

  1. Run this example code
  2. Convert the attached file, passing it in as the first argument
  3. See error

Attachments

test.pdf

github-actions[bot] commented 2 hours ago

Welcome! Thanks for posting your first issue. The way things work here is that while customer issues are prioritized, other issues go into our backlog where they are assessed and fitted into the roadmap when suitable. If you need to get this done, consider buying a license which also enables you to use it in your commercial products. More information can be found on https://unidoc.io/