Embedded raster image mirrored on PDF export

Bug #823274 reported by texnic
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Inkscape
Fix Released
Undecided
Unassigned

Bug Description

In the attached file, the raster BAHN logo in the upper right corner appears upside-down mirrored if viewed in Adobe Reader as well as Ubuntu document viewer, but in Inkscape it displays correctly, if at all (at some scales it's not visible at all).

Adobe Reader version 9.4.2.
Inkscape version 0.48.1 r9760.

Revision history for this message
texnic (kotya-karapetyan) wrote :
Revision history for this message
texnic (kotya-karapetyan) wrote :

The PDF file.

su_v (suv-lp)
tags: added: bitmap exporting importing pdf
Revision history for this message
su_v (suv-lp) wrote :

Could you provide more information about the PDF file?
- Which application was used to create it originally?
- Did you round-trip edit the PDF file in Inkscape? (open PDF, edit, save as PDF)
- Could you possibly attach an unedited version of the PDF file (without having been edited and resaved in Inkscape)?

Related reports:
Bug #168014 “Redraw fails with clipped object patterns”
    (causes the rendering issues of the embedded image in Inkscape 0.48.x)
Bug #189495 “Pdf import images upside down”
    (Inkscape built with older versions of cairo caused bitmap images to stored vertically flipped)
Bug #840625 “PDFs are imported with reflected embedded pictures”
    (PDFs with images embedded as pattern fills are flipped on import)

Changed in inkscape:
status: New → Incomplete
Revision history for this message
su_v (suv-lp) wrote :

Reproduced on Mac OS X 10.5.8 (i386):
- other PDF viewers (Apple's Preview, Xpdf 3.02, Evince 2.30.3) render the logo vertically flipped
- Inkscape 0.48.2 renders the logo as expected (upright) with the known rendering issues of clipped objects in pattern fills
- Inkscape 0.48+devel r10626 renders the logo expected (upright), though pixellized
- Inkscape 0.48+devel r10627 renders the logo vertically flipped, though pixellized

Revision history for this message
Alvin Penner (apenner) wrote :

yes, I just viewed trains.pdf in both Adobe Reader and Inkscape rev 10627, to confirm that both images are the same and that both are upside down.

I see that the trains.pdf file was created using Cairo 1.10.2. Would it be possible to get access to the original source file that it came from, so we can try to see why the image is upside down?

Revision history for this message
Alvin Penner (apenner) wrote :

sorry, I see now that the original file probably does not exist, since it is a website.

However, would it be possible to save the website as an .mht file, or as a zipped version of a complete saved webpage, so we can try to reproduce the problem?

Revision history for this message
texnic (kotya-karapetyan) wrote :

> Which application was used to create it originally?

I "printed" it from Firefox and have chosen "Print to file / Output PDF"

> Did you round-trip edit the PDF file in Inkscape? (open PDF, edit, save as PDF)

This time I make sure to not have done it.

> Could you possibly attach an unedited version of the PDF file (without having been edited and resaved in Inkscape)?

I attach three files: 1) initial PDF as printed from bahn.de. 2) file just opened in Inkscape and saved as PDF. 3) The web-site (it looks slightly different because apparently this web-site changes the layout just before sending to the printer, so print preview actually doesn't help).

Please let me know if I can be of any further help.

Revision history for this message
texnic (kotya-karapetyan) wrote :
Revision history for this message
texnic (kotya-karapetyan) wrote :
Revision history for this message
texnic (kotya-karapetyan) wrote :
Revision history for this message
texnic (kotya-karapetyan) wrote :

I have noticed that the exclamation mark in the top row of the table is also mirrored vertically.

Revision history for this message
Alvin Penner (apenner) wrote :

thanks for the new info. Using the file bahn.pdf, I get the following behaviour:

Inkscape 0.48.2:
- use Adobe Reader to confirm that the bitmaps are right side up.
- load bahn.pdf into Inkscape
- confirm that 2 images are upside down in Inkscape
- save as bahn2.pdf
- use Adobe Reader to confirm these two images are still upside down.
- load bahn2.pdf into Inkscape
- in this case the images initially appear in Inkscape but then sometimes disappear. However, when they do appear, depending on the zoom level, they are right side up.

Inkscape development build, rev 10627.
- use Adobe Reader to confirm that the bitmaps are right side up.
- load bahn.pdf into Inkscape
- confirm that 2 images are still right side up
- save as bahn2.pdf
- use Adobe Reader to confirm these two images are still right side up.
- load bahn2.pdf into Inkscape
- confirm that 2 images are still right side up.

Changed in inkscape:
status: Incomplete → Confirmed
Revision history for this message
su_v (suv-lp) wrote :

@texnic - your FIrefox seems to use a private copy of a quite old version of cairo ;)
The file 'bahn.pdf' was created with cairo 1.7.4 - which would confirm the findings in Bug #189495 (images embedded in PDF files may be flipped when opened in Inkscape if they had been created with older cairo versions).

