How do I get transparency in PDF's and PNG's to save correctly?

Post questions on how to use or achieve an effect in Inkscape.
NodeNecromancer
Posts: 9
Joined: Thu Feb 04, 2016 12:35 pm

How do I get transparency in PDF's and PNG's to save correctly?

Postby NodeNecromancer » Sat Apr 16, 2016 11:20 am

Hello all,

Image

I think this is a bug in Inkscape. When I try to save my vector images as PDF or PNG, transparent areas are rendered as partially opaque (PNG) or completely opaque (PDF).

I tried installing the development version of Inkscape and the problem is not fixed. I tried using some SVG to PDF converter websites and they render SVG's horribly... much worse than Inkscape. I tried viewing the PDF in Adobe Reader and Genius PDF and they both have black boxes, so it is not specific to a certain PDF reader.

Do you guys have any tips or workarounds for this bug? It sucks to work for an hour on something and then not be able to export it as PDF and send it to people.

Thanks in advance for your help.

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: How do I get transparency in PDF's and PNG's to save correctly?

Postby brynn » Sat Apr 16, 2016 11:37 am

How are you creating the PNGs? Proper way is File menu > Export PNG Image. Using Save As is wrong way. No bugs that I know of with exporting PNGs.

For PDF, I think there is currently a bug with transparency. Although I think it's printing the PDF where it shows up. But I'm not much of an expert about Inkscape bugs.

It's hard to "decipher" your image. That's not a photocopy, or photograph, is it? It doesn't look like screenshots. Even the one from Inkscape SVG doesn't look right....unless you have some kind of filter on that text???

NodeNecromancer
Posts: 9
Joined: Thu Feb 04, 2016 12:35 pm

Re: How do I get transparency in PDF's and PNG's to save correctly?

Postby NodeNecromancer » Sat Apr 16, 2016 11:57 am

These are screenshots. The text I selected for the screenshot started its life as Microsoft PowerPoint Word Art, then was exported to PDF, then was opened in Inkscape and saved as SVG.

File -> Export PNG Image worked. Thanks for the tip.

The PNG I screenshotted above was from File -> Save As Copy -> PNG. Strange that the two work differently.

I really hope they fix this PDF transparency bug. What's the point of making vector graphics if you have to rasterize them back to PNG? :/

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: How do I get transparency in PDF's and PNG's to save correctly?

Postby brynn » Sat Apr 16, 2016 2:24 pm

The text I selected for the screenshot started its life as Microsoft PowerPoint Word Art, then was exported to PDF, then was opened in Inkscape and saved as SVG.

I'm not familiar with MS PP Word Art. Is it vector? After exporting from whatever the native PP format is, to PDF, and then opening the PDF in Inkscape, I wouldn't be surprised if it's not vector anymore (if it ever was). It doesn't look vector-ish at all.

The reason I thought they might be photos, is because those long thin strips look like what tape on paper looks like when it's photocopied!
The PNG I screenshotted above was from File -> Save As Copy -> PNG. Strange that the two work differently.

Are you talking about File menu > Save a Copy? Or Edit menu > Make a Bitmap Copy?

Save a Copy saves an SVG file in whatever folder and name you choose. Make a Bitmap Copy changes whatever you select into a PNG, and leaves it in the image. It will respect transparency, if it's there. But if there is an opaque object behind whatever you selected, it won't be transparent. Or possibly if you changed the Inkscape background to opaque -- I'm not sure about that.

What is that blurry black fogginess behind the text in the PNG version?

Well I'm not sure about the details of the transparency issues with PDF conversion. I'm pretty sure it just cropped up in the current stable version. (Assuming I'm correct about it being a bug. It's possible the problem is with the viewer. Even though you tested in 2 different viewers, the problem could still be with the viewer.)

Let's see if I can find the actual bug report.... Ok, I found a couple. However, note that we have not examined your various files, and I'm not sure if your problems are the same as these reports. But they could be. Maybe by reading them, you will find some workarounds? Just on a quick reading, I saw a couple of things you could try.

https://bugs.launchpad.net/inkscape/+bug/1047472
https://bugs.launchpad.net/inkscape/+bug/381677

