Skip to content

Struggling with fitz.Pixmap (RuntimeError: unknown image file format) #973

Answered by JorjMcKie
axlgit asked this question in Q&A
Discussion options

You must be logged in to vote

bad samples length

This error means width * height * (n + alpha) does not equal the length of the bytes object, which is used as samples in the constructor.
The factor (n + alpha) means: n = 3 for RGB, 1 for GRAY, 4 for CMYK, alpha is 0 or 1 depending on whether an alpha channel is present.

Replies: 2 comments 8 replies

Comment options

You must be logged in to vote
2 replies
@JorjMcKie
Comment options

@axlgit
Comment options

Comment options

You must be logged in to vote
6 replies
@JorjMcKie
Comment options

@JorjMcKie
Comment options

@axlgit
Comment options

@JorjMcKie
Comment options

@axlgit
Comment options

Answer selected by axlgit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants