While creating images on Inkscape, gradients and transparencies can be used to blend colors or add texture to an image.

fig 1

When such a file is exported as a png file or used in a pdf/x1-a or pdf/x-3 file, the transparency may not render properly (fig 2).

fig 2

This can be resolved by adding a layer of opacity beneath the transparent layer(s). This tutorial explains two methods of doing that.

The first method is as follows:

  • In Inkscape, Click on File –> Document Properties
  • Within Document Properties, under Page tab, click on Background color, which can be found under the Background section.
  • This would open an interactive box. Click on the Alpha layer which is the fourth channel. 
  • Increase the opacity of that layer from 0 to 100.
fig 3

What this would do is create a white background for the entire image, well beyond the transparent layers as seen in fig 4.

The image below (fig 4), illustrates how the image with opacity would render while using this method, when the image is placed in a different background.

fig 4

This method would work when the image is exported as a png or jpeg image.

If transparency is used as part of a larger image within Inkscape, the previous method would not resolve this issue. Thus the flower in fig 1 would look like this when used as part of a bigger image…

fig 5

…instead of looking like this.

fig 6

To fix this issue, an exact layer of opacity should be added beneath the transparent layers.

The following are the steps to doing that:

1. Select the transparent layers of the image to be duplicated. Duplicate the image. (ctrl + d for Windows, command + d for Mac or if you are using the menu bar in Inkscape, click on Edit Duplicate.)

fig 7

2. Click to select the top layer, which is the duplicated layer. Ungroup the layers using Object –> Ungroup from the menu bar.

fig 8

3. Select all the layers on the duplicated image, by clicking on every single layer using shift + Mouse click.

fig 9

(Do not use, mouse-drag to select, because that would select both the top and bottom layers, which would cause problems for this excercise.)

3. After Shift + Selecting the layers individually, click on Path –> Union on the menu bar to join all the elements into one. It may look like something disappeared.

fig 10

But as evident from the pull away image below (fig 11), the duplicated image, has a single path. Part of it is not visible because it has transparency. (Please do not pull away your image. If you did that, bring it back to the top of the original image.)

fig 11

4. Click on the duplicate image (the top layer), then click on the Fill and Stroke menu. Choose the Flat color button. This would convert the gradient on the top layer into solid color.

fig 12

5. Change the color of this layer to white or a much lighter shade.

fig 13

6. With the top, solid color layer still selected, Click on Object –> Lower to bring the top layer to the bottom.

fig 14

7. Then select all the layers and group the image, using Object –> Group

Now, the image would render as intended within Inkscape or when exported to be used as part of a pdf/x file.

fig 6

Reference to the features on Inkscape: https://inkscape-manuals.readthedocs.io/en/latest/interface.html

Related Post