Transparent whites equivalent for svg/inkscape?

Post questions on how to use or achieve an effect in Inkscape.
cmawhorter
Posts: 4
Joined: Thu Mar 17, 2011 7:05 am

Transparent whites equivalent for svg/inkscape?

Postby cmawhorter » Thu Mar 17, 2011 7:18 am

I'm trying to find a way to basically do a transparent whites. I've figured out that I can Ungroup the object, and then select all the elements, and then go to exclusion. But I don't know if this will work in all situations.

Here is an example to show what I mean

Ungrouped Object (Red background for illustrative purposes)

Image

It is layers like.... Solid black-filled bat background, Smaller white-filled bat on top, Black highlights

Selecting all the items gives me this:

Image

That is the desired result. This is great for one image, but I have thousands to process, and I'm not sure this will work for all of them.

So my questions are 1) What if I had more objects and multiple white sections? Will this exclusion selection always give me the desired result? and 2) Is there a better way to do this? 3) How can I script it with inkscape? Seems like there is a limit of what can be done via command line.

cmawhorter
Posts: 4
Joined: Thu Mar 17, 2011 7:05 am

Re: Transparent whites equivalent for svg/inkscape?

Postby cmawhorter » Thu Mar 17, 2011 8:19 am

I'll answer my own question for #1. I found one it doesn't work with. So it seems this is not the way to go. Anyone have any ideas?

Image
Image

ivan louette
Posts: 215
Joined: Thu Aug 21, 2008 4:08 am
Location: Belgium

Re: Transparent whites equivalent for svg/inkscape?

Postby ivan louette » Thu Mar 17, 2011 8:28 am

Group the black and white objects and try this filter : open Filters/Filters Editor, select your group and click in the box left of the filter name.

ivan
Attachments
transparency.svg
(5.36 KiB) Downloaded 232 times

User avatar
tomh
Posts: 218
Joined: Sat Feb 14, 2009 10:14 pm

Re: Transparent whites equivalent for svg/inkscape?

Postby tomh » Thu Mar 17, 2011 9:52 am

Or/ select all the black objects, group. Select all the white objects, group. then select both, and go object->clip->set.

User avatar
druban
Posts: 1917
Joined: Fri Nov 20, 2009 10:48 pm

Re: Transparent whites equivalent for svg/inkscape?

Postby druban » Fri Mar 18, 2011 2:58 am

I think for thousands of files you are looking for the fastest way to convert them but I don't think any one way exists for all of them.
Here is my suggestion - with illustrations. I am using a very abstract version of your bat - please don't laugh :D
Step 1. the bat with black shapes on a white shape on a black shape on a solid red background for clarity. No grouping is necessary.

bitmap1.png
bitmap1.png (17.15 KiB) Viewed 1430 times


Step 2. select everything except the red background. Do Path>combine.

bitmap2.png
bitmap2.png (14.62 KiB) Viewed 1430 times


Depending on the number of layers, you might get this!

bitmap3.png
bitmap3.png (19.92 KiB) Viewed 1428 times


But you only have to click the black swatch on your palette to fix it (inset).

Do you think this will work for you, or have you tried it already?
Your mind is what you think it is.

cmawhorter
Posts: 4
Joined: Thu Mar 17, 2011 7:05 am

Re: Transparent whites equivalent for svg/inkscape?

Postby cmawhorter » Fri Mar 18, 2011 3:50 am

Ivan, your way seems to work flawlessly, but it doesn't work for my situation since I need to ultimately convert to swf. And the version of svg2swf I'm using (from 2001) doesn't seem to support filters such as this. Though I haven't tried newer versions. There is a newer version from 2009, so I might give this a try -- http://sourceforge.net/projects/svg2swf/files/svg2swf/

druban, thanks for your post modern bat =] Your way works but it doesn't always give the perfect result. For example, the cat:

Image

Notice the weird blocking going on, especially noticeable in the legs.

I think I'm going to give up on doing this in svg, and instead come up with a solution in flash using some sort of colortransform -- since that's where it ultimately needs to go anyway.

Thanks for all the help guys. <3 inkscape

cmawhorter
Posts: 4
Joined: Thu Mar 17, 2011 7:05 am

Re: Transparent whites equivalent for svg/inkscape?

Postby cmawhorter » Fri Mar 18, 2011 4:26 am

For the future searchers of the world, here is the solution in flash:

Flash has a ColorMatrixFilter and I was able to plug Ivan's values directly into it and *poof* transparency.

Actionscript code:
var matrix:Array = new Array();
matrix = matrix.concat([1, 0, 0, 0, 0]); // red
matrix = matrix.concat([0, 1, 0, 0, 0]); // green
matrix = matrix.concat([0, 0, 1, 0, 0]); // blue
matrix = matrix.concat([-0.21, -0.72, -0.07, 1, 0]); // alpha
var colorMatrix:ColorMatrixFilter = new ColorMatrixFilter(matrix);
this.filters = [colorMatrix];


Return to “Help with using Inkscape”