From f79ad56f4872d510e9e06071e420cf644a7e4e48 Mon Sep 17 00:00:00 2001 From: pettzilla1 <97901734+pettzilla1@users.noreply.github.com> Date: Mon, 8 Aug 2022 21:35:53 +0100 Subject: [PATCH] Fix ValueError when bmp images with 1 bit channels are decoded (fixes #773) (#784) * Update utils.py bitspercomponent =1 is defined and stores as a .btm worked when I tested it * Update utils.py () replaced with [] * Update CHANGELOG.md added changes for pull request * Update for flake * Update CHANGELOG.md * Update CHANGELOG.md Co-authored-by: Pieter Marsman --- CHANGELOG.md | 1 + pdfminer/utils.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dc3ec73..d0702a1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Fixed +- 'ValueError': when bmp images with 1 bit channel are decoded ([#773](https://github.com/pdfminer/pdfminer.six/issues/773)) - `ValueError` when trying to decrypt empty metadata values ([#766](https://github.com/pdfminer/pdfminer.six/issues/766)) - Sphinx errors during building of documentation ([#760](https://github.com/pdfminer/pdfminer.six/pull/760)) - `TypeError` when getting default width of font ([#720](https://github.com/pdfminer/pdfminer.six/issues/720)) diff --git a/pdfminer/utils.py b/pdfminer/utils.py index 599d57b..59cf5cd 100644 --- a/pdfminer/utils.py +++ b/pdfminer/utils.py @@ -132,7 +132,7 @@ def apply_png_predictor( Documentation: http://www.libpng.org/pub/png/spec/1.2/PNG-Filters.html """ - if bitspercomponent != 8: + if bitspercomponent not in [8, 1]: msg = "Unsupported `bitspercomponent': %d" % bitspercomponent raise ValueError(msg)