Save as PDF with rasterized filter effects at high DPI looses random elements of figure

Bug #494115 reported by John Harrold
48
This bug affects 8 people
Affects Status Importance Assigned to Milestone
Inkscape
Fix Released
Medium
theAdib

Bug Description

I'm using 0.47 on OS X (10.5.8/Leopard). I've run into a problems trying to
export PDFs. Here is a test file I'm working with:

test.svg (in zip file)

If I save as a pdf with the following options:
  - Convert texts to paths (checked)
  - Rasterized filter effects (unchecked)
  - Resolution for rasterization (600 dpi)
  - Export area is drawing (unchecked)
  - Export area is page (checked)

I produce the following pdf output:

test-not_rasterized.pdf (in zip file)

which looks right, but eliminates the blurred elements.

Next I try to save using the following options in order to preserve the
blurred portion of the figure:
If I save as a pdf with the following options:
  - Convert texts to paths (checked)
  - Rasterized filter effects (checked)
  - Resolution for rasterization (600 dpi)
  - Export area is drawing (unchecked)
  - Export area is page (checked)
test-not_rasterized.pdf (in zip file)

Basically checking "rasterize filtered effects". Some of the blurred
elements look fine, but several components of the drawing disappear
completely.

This was discussed on the list and it was found that the problem didn't exist at lower DPI levels.

thread on inkscape-user mailing list:
<http://thread.gmane.org/gmane.comp.graphics.inkscape.user/12943>

Tags: exporting pdf
Revision history for this message
John Harrold (john-m-harrold) wrote :
Revision history for this message
su_v (suv-lp) wrote :

reproduced with Inkscape 0.47 on OS X 10.5.8

tags: added: exporting pdf
description: updated
Changed in inkscape:
status: New → Confirmed
Revision history for this message
Bill Rosgen (rosgen) wrote :

I get the same behaviour with Inkscape 0.47 and OS X 10.6.2 on the attached file.

At export DPI above 175 not all of the objects with blur applied are present in the output PDF. They seem to disappear one-by-one as the DPI is increased -- 200 DPI is almost right, but 300 is missing more objects.

It's an A2-sized file, so memory may be the issue(?): I have 2GB of ram available.

Revision history for this message
Christoffer Holmstedt (christoffer-holmstedt) wrote :

I can confirm that this bug is still alive. I've tried on the following systems:

Windows 7 Pro 64 bit - Inkscape 0.47-3 and Inkscape 0.48.0-1
Ubuntu 10.04.1 64 bit - Inkscape 0.47

Saving to pdf at 90dpi will save all blurred layers of my A2 page. As soon as I go to 300dpi the layers with blurred parts vanish.

Revision history for this message
mnoe (matthias-noe) wrote :

I came across the same bug when I wanted to create an A0 poster with a blurred background and save it as 300dpi PDF. While other blurred objects appeared correctly the background disappeared.

To narrow down the bug I created a SVG with a blurred black rectangle in its center in the sizes A0, A1, A2, A3 and A4 and saved the respective files as PDF (see attachment). While the A0, A1 and A2 PDFs don't show anything, the A3 and A4 PDFs give the correct result.

Therefore I suspect the bug is caused when rasterized images get too big (that is, somewhere between 3508x4961 and 4961x7016 pixels). However it seems generally not to be a memory related bug, because when trying to save the A0 inkscape crashes with an memory error (see attached screenshot) while the A1 and A2 still get saved.

This bug occurred to me under Windows XP (Inkscape 0.48.0-1) and Mac OS X 10.6.5 (Inkscape 0.48.0-1).

Revision history for this message
mnoe (matthias-noe) wrote :
Revision history for this message
mnoe (matthias-noe) wrote :

Until this bug is fixed I'd like to share the workaround I found for my particular problem: Export the blurred background as bitmap (set the appropriate DPI), convert the resulting PNG to PDF, export the rest of the document (i.e. without background - use layers to hide it) and merge the two PDFs with pdftk:

pdftk.exe in.pdf background bg.pdf output out.pdf

Revision history for this message
theAdib (theadib) wrote :

hmm, It's not a bug it's a feature.
When creating a bitmap in 600dpi Inkscape want to render to a 7776x7776pixel sized bitmap. As there are 4 Bytes per pixel 7776x7776x4=241,864,704Bytes (241MegaByte).

The current code has a security limit of 100MByte (src/libnr/nr-pixblock.cpp:67).

So it prevents from creating a image like this size. There is a note asking how to do it better.
There might be situation where you really want an image like this.

Please give feedback what should Inkscape do in this situation?

Regards, Adib.

Revision history for this message
Christoffer Holmstedt (christoffer-holmstedt) wrote :

@theAdib
I would have appreciated a message that stated "Out of memory, limit is 100MB, try lowering your dpi".

Though I don't understand why just the blurred elements disappear if it's a memory issue.

Revision history for this message
mnoe (matthias-noe) wrote :

@theAdib

Thanks for your explanation, this makes sense of course.

I would like it to be configurable in the options: Max. size for rasterized images on export: 100Mb

If one tries to export a bigger one I would expect a security warning that the currently set limit is hit and that the image in question would require it to be set to at least 241Mb.

Even more convenient would be a simple dialog box asking (when the configurable limit is hit): Do you really want to export the rasterized image at this resolution, it's gonna use 241Mb of memory. Yes, No, Cancel.

The only thing that should not happen is things not appearing in the output file without notice.

Kind regards,
Matthias

Revision history for this message
theAdib (theadib) wrote :

I committed revision 10009 that removes the memory boundaries.
Inkscape really slows down and consumed a lot while exporting. However it does not crash while getting RAM.
On my system 2Gbyte RAM it exports as 1200DPI creating a 18MByte pdf.

We have to address the popup somewehre else.

Changed in inkscape:
assignee: nobody → theAdib (theadib)
status: Confirmed → Fix Committed
theAdib (theadib)
Changed in inkscape:
importance: Undecided → Medium
milestone: none → 0.49
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.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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