Monday, April 25, 2011

Converting jpg files to svg

I am by no means a graphic designer. In fact, I am quite far from it. I do however have a need at times to work with images to get the results that I need, and like a lot of developers out there, I don't exactly have the funds to just hire one, nor do I know any (which would be incredibly handy sometimes, gotta say).

Today I was looking at some images online and found one that really liked, but was only able to get it in .jpg format. So, I did some digging and found handy instructions over here that guided me to converting the jpg to an svg (Scalable Vector Graphics) file. Once converted I was able to re-size the image without pixelation or blurring.

The instructions, as were provided, are for doing this under Ubuntu Linux, which I run. If you are on another OS, sorry, you will have to either see if this application is available for your system or find a similar application that will do the job.

To Convert .jpg files to .svg format:

1. Install Inkscape, if not already installed: sudo apt-get install inkscape
2. Start Inkscape after it is installed and then import the image under File->Import
3. Using the arrows on the image, re-size it to the size you wish, then hover your cursor over the image and hit Ctrl-Shift-D. That will bring up the Document Properties box.
4. Click on the Shrink To Fit button to re-size the image desktop to your images size.
5. Client File->Save As to save your image. It will default to a .svg file.

That is it. That's all there is to it. Hope this helps you in your quest, if you had one.


Cd-MaN said...


Maybe I'm misunderstanding, but it seems to me that two issues are conflated here:

1. Resizing bitmap images using an algorithm which is well-suited to real-case situations and doesn't lead to blur of artifacts (like Lanczos or Sinc3). If I'm understanding your post correctly, this is what you're doing. You don't need Inkscape for this, in fact Inkscape isn't the optima tool for this, since it is a vector graphics editing program, not a bitmap editing program.

2. Converting bitmaps to vector graphics and scaling those. This is done using the Path -> Trace Bitmap option in Inkscape, however the result might not be what you are expecting (you will get a "cartoonish" effect).

Numberwhun said...

Hey, cdman83:

My issue was that I downloaded an image that is a .jpg file. I wanted to increase its size a bit, but when doing so in GIMP, it got all blury and pixelized.

So, my first thought was to get it converted to something more scalable, like a png file. I came across the article that I linked to and it seemed to work.

I wasn't taking into account algorithms or anything. In Inkscape, I was able to grab the arrows around the image and resize it that way, then adjust the workspace to fit it. It seemed to work fine. I will have to play with the Path->Trace Bitmap though and get to know it.

Thanks for the post. :)

Cd-MaN said...

Just a short follow up: both PNG and JPG are "raster" files, so scaling them would give the same result (as opposed to vector formats like SVG). Also, there is no perfect way to convert from raster to vector formats "perfectly".

Also, in GIMP when you go to Image -> Scale image you can select Quality -> Interpolation and select different algoritms (Sinc / Lanczos3 is usually the best for photographs).

Numberwhun said...

Thanks a bunch for the update. I definitely appreciate the insight.

Creative Commons License
This work is licensed under a Creative Commons Attribution 3.0 License.