Re: [SVG] Experiment and proposal

Fred P. wrote:


> That works fine for me, I agree,
> now I need to find a tool to convert images in Base64
> on *nix and windows.


Your favourite programming language should support it; here's an example 
in Ruby:

require 'generated/svg/svg_writer'

name = ARGV.shift || raise("Missing name")
image_data = File.open(name, "rb") {|f| f.read}
base64_image = [image_data].pack("m*").split("\n")

doc = Svg_doc.new
root_el = doc.root
root_el.attributes["xmlns:xlink"]="http://www.w3.org/1999/xlink"
image = Image.new
image.width=100
image.height=100
image.xlink_href='data:image/jpeg;base64,'+base64_image.to_s
root_el.push image
open('generated/svg/base64.svg','w') {|f|f.write doc}

Tobi


-- 
http://www.pinkjuice.com/

Received on Wednesday, 16 April 2003 04:01:32 UTC