Re: converting svg to png with black background

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx
List membership: https://mail.gnome.org/mailman/listinfo/gimp-developer-list




[Index of Archives]     [Video For Linux]     [Photo]     [Yosemite News]     [gtk]     [GIMP for Windows]     [KDE]     [GEGL]     [Gimp's Home]     [Gimp on GUI]     [Gimp on Windows]     [Steve's Art]

  Powered by Linux