WeasyPrint icon indicating copy to clipboard operation
WeasyPrint copied to clipboard

Image prints with black background

Open wesleyi23 opened this issue 5 years ago • 6 comments

I am trying to use Weasyprint to generate pdf reports for a Django web application. The HTML file the report is based on has images in base 64, some of the images generate with a black background instead of a white background. I am trying to understand where this issue might be or how to go about correcting it. Does anyone have any ideas where to start?

wesleyi23 avatar May 27 '20 17:05 wesleyi23

Hello!

Could you please provide an example?

liZe avatar May 27 '20 17:05 liZe

Sure. Here is an example HTML file (saved as a txt file): example.txt

wesleyi23 avatar May 27 '20 17:05 wesleyi23

Looks like a problem with CMYK, really like #315. It was supposed to be fixed in Cairo 1.15.4, I don’t know why it’s still there with 1.16.

liZe avatar May 27 '20 21:05 liZe

Hey thanks! I will double check to make sure I have the latest version of Cairo and post back what I find tomorrow.

wesleyi23 avatar May 27 '20 21:05 wesleyi23

Looks like a problem with CMYK, really like #315. It was supposed to be fixed in Cairo 1.15.4, I don’t know why it’s still there with 1.16.

Here is why: the fix has been reverted.

Hopefully Cairo is soon gone forever.

A quick workaround is to save your JPG file as RGB.

liZe avatar May 27 '20 21:05 liZe

The bug remains, even without Cairo.

liZe avatar Sep 16 '21 16:09 liZe