1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
== BLURRED SHADOWS VIA BITMAPS
The "Make a Bitmap Copy" command (Alt+B) exports a bitmap of
the selected objects (with all other objects hidden), saves it as a
PNG file in the same directory as the document, and imports it
back into the document.
Via prefs, you can specify an external filter that will be run on the
PNG file after it is exported but before it is imported back. I use
this for grayscaling and blurring the image to create a soft drop
shadow for any object. So for me, Alt+B creates a shadow for
selected objects, and you can set it up to work the same for you.
The script itself is share/extensions/inkscape-shadow.sh, though
it's not integrated nto the extensions or plugin system in any way.
The script requires Imagemagick 6.x to be installed; you can
modify the script as you like, probably adapting it for effects
other than shadows. The script is Unix-only; you can create
a similar batch file for Windows if you need it (send it to us
if you do).
To enable this, you set in your ~/.inkscape/preferences.xml:
<group
id="createbitmap"
minsize="250"
filter="/full/path/to/inkscape-shadow.sh"
filter_param1="20" />
Here minsize= gives the minimum size of the generated bitmap in
pixels (regardless of the object size); alternatively you can specify
resolution= to set the constant resolution (different pixel size
for different object sizes).
In filter=, you specify either the full path to the script, or just
"inkscape-shadow.sh" if the script is in your PATH. The script
receives the image filename as the first parameter and the
filter_param1 as the second parameter (more parameters can be
added). This particular script interprets that as the blur radius
in pixels, but of course that depends on the script you use.
The inkscape-shadow-white.sh script is the same but creates all-white
blurred shadows ("glows") instead of all-black.
NOTE: I'm not going to provide a GUI for the blurred shadows feature,
for these reasons:
1. You have to carry around the shadow PNGs along your SVG. It's
inconvenient, and the PNGs may be much larger than the SVG.
2. The shadows are not resolution-independent and are not updated
automatically. For all this, we need to support the gaussian blur SVG
filter (a standard SVG feature). But since we don't have any filter
support yet, hence this hack.
3. Both Batik and Adobe have (different) problems with displaying PNGs
with alpha transparency. (Much like the Internet Exploder - shame on
them! :) This means that while this is valid SVG, its usefulness is
pretty much limited to Inkscape only.
Still, for those who desperately need blurred shadows right now (such
as myself), this feature works well enough. Try it out, it's fun.
|