Posts

Showing posts with the label inkscape

Texts in SVG do not show up in browsers

If you create a SVG vector image using Inkscape with text(s) you may encounter this: all the texts do not show up in any browser. It is because Inkscape using flowed-text by default which is an un-finished function and is not implemented yet in any other vector renderers (like the browsers). So, what you can do now is to convert those texts into regular texts or non-flowed-text by: 1. Select the text(s) 2. In Text menu, select Convert to text References: [0]  https://bugs.launchpad.net/inkscape/+bug/747441 [1]  http://wiki.inkscape.org/wiki/index.php/FAQ#What_about_flowed_text.3F

A great tool to edit SVG image's source online

Image
I just design a vector image with Inkscape and I want to do something more with the xml source. Eventhough Inkscape has a xml editor (CTRL + SHIFT + X) but It's not intuitive enough. Here we go, this online tool is pretty cool: http://mrdoob.com/projects/htmleditor/ The editor allows me to modify SVG's XML source and see the changes instantly, visually.

Making vector out of bitmap image using Inkscape

Image
In some cases I also have to do the design part of some websites. Something like logos, banner, t-shirts etc...  The job is way easier with the free open-sourced tool names Inkscape. In this blog post I will show you the technique I used to convert a bitmap image to vector (not pixelated when scaling). 1. Import the bitmap image as embed: >> File >> Import... >>  2. Select the image and choose Path >> Trace Bitmap...  and set the settings as following: * Color * Stack scans * Scan: 2 * Remove background (to make the background transparent) >> click Update to preview >> click OK to apply the trace: 3. Copy the created layer (the black one) into another Inkscape document, save it and you have a vector version of the original bitmap image: Pretty cool huh? \m/

Generate PDF document from SVG template in Django with Inkscape

In the last blog post, I show how to convert a svg vector image to a pdf file using Inkscape command line tool. We will go one step further, generate pdf document with provided data and SVG template in Django. For example, we have a svg template which contains some tokens such as "{{username}}", "{{blah}}": 1/ open the svg template, get its content (it's xml), and close it. svg_file = open("/path/to/data.svg", 'r') svg_content = svg_file.read() svg_file.close() 2/ Process content of the svg: replace pre-defined token (e.g. '{{username}}' ) with your data (e.g superman) new_content = svg_content.replace("{{username}}", "superman") If you pass variable to replace, make sure it is a string , not an Unicode object: new_content = svg_content.replace("{{username}}", str(myusername)) 3/ Create a new file with '.svg' extension (e.g data.svg), then write the processed data to that file ...

Convert SVG to PDF in Django with Inkscape

We can convert a SVG to PDF file using the following command line provided by Inkscape Vector Graphics Editor : $ inkscape -z -C -A /path/to/drawing.pdf -f /path/to/drawing.svg Convert drawing.svg to drawing.pdf, using the entire page (option -C), and NOT using any GUI (-z). With subprocess python module, we will take advantage of that tool in python: >>> command = ["inkscape", "-z", "-C", "-A", "/path/to/drawing.pdf", "-f", "/path/to/drawing.svg"] >>> subprocess.call(command) Awesomeness!!1