Bug 80719 - pdftocairo -svg renders a jpeg image with inverted color
Summary: pdftocairo -svg renders a jpeg image with inverted color
Status: RESOLVED FIXED
Alias: None
Product: poppler
Classification: Unclassified
Component: cairo backend (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: poppler-bugs
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-06-30 15:56 UTC by Duan Yao
Modified: 2015-11-20 08:36 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
PDF file contains a jpeg image in DeviceN colorspace (25.66 KB, text/plain)
2014-06-30 15:56 UTC, Duan Yao
Details
the output of pdftocairo -svg, color is inverted (29.94 KB, text/plain)
2014-06-30 15:58 UTC, Duan Yao
Details
only embed mime data for gray/rgb/cmyk colorspaces (3.23 KB, patch)
2014-09-24 11:54 UTC, Adrian Johnson
Details | Splinter Review
only embed mime data for gray/rgb/cmyk colorspaces (3.29 KB, patch)
2014-09-24 23:00 UTC, Adrian Johnson
Details | Splinter Review
only embed mime data if decode map is identity (2.84 KB, patch)
2014-10-06 00:02 UTC, Adrian Johnson
Details | Splinter Review
only embed mime data if decode map is identity (2.89 KB, patch)
2014-10-07 10:14 UTC, Adrian Johnson
Details | Splinter Review

Description Duan Yao 2014-06-30 15:56:57 UTC
Created attachment 102020 [details]
PDF file contains a jpeg image in DeviceN colorspace

The attached PDF file contains a jpeg image in DeviceN colorspace, whose alternate colorspace is DeviceRGB.

After converted to svg, the image's displayed color is inverted, i.e. white becomes black, and black becomes white.

Other output format like png looks correct.

I build poppler from 8a5e59c6ea7ccd0ecbdb4b37bf3fe4e74e1c0e8e.
Comment 1 Duan Yao 2014-06-30 15:58:33 UTC
Created attachment 102021 [details]
the output of pdftocairo -svg, color is inverted
Comment 2 David Hedley 2014-09-23 14:41:55 UTC

*** This bug has been marked as a duplicate of bug 68965 ***
Comment 3 Adrian Johnson 2014-09-24 11:54:27 UTC
Created attachment 106787 [details] [review]
only embed mime data for gray/rgb/cmyk colorspaces
Comment 4 Adrian Johnson 2014-09-24 23:00:12 UTC
Created attachment 106818 [details] [review]
only embed mime data for gray/rgb/cmyk colorspaces

Update to fix a leak.
Comment 5 Adrian Johnson 2014-10-06 00:02:11 UTC
Created attachment 107384 [details] [review]
only embed mime data if decode map is  identity

This patch fixes another issue with setMimeData(). The mime data should not be embedded if the decode map is anything other than [0 1 0 1 ... ]
Comment 6 Carlos Garcia Campos 2014-10-06 16:32:07 UTC
Comment on attachment 107384 [details] [review]
only embed mime data if decode map is  identity

Review of attachment 107384 [details] [review]:
-----------------------------------------------------------------

::: poppler/CairoOutputDev.cc
@@ +2719,5 @@
> +  // only embed mime data if image decode map is identiy
> +  for (i = 0; i < colorMap->getNumPixelComps(); i++) {
> +    if (colorMap->getDecodeLow(i) != 0.0 || colorMap->getDecodeHigh(i) != 1.0)
> +      return;
> +  }

Looks good, maybe we could add a helper method for this, and we don't need the comment to explain it. something like:

if (!colorMapHasIdentityDecodeMap(colorMap))
  return;

Or something similar.
Comment 7 Adrian Johnson 2014-10-07 10:14:35 UTC
Created attachment 107470 [details] [review]
only embed mime data if decode map is identity
Comment 8 Carlos Garcia Campos 2014-10-07 16:07:09 UTC
Comment on attachment 107470 [details] [review]
only embed mime data if decode map is identity

Review of attachment 107470 [details] [review]:
-----------------------------------------------------------------

Perfect, thanks!
Comment 9 Adrian Johnson 2014-10-07 20:17:06 UTC
Pushed.
Comment 10 Adrian Johnson 2015-11-20 08:36:18 UTC
*** Bug 93031 has been marked as a duplicate of this bug. ***


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.