rsvg

SVG to PNG with multiple image layers using PHP

∥☆過路亽.° 提交于 2019-12-04 06:24:44
I convert svg to png image with this code <?php exec('/usr/bin/rsvg-convert -w 1000 -h 1000 tshirt.svg -o tshirt.png'); ?> This works with a single svg image. Actually i have an svg image which contains multiple layers of images like: 1st layer -: this is the background T-shirt image which is transparent 2nd layer -: this is another T-shirt image which contains color 3rd layer -: this is the small sticker image which should be placed on the T-shirt My svg code is -: <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD

Ruby, RSVG and PNG streams

荒凉一梦 提交于 2019-12-03 13:49:18
问题 I'm trying to do an image conversion in a rails app from SVG to PNG. ImageMagick didn't work out for me, due to Heroku not able / wanting to upgrade IM at this time. I'm testing out some ideas of using RSVG2 / Cairo in dev but running into a roadblock. I can easily convert and save the SVG to PNG like this: #svg_test.rb require 'debugger' require 'rubygems' require 'rsvg2' SRC = 'test.svg' DST = 'test.png' svg = RSVG::Handle.new_from_file(SRC) surface = Cairo::ImageSurface.new(Cairo::FORMAT

rsvg with Python 3.2 on Ubuntu

∥☆過路亽.° 提交于 2019-11-29 07:14:33
I am trying to use rsvg in Python 3.2 but I keep getting an import error. I have installed all of the librsvg packages along with cairo. I cannot find anything online about what else to install to get it to work. I did hear that the rsvg module hasn't been updated since 2005 so is it just not compatible with Python 3.2, or is there something else I can try to install it? Alternatively, if rsvg does not work, does anyone have any suggestions for a simple way to display an SVG file through Python (basically just show the image)? EDIT: The error I get is: 'ImportError: No module named rsvg' This

ImageMagick convert SVG to PNG not working with RSVG enabled

怎甘沉沦 提交于 2019-11-29 06:54:43
I'm using ImageMagick's convert utility to convert SVG file to PNG image. At first, I used vanilla installation of IM on OSX ( brew install imagemagick ) to convert the SVG using: $ convert file.svg file.png This worked except that some of the image objects in that file were offset (actual links to images). I then read a related question that suggested ImageMagick to be compiled with rsvg support (homebrew does it with brew install imagemagick --use-rsvg ). Now, when I try to perform the conversion, no images are rendered. I tried using this SVG file , and the resulting PNG was blank. However,