What puzzles me is that without the patch in r10627 (0.48.2, r10626), Inkscape displays these PDF files correctly when opening them again ('trains.pdf') - i.e. somehow seems to compensates the flip (but no other PDF viewer does).

OTOH round-trip editing the file 'bahn.pdf' with Inkscape r10627 and cairo 1.10.2 keeps the image upright (in Inkscape and other PDF viewers).

Revision history for this message
texnic (kotya-karapetyan) wrote :

> your FIrefox seems to use a private copy of a quite old version of cairo ;)

Well, then it's not Firefox I'd assume, but Ubuntu: I've printed to file, and this function is provided by the OS, isn't it? I'm using Ubuntu 10.04 LTS now (original bug submitted with Ubuntu 10.11), which probably explains the outdated library version.

Do you mind explaining me or pointing to some manual on how to update cairo? I couldn't find any instruction suitable for a Linux newbie :(

Should I also check this whole procedure in Windows?

Revision history for this message
su_v (suv-lp) wrote :

> Do you mind explaining me or pointing to some manual
> on how to update cairo? I couldn't find any instruction
> suitable for a Linux newbie :(

I didn't want to imply that you need to or should tinker in any way with the system libraries - I mentioned it because we suspect that the problem with these types of flipped images in PDF files depends on the cairo version originally used to create the PDF file (cairo < 1.10.x), not on the application itself which uses the cairo library (Inkscape, Firefox, etc.).

> I've printed to file, and this function is provided by the OS, isn't it?

I'm not sure about that - AFAIU Ubuntu 10.04 (LTS) has cairo 1.8.10 installed, not 1.7.4 (though 1.8.10 might trigger the same issue): <http://packages.ubuntu.com/lucid/libcairo2>

Summary: don't mess with Firefox packages and/or system libararies (specially if you are new to linux). The comments here are intended for Inkscape's bug triage (trying to narrow down the issue: what needs to be addressed in Inkscape, what will/has been addressed upstream).

> Should I also check this whole procedure in Windows?

Saving a PDF by printing to file from Firefox and round-trip editing it in Inkscape? Unlikely - AFAIK on Windows this depends on having a PDF printer driver installed (or does Windows 7 now include native PDF support?).

On Mac OS X, Firefox uses the system routines to print to PDF and those PDF files created with Apple's Quartz PDFContext are not affected by this issue (flipped embedded images (in pattern fills) when round-trip edited in Inkscape 0.48.2 or 0.48+devel).

Revision history for this message
su_v (suv-lp) wrote :

Current status:
- PDF files originally created with cairo >= 1.10 are not affected (bug #189495)
- PDF files originally created with cairo < 1.10 render correctly in current trunk (bug #840625)

Original test case:
- 'trains.pdf' (originally created with cairo 1.7.4, resaved with Inkscape 0.48.1)
PDF file appears to render correctly in Inkscape 0.48.x, but is actually wrong (flipped a second time (?)).
PDF file renders correctly in current trunk (images are upside-down, like in other PDF viewers).

Second test case:
- 'bahn.pdf' (originally created with cairo 1.7.4, not edited in Inkscape 0.48.x)
Round-trip editing in Inkscape 0.48.x produces broken PDF file -> results in the original test case.
Round-trip editing in current trunk produces correct PDF file - without inverted images (fixed in bug #840625).

Closing as 'Fix committed' (milestone 0.49). Feel free to reopen if you don't agree.

Changed in inkscape:
milestone: none → 0.49
status: Confirmed → Fix Committed
Changed in inkscape:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.