Bug 68965 - pdftocairo -svg generates svg with inverted nested jpeg image
Summary: pdftocairo -svg generates svg with inverted nested jpeg image
Status: RESOLVED FIXED
Alias: None
Product: cairo
Classification: Unclassified
Component: svg backend (show other bugs)
Version: unspecified
Hardware: All All
: medium major
Assignee: Emmanuel Pacaud
QA Contact: cairo-bugs mailing list
URL:
Whiteboard:
Keywords:
: 101699 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-09-05 06:38 UTC by Steve Yakovenko
Modified: 2017-07-05 22:01 UTC (History)
3 users (show)

See Also:
i915 platform:
i915 features:


Attachments
original file (299.02 KB, application/pdf)
2013-09-05 06:38 UTC, Steve Yakovenko
Details
svg file with inverted nested jpg image (450.45 KB, image/svg+xml)
2013-09-05 06:39 UTC, Steve Yakovenko
Details
Ok image, converted from original with -png flag (335.73 KB, image/png)
2013-09-05 06:39 UTC, Steve Yakovenko
Details
Nested jpeg, base64 decoded from svg file (42.35 KB, text/plain)
2013-09-06 11:59 UTC, Steve Yakovenko
Details
PDF which comes out with colours inverted in SVG (61.56 KB, application/pdf)
2014-09-23 14:34 UTC, David Hedley
Details

Description Steve Yakovenko 2013-09-05 06:38:15 UTC
Created attachment 85226 [details]
original file

If you convert supplied pdf with -svg flag, you will get partially inverted svg image. If you convert to -png, then the result is ok. This looks like a bug somwhere in poppler.
Comment 1 Steve Yakovenko 2013-09-05 06:39:02 UTC
Created attachment 85227 [details]
svg file with inverted nested jpg image
Comment 2 Steve Yakovenko 2013-09-05 06:39:51 UTC
Created attachment 85228 [details]
Ok image, converted from original with -png flag
Comment 3 Adrian Johnson 2013-09-05 22:37:35 UTC
This is a cairo bug. Poppler doesn't treat cairo SVG output any differently to the other vector outputs.
Comment 4 Adrian Johnson 2013-09-05 22:42:22 UTC
The jpeg image is a CMYK image. None of the SVG viewers I tried support CMYK jpegs. I've updated the SVG surface to disable embedding of CMYK Jpegs so it will fallback to embedding an RGB PNG image.
Comment 5 Steve Yakovenko 2013-09-06 11:59:23 UTC
Created attachment 85324 [details]
Nested jpeg, base64 decoded from svg file
Comment 6 Steve Yakovenko 2013-09-06 12:02:30 UTC
Dear Adrian!

I've extracted jpg file from svg file, using base64 utility. It looks like it is not fault of svg viewer. File itselft is inverted. I tried Ifranview and windows picture viewer, both of them show it inverted. Can you comment this?
Comment 7 Adrian Johnson 2013-09-06 21:50:08 UTC
I opened your extracted jpeg with Windows viewer and Irfanview on Windows and eog and gimp on Linux. The image is not upside down.

You are also looking at the old svg output. Cairo now embeds a png file for this pdf file.
Comment 8 Steve Yakovenko 2013-09-06 22:04:54 UTC
I am sorry, I don't understand, there is some sort of confusion. The problem is not that image is upside down. The problem is that image is inverted. Original pdf has white background and extracted jpg has black ground. This is what I call inversion. Can you please confirm this?
Comment 9 Adrian Johnson 2013-09-06 22:27:50 UTC
The jpeg is in CMYK format. If the viewer doesn't understand CMYK (and most don't) it will interpret the CMY values as RGB. An approximate conversion between RGB and CMY is:

C = 1 - R
Y = 1 - G
M = 1 - B

So interpreting the CMY as RGB will appear to "invert" the colors.
Comment 10 poh 2014-01-23 12:50:42 UTC
Was this actually fixed?

The issue seems to still be there in version 0.24.5.
Comment 11 Adrian Johnson 2014-01-23 19:15:40 UTC
(In reply to comment #10)
> Was this actually fixed?
> 
> The issue seems to still be there in version 0.24.5.

It has been fixed in cairo git:

http://cgit.freedesktop.org/cairo/commit/?id=f52165a7bb3de56fe2a06771f554f3997e176b94

A new version of cairo with this fix has not yet been released.
Comment 12 David Hedley 2014-09-23 14:34:24 UTC
Created attachment 106742 [details]
PDF which comes out with colours inverted in SVG
Comment 13 David Hedley 2014-09-23 14:35:20 UTC
Even with the given patch, the PDF attached above comes out with colours inverted in SVG
Comment 14 David Hedley 2014-09-23 14:41:55 UTC
*** Bug 80719 has been marked as a duplicate of this bug. ***
Comment 15 Adrian Johnson 2014-09-24 11:55:31 UTC
Problem is in poppler. See bug 80719.
Comment 16 Allan Dyer 2015-11-20 11:21:54 UTC
*** Bug 93031 has been marked as a duplicate of this bug. ***
Comment 17 Adrian Johnson 2017-07-05 22:01:52 UTC
*** Bug 101699 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.