开发者

Convert Image (JPG,BMP,GIF) to SVG

Anyone know a tool that actually works (I tried several, but none works), with support for color images. If some know how to 开发者_StackOverflow中文版implement this, or any component that makes (C#), I would be grateful.

Thanks for any help


The program below works, however, leaves all the files in black and white.

Total Vectorize


Converting bitmap graphics to vector graphics (for example, PNG to SVG) is a definitively non-trivial task, with no straightforward solution. Doing it the other way round - vector to bitmap graphics - is of course a simple process of rendering, and that's how things are usually done if you want both formats.

At its core, such a conversion requires complex and error-prone algorithms that analyse patterns in images. More complicated images will simply be impossible to decompose into vector graphics. The technical explanation is based on the fact that the information entropy of bitmap representations is guaranteed to be higher than that of vector representations, which means there is always uncertainity in reversing the well-defined process of vector graphics rendering.

The best program widely available for your task is likely to be Vector Magic (shareware). If that doesn't do the job for you, it's not likely anything will, though of course you'll probably need a lot of tweaking for good results.


This process is know as vectorization. It is process of converting bitmap image to vector image. There are many tools, including free, that can do this, for example http://inkscape.org/

But the result of such processing is far from perfection.

Hope this helps. Maybe I got your answer wrong, and you need to convert bitmap image to vector programmaticaly, or you're asking how to embed bitmap image into SVG image.


SVG is Scalable Vector Graphics, which effectively means drawing lines. The format is inimical to displaying an image, which is fundamentally a matrix of pixels. Lines can easily be converted to pixels, but displaying pixels as lines (or dots) is wildly inefficient and not really scalable. The alternative of attempting to discover lines within a pixilated image is fraught with peril.

If what you want is simply to recover a non-scalable image in SVG format, you might find a tool to do that. But since scaling is what SVG is for, I wanted to be sure you understood why you might have difficulty.


Open Clip Art

This link includes tools, libraries web based options and other tantalizing bits.

Enjoy


One of the best open source vectorisers is potrace. It comes as a standalone tool for the command line. Or if you prefer a GUI, it is included as part of Inkscape. Both are available for multiple OSs.


Vector Magic is by far the best tool that I know for this task. However, you can only apply vectorization for a limited number of images, after that you have to subscribe or buy a license for the desktop edition.


I have a proprietary vector drawing program that saves bitmaps, jpegs, GIFs, and Pngs to SVG format. This is the output svg text file for a specific bitmap.

<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
    <svg width="1024px" height="768px" version="1.1"
      xmlns="http://www.w3.org/2000/svg"
      xmlns:xlink= "http://www.w3.org/1999/xlink">
      <image xlink:href="C:\RedWind\Bitmaps\PrayerChild.bmp" 
                         x="20" y="20" width="384" height="428"/>
    </svg>

SVG files are pure text files. You can create them with windows notepad, MS Word, or any text file creator. You can copy this text, place it in notepad, save it to a file with ".SVG" file extension and then copy the filename i.e. "c:\bitmaps\MyBitmap.SVG" and paste it in the navigation area of your browser and it will produce the SVG file in the browser. Be sure to substitute the location of your bitmap in place of the "C:\RedWind\Bitmaps\PrayerChild.bmp." Also substitue your bitmap's position and width/height data at x, y, width, height. I hope this helps.


I have found the PicSvg website to work pretty well (for a free tool) on simple bitmap images.

[(Non)Disclaimer: I'm not affiliated with them in any way, just found it when I needed a quick tool for a project idea I was working on..]


You may just embed the bitmap within SVG as base64 encoded using the image tag

<svg>
<image xlink:href="data:image/jpeg;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==" />
</svg>

just like the img tag of html

<img src="data:image/jpeg;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==" />

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