diff --git a/CHANGELOG.md b/CHANGELOG.md index 56ef61b..d800735 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/). +## [0.7.4] - [unreleased] + +### Fixed + +- Fix `PageImage` conversions for PDFs with `cmyk` colorspaces; convert them to `rgb` earlier in the process. + ## [0.7.3] - 2022-07-18 ### Fixed diff --git a/pdfplumber/display.py b/pdfplumber/display.py index 1d8c1d8..a00cb28 100644 --- a/pdfplumber/display.py +++ b/pdfplumber/display.py @@ -51,10 +51,15 @@ def get_page_image(stream: BufferedReader, page_no: int, resolution: int) -> Wan def postprocess(img: WandImage) -> WandImage: return WandImage(image=img.sequence[page_no]) - with WandImage(resolution=resolution, filename=filename, file=file) as img_init: + with WandImage( + resolution=resolution, filename=filename, file=file, colorspace="rgb" + ) as img_init: img = postprocess(img_init) with WandImage( - width=img.width, height=img.height, background=WandColor("white") + width=img.width, + height=img.height, + background=WandColor("white"), + colorspace="rgb", ) as bg: bg.composite(img, 0, 0) im = PIL.Image.open(BytesIO(bg.make_blob("png")))