Summary: | Mask problem in pdf | ||
---|---|---|---|
Product: | cairo | Reporter: | m2broth <m2broth> |
Component: | pdf backend | Assignee: | Adrian Johnson <ajohnson> |
Status: | RESOLVED MOVED | QA Contact: | cairo-bugs mailing list <cairo-bugs> |
Severity: | normal | ||
Priority: | medium | ||
Version: | 1.12.14 | ||
Hardware: | Other | ||
OS: | All | ||
Whiteboard: | |||
i915 platform: | i915 features: | ||
Attachments: |
result of convert svg to pdf
svg PDF output test case test case fixed to turn off interpolation poppler quick hack |
Description
m2broth
2013-04-09 10:21:19 UTC
The PDF file was created using 1.12.2. Please test with 1.2.14 as there have been a few bugs fixed since 1.12.2. I will also need the SVG file. Created attachment 77669 [details]
svg
svg
I was added svg file. 1.12.14 its version of rsvg-convert? how can i run new version on windows? I used rsvg-convert to convert the svg to pdf. The pdf is displayed correctly by Adobe Reader, Evince, and Ghostscript. But try open pdf file in adobe illustrator and you will see what about i speak in the first comment i was provide link to screenshot of pdf file in ilustrator I don't have Illustrator. Since the PDF renders correctly in acroread, evince, and ghostscript the bug must be in Illustrator. Could you send me please your converted pdf file? Created attachment 77672 [details]
PDF output
Thanks! But your pdf file has same bug in illustrator. Could this be a problem with cairo? TRy open file in Inkscape. There are same problem as in illustrator. I think the bug in conversion from svg to pdf else illustrator rasterize output pdf This bug is present at 1.14.2 - I just detected it affecting GIMP's PDF export in all versions - https://bugzilla.gnome.org/show_bug.cgi?id=752819 And the original complaint, with example images at: http://graphicdesign.stackexchange.com/questions/56710 I hope the fact it is reproducible using GIMP's PDF export makes it easier to track and fix, as there is no need of another minimal program to reproduce it. (GIMP's plug-in use a call to cairo_paint_with_alpha, but I found out it also happens when calling simply cairo_paint) I ran cairo-trace on rsvg-convert while convert the svg in comment 2 to pdf. It appears rsvg-convert is supplying the mask as a bitmap. I'm not sure why as cairo is capable of rendering the svg with all vector operations which would result in an all vector pdf. This would be the cause of the mask problem. I need more info for the gimp issue in comment 13. eg a test case and sample pdf output. Created attachment 118973 [details]
test case
(In reply to Massimo from comment #15) > Created attachment 118973 [details] > test case The GIMP issue, as I understood it, is probably a poppler bug where a raster surface is resampled using unpremultiplied components and so suffering of color bleeding. the black color attributed to completely transparent pixels is used interpolating partly transparent pixels and appears at the border of white shapes drawn above a white background. The attached program saves a pdf that when opened in GIMP is completely white if you set a resolution of 72 dpi, but shows the grey arc shape when a different resolution is chosen. Similarly behaves pdftocairo: the output of pdftocairo -png -rx 72 -ry 72 bug-63302.pdf bug-63302.72-dpi is completely white, whereas the output of pdftocairo -png bug-63302.pdf bug-63302.150-dpi shows the grey arc outline. Created attachment 118974 [details]
test case fixed to turn off interpolation
The cairo pdf backend embeds images exactly as they are. There is no resampling done. The interpolation is being done by the pdf viewer. You can see the embedded images using pdfimages.
Attached is an updated version of the test case that causes the interpolate flag in the embedded image to be set to false. The problem is pdf viewers may ignore this flag. This can be seen in evince where at higher zoom levels the image is not interpolated and the gray pixels disappear. At lower magnification evince will turn on interpolation to match Adobe Reader behavior.
There really isn't anything that can be done in cairo. The cairo pdf backend is creating a pdf that reproduces the cairo drawing operations supplied to it. It is up to the viewer how it is rendered.
Possible (untested) workarounds:
- Use a higher resolution image
- Ensure the color image is larger than the mask.
Created attachment 118999 [details] [review] poppler quick hack This is a poppler quick hack that fixes the gimp issue The idea is to combine the image and the soft mask in image space (so with no resampling needed if they have the same dimensions) and then paint the result on the destination in destination space. I don't have the poppler test suite so I don't know how much it breaks, but firefox renders the output of my previous test case completely white and so I think poppler could do a better job as well. PS: in the function modified by the quick hack if one of the first two 'goto cleanup;' is executed 'maskPattern' is leaked. -- GitLab Migration Automatic Message -- This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/cairo/cairo/issues/89. |
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.