[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gimp-developer
Subject:    Re: [Gimp-developer] converting svg to png with black background
From:       Ofnuts <ofnuts () laposte ! net>
Date:       2013-09-25 12:09:19
Message-ID: 5242D26F.8050600 () laposte ! net
[Download RAW message or body]

On 09/20/2013 08:01 PM, Matt Becker wrote:
> Hi,
> 
> not sure if this is the right mailing list, I'm trying to convert svg to png (which \
> is working), I just need to get the background black. 
> Here's my scm script:
> 
> (define (svg-to-raster infile
> outfile
> resolution
> xmax
> ymax)
> (let* ((image (car (file-svg-load
> RUN-NONINTERACTIVE
> infile
> ""
> resolution
> (- 0 xmax)
> (- 0 ymax)
> 0
> )
> )
> )
> (drawable (car (gimp-image-get-active-layer image)))
> )
> (plug-in-autocrop RUN-NONINTERACTIVE image drawable)
> (gimp-file-save RUN-NONINTERACTIVE image drawable outfile outfile)
> (gimp-image-delete image)
> )
> )
> 
> 
> I want a non-antialiased png with black background as the final result, currently \
> background is transparent. See attached for my original svg image. It's converting \
> fine from shell (other than black background) via: 
> gimp -i -b '( svg-to-raster "special_areas.svg" "special_areas.png" 72 0 0)' -b \
> '(gimp-quit 0)'

Completely different solution;

Use gimp-vectors-import-from-file to import a path form a SVG, then 
create a layer, fill with black, and stroke the path after setting the 
foreground to the color of your choice. However this will get your 
something antialiased. The same without anti-aliasing: stroke the path 
on  a transparent layer, then  threshold the alpha channel.

Improvement on your solution:

- Once you have the path on the transparent layer, alpha lock the layer 
and bucket fill with the final color
- Inset black layer below.

_______________________________________________
gimp-developer-list mailing list
List address:    gimp-developer-list@gnome.org
List membership: https://mail.gnome.org/mailman/listinfo/gimp-developer-list


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic