RSS/Atom feed Twitter
Site is read-only, email is disabled

converting svg to png with black background

This discussion is connected to the gimp-developer-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

3 of 3 messages available
Toggle history

Please log in to manage your subscriptions.

converting svg to png with black background Matt Becker 20 Sep 18:01
  converting svg to png with black background Matt Becker 23 Sep 22:03
  converting svg to png with black background Ofnuts 25 Sep 12:09
Matt Becker
2013-09-20 18:01:31 UTC (over 10 years ago)

converting svg to png with black background

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)'

thanks

Matt Becker
2013-09-23 22:03:48 UTC (over 10 years ago)

converting svg to png with black background

Hi,

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 need 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)'

thanks

Ofnuts
2013-09-25 12:09:19 UTC (over 10 years ago)

converting svg to png with black background

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.