And if you printed the PDF, that's another different bug. Your screenshot looks more like the printing bug. Here's that one:

https://bugs.launchpad.net/inkscape/+bug/1418865

NodeNecromancer
Posts: 9
Joined: Thu Feb 04, 2016 12:35 pm

Re: How do I get transparency in PDF's and PNG's to save correctly?

Postby NodeNecromancer » Sat Apr 16, 2016 8:51 pm

Hey there,

Thanks for the detailed replies! I updated the screenshot in my original post so that everything is clearer.

I think that the MS PP Word Art got changed to raster with transparency when I exported it. So it is no longer vector. Which is fine.

I have 4 or 5 images in my document like this. Those didn't start as MS PP Word Art, and they also have this problem. You can see small parts of those images in my screenshots, on the left, and on the top.

Yeah, the PNG screenshot looks a little like scotch tape / clear tape. Lol

The blurriness in the PNG screenshot is the entire raster image with some kind of opacity applied. I did not apply any opacity, so it is probably a bug.

https://bugs.launchpad.net/inkscape/+bug/1047472 - This is something different. This is a bug report for two images with opacity overlapping incorrectly.

https://bugs.launchpad.net/inkscape/+bug/381677 - This is probably the bug report for the PDF issue. Kind of discouraging that it is from 2009. It looks like development on Inkscape is a little slow.

I did not try to print the PDF yet.

brynn, any advice for how to (re)submit this problem to the devs? This isn't the first PDF this has happened to me on. And the whole point of vector image design is so that you can export it to a format that others can read that preserves the vectors, which means PDF. If there are ugly black boxes all over the PDF wherever there is a pasted in logo, then the PDF becomes ugly and is no longer production quality (these are work files).

Thanks.

The Workaround

For anybody that would like the solution to this problem, I think the best workaround is to do File -> Export PNG Image, and choose a high resolution (300 dpi). Then drag your new image into your PDF editor program and create a PDF using that. While you will lose all your vectors, it will cure the transparency problem.

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: How do I get transparency in PDF's and PNG's to save correctly?

Postby brynn » Sat Apr 16, 2016 10:55 pm

Well, before claiming a workaround, it would probably be a good idea for some of us to look at your files, and try to confirm that your problem is the same as the mentioned bug. I probably don't have the right kind of skills for that, but others in this forum might. It's not that I don't believe you when you say you've had problems with this for a long time. It's just presenting a workaround for a specific bug, without any files for confirming technically if it's the same bug, could be misleading for other users.

If you have any new info to add to the existing bug, you're welcome to post a new comment. Here's some info on reporting bugs, although some of it is more for advanced users or coders. https://inkscape.org/en/contribute/report-bugs/ Or if it's been a year or more since the last comment, maybe you could post your file and ask for confirmation it's the same bug. Who knows, maybe your file would have the key for someone to be able to fix it?

If you have a potential new bug to report, it's probably a good idea to post where others can look at it, like you did here. Or you could post on the User mailing list. (https://inkscape.org/en/community/mailing-lists/)

I'm still a little suspicious of the PDF issue being with the viewer. But without any files for testing, it's hard to be sure. If you want us to do some testing, you're welcome to attach files, and give specific steps to reproduce. (I know you already gave some steps, but just to have them together with the relevant files would be convenient.)

And another reason I'm not sure if your problem is with that bug, is because it could also be related to importing from whatever that format was in MS PP, into Inkscape, or related to exporting back to PDF (but not related to transparency). The round trip from PDF, to Inkscape, and back to PDF is not a clean trip, so to speak. Sometimes data gets lost or added or changed along the way. Inkscape doesn't have such support, at least not yet.

And again, it's not that I don't believe or trust you. It's just a good idea to have a 2nd opinion from someone who knows what they're doing, which is not me, lol. (My skills are with the Inkscape canvas. How or why Inkscape works behind the canvas is pretty much a mystery to me.)

NodeNecromancer
Posts: 9
Joined: Thu Feb 04, 2016 12:35 pm

