You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by T Vilaisakulyong <t...@bandmerch.com> on 2006/07/19 02:48:10 UTC

SVG layer selection question

Hi,

I'm new to batik, and I have a problem that I would like some help with:

I'm creating a website that would let people download templates (svg 
files) and place their own logo on to the  templates itself. The 
template would have two layers: one for background, and one for logo 
placement.

When they finished placing logo on the template, they would save it, and 
upload it to us. What I want to do is write a code that would let me 
select the logo layer, crop out the logo itself (so the background is 
transparent), and convert it to png file so that I can output some preview.

Now, I have play around with uploading a test SVG file, crop it, and 
convert the output to png with no problem using the transcoder. The 
problem is, when I do the croping, it would crop both layer, therefore I 
would have the logo with the black background behind it.

My question would be if I can use Batik to select that logo layer so the 
final resulting output from cropped logo would have transparent 
background. And if I can't select the logo layer, what utilities can I 
use to make the background transparent?

Thanks in advance,
T

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Re: SVG layer selection question

Posted by T Vilaisakulyong <t...@bandmerch.com>.
T Vilaisakulyong wrote:

> Hi,
>
> I'm new to batik, and I have a problem that I would like some help with:
>
> I'm creating a website that would let people download templates (svg 
> files) and place their own logo on to the  templates itself. The 
> template would have two layers: one for background, and one for logo 
> placement.
>
> When they finished placing logo on the template, they would save it, 
> and upload it to us. What I want to do is write a code that would let 
> me select the logo layer, crop out the logo itself (so the background 
> is transparent), and convert it to png file so that I can output some 
> preview.
>
> Now, I have play around with uploading a test SVG file, crop it, and 
> convert the output to png with no problem using the transcoder. The 
> problem is, when I do the croping, it would crop both layer, therefore 
> I would have the logo with the black background behind it.
>
> My question would be if I can use Batik to select that logo layer so 
> the final resulting output from cropped logo would have transparent 
> background. And if I can't select the logo layer, what utilities can I 
> use to make the background transparent?
>
> Thanks in advance,
> T
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>
The link fo the testing SVG file in question is here:
http://people.bandmerch.com/staff/tvilaisakulyong/front_template_svg.svg

Thanks,
T

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Re: SVG layer selection question

Posted by T Vilaisakulyong <t...@bandmerch.com>.
thomas.deweese@kodak.com wrote:

>Hi T,
>
>T Vilaisakulyong <t...@bandmerch.com> wrote on 07/18/2006 08:48:10 PM:
>
>  
>
>>My question would be if I can use Batik to select that logo layer so the 
>>    
>>
>
>  
>
>>final resulting output from cropped logo would have transparent 
>>background. And if I can't select the logo layer, what utilities can I 
>>use to make the background transparent?
>>    
>>
>
>   So the simplest thing to do is to make sure your two
>layers are in separate SVG 'g' elements.  Then you can just
>set the "display" attribute on the "g" element to "none" and
>it will go away in the rendering.
>
>   You may need to change the way you use the transcoder so
>you load the document first, add the display attribute then
>give the document to the transcoder.
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
>For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>
>  
>
Thanks for the help. Works like a charm :)
T

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Re: SVG layer selection question

Posted by th...@kodak.com.
Hi T,

T Vilaisakulyong <t...@bandmerch.com> wrote on 07/18/2006 08:48:10 PM:

> My question would be if I can use Batik to select that logo layer so the 

> final resulting output from cropped logo would have transparent 
> background. And if I can't select the logo layer, what utilities can I 
> use to make the background transparent?

   So the simplest thing to do is to make sure your two
layers are in separate SVG 'g' elements.  Then you can just
set the "display" attribute on the "g" element to "none" and
it will go away in the rendering.

   You may need to change the way you use the transcoder so
you load the document first, add the display attribute then
give the document to the transcoder.


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org