Re: How do I get transparency in PDF's and PNG's to save correctly?

Postby NodeNecromancer » Sat Apr 16, 2016 11:00 pm

Good advice.

1) I created a bug report here. https://bugs.launchpad.net/inkscape/+bug/1571176

2) This zip contains files that clearly illustrate the error. http://www.clania.net/phoenix/inkscape_bug.zip

Steps To Reproduce

1) Open attached .svg file, which contains a raster image with transparent pixels.

(Original source: Microsoft PowerPoint 2010 for Windows, then exported to PDF, then opened with Inkscape.)

2) File -> Save A Copy -> PDF

3) Open the created PDF using a PDF viewer such as Adobe Reader. There will either be a black box where the transparent areas should be (0.91 r13725), or the entire image will be blurry (0.91 r14762), depending on which version of Inkscape you are using to do the saving.

Windows 7 Home Premium 64-bit SP1

Moini
Posts: 3381
Joined: Mon Oct 05, 2015 10:44 am

Re: How do I get transparency in PDF's and PNG's to save correctly?

Postby Moini » Sat Apr 16, 2016 11:08 pm

The pdf thing is a known issue in the 64bit Windows version of Inkscape, see http://wiki.inkscape.org/wiki/index.php ... own_issues. In the bug report linked, there are a few workarounds listed, for example to just put a white rectangle below the transparent area, or to use the 32bit version.

Save As... -> Cairo PNG will create a Cairo png file, which is different from normal PNG in a few ways. It's confusing to many new users, you're not the first one - but I don't know of a way of labelling it differently, as it *is* a Cairo PNG...
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)

NodeNecromancer
Posts: 9
Joined: Thu Feb 04, 2016 12:35 pm

Re: How do I get transparency in PDF's and PNG's to save correctly?

Postby NodeNecromancer » Sat Apr 16, 2016 11:24 pm

I uninstalled my 64-bit version and installed the 32-bit version of Inkscape, and the resulting PDF not only has the black box problem, but is now missing a bunch of the raster images as well.

Moini
Posts: 3381
Joined: Mon Oct 05, 2015 10:44 am

Re: How do I get transparency in PDF's and PNG's to save correctly?

Postby Moini » Sun Apr 17, 2016 12:12 am

Sorry. I think I found the reason, it's the clip / mask combination. The transparency printing error seems to be unrelated.

The image is, for some strange reason, using a mask and a clip and a lot of groups.
When I ungroup and remove the clip, it works well enough on Linux.

(but the image would look a lot better if you wrote the text in Inkscape and used filtering to make it look bubbly - the quality of the imported and masked raster image is very low)
Attachments
raster image with transparency.pdf
(79.28 KiB) Downloaded 210 times
raster image with transparency_no_clip.svg
(75.24 KiB) Downloaded 218 times
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)

NodeNecromancer
Posts: 9
Joined: Thu Feb 04, 2016 12:35 pm

Re: How do I get transparency in PDF's and PNG's to save correctly?

Postby NodeNecromancer » Sun Apr 17, 2016 12:22 am

Good find.

Ungrouping each bad image until the status bar says "image" instead of "group of 1 object" seems to fix everything.

What are these groups, anyway? What is in them? How is a "group of 1 object" a group?

Moini
Posts: 3381
Joined: Mon Oct 05, 2015 10:44 am

Re: How do I get transparency in PDF's and PNG's to save correctly?

Postby Moini » Sun Apr 17, 2016 1:13 am

<svg:g> (= group in Inkscape) is an SVG element that is a container for other elements and can have some special attributes set (e.g. transformations like rotation, opacity for the whole group, etc.). It doesn't matter if there's only a single element inside, or more. Even empty groups can exist (Inkscape's layers are empty groups when you start a new one).

PDF files, when imported into Inkscape, often contain a shameless amount of useless groups and clips. The first thing one should do, if one wants to use imported stuff from pdf in own projects, is to remove all the cruft...

You can see 'clipped' and 'masked' in the status line, too, then you can go to Object -> Clip -> Release or Object -> Mask -> Release to remove them.
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)


Return to “Help with using Inkscape”