svg to jpg quality

Post questions on how to use or achieve an effect in Inkscape.
majayogev
Posts: 3
Joined: Mon Jul 16, 2012 4:16 pm

svg to jpg quality

Postby majayogev » Mon Jul 16, 2012 4:31 pm

I have made this simple photo with text in inkscape and transformed it to jpg using gimp.
Somehow the text always comes out unclear. Is that because of the fonts or because of the svg - jpg transforming? How should I transform from svg to jpg so that the quality stays the same?
Thank you
Attachments
diy.jpg
diy.jpg (31.08 KiB) Viewed 8679 times

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: svg to jpg quality

Postby brynn » Mon Jul 16, 2012 5:24 pm

Image
Welcome to InkscapeForum!

As you've learned, Inkscape cannot save or export JPGs directly. Using GIMP is as good of a program to use, as any. I think the problem is the conversion itself. Especially with raster formats, it's my understanding that every time you convert to another format, a little but of quality is lost. So if you stick with JPG, this is probably unavoidable.

But I'm wondering if you have some requirement for it to be a JPG? Because Inkscape can export PNGs, using File menu > Export Bitmap. You probably would not notice as much change in quality if you use that.

If you are stuck with JPG for some reason though, I'm pretty sure there should be a way to retain most of the SVG quality. I'm not very familiar with GIMP, but I think in GIMP's JPG dialog, there's an option for resolution. It can't make a poor quality image better, so don't use the already converted JPG. But starting with the SVG, see if you can find some way to change the resolution (possibly called DPI??).

(And by the way, if you do try exporting a PNG with Inkscape, don't change the DPI in the Export Bitmap dialog. While you may find that changing the DPI in GIMP affects the quality of the image, changing the DPI in Inkscape's Export Bitmap does not -- it only changes the size of the resulting image. I know it doesn't make sense, and I sure wish I understood it better myself.)

majayogev
Posts: 3
Joined: Mon Jul 16, 2012 4:16 pm

Re: svg to jpg quality

Postby majayogev » Mon Jul 16, 2012 6:32 pm

Hi!
Thank you so much for your fast response! :)
I've tried all the possibilities you wrote and you are right, the export bitmap looks the best! It's also much faster to do that then going through Gimp. Anyhow, just so you know, I tried to change resolution in the gimp's dialog and it didn't help at all.
Hmm...I just hope that facebook/blogs/websites etc all can use PNG instead of JPG? Sorry if this is a totally beginners question...
Thanks again and have a great day!
Maja

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: svg to jpg quality

Postby brynn » Mon Jul 16, 2012 6:50 pm

Hi Maja,
I'd be surprised if they won't accept PNGs. I don't know for sure, but it's a pretty universally accepted format these days.

majayogev
Posts: 3
Joined: Mon Jul 16, 2012 4:16 pm

Re: svg to jpg quality

Postby majayogev » Mon Jul 16, 2012 7:09 pm

ok...thanks a lot!
;)

fizzcat
Posts: 46
Joined: Fri Jul 15, 2011 7:26 pm

Re: svg to jpg quality

Postby fizzcat » Mon Jul 16, 2012 8:00 pm

I don't really understand Brynn's comment about dpi in the Export Bitmap dialog. If you change the dpi figure in the Bitmap Size part of the dialog it does update the bitmap size for you (I've done it lots of times!). This means that the PNG bitmap can be displayed at a larger size before the pixels become noticeable. It is true that an image used for facebook/website will not show an improvement in quality if the resolution is better than around 90dpi - but that is because screens only work at 70-90 dpi. That isn't the case if you want to print out the image or allow someone to zoom in.

JPG is a lossy format - the image is compressed using software that loses a bit of information each time. This can make the image blurry if saved multiple times. Also JPG is optimised for photographs - soft changes in contrast. Text can cause problems with the compression software as text has hard sharp edges. With GIMP you have a quality slider when you save an image as a JPG for the first time. You can wind it up and down to compress the image more or less and see what the effect is on the hard edges.

I never supply images in JPG. The Print world mostly uses TIF (or TIFF if you like). This is a lossless format, so it doesn't blur edges at all. This is a pretty well established format so you may find that it is acceptable. GIMP can read in your PNG image and save it as TIF, and even compress the image using a lossless software compression. This makes the file size smaller without causing the problems that using JPG can have.

Like you I have found that the best way to get a good raster image with Inkscape/GIMP is to decide on the final image size and output a PNG with the resolution set by the Export Bitmap dialog. In this case I only use GIMP to change the format from PNG to TIFF. The quality of SVG to raster conversion seems to be better using Inkscape than reading an SVG directly into GIMP.

However YMMV

Clive

EDIT Howdy again
Just opened up the image in GIMP. You need to reconvert SVG to bitmap again, but using a higher resolution (bigger DPI) in the export dialog. The letters in the words "zippered pouch" are only 2 or 3 pixels wide. This is giving the lumpy variation in stroke width. Simply increasing the resolution in GIMP won't do - you need to reconvert from SVG to bitmap again but at a higher resolution. Currently the image is 661 by 339. Try exporting at 1322 by 678 and see what happens. You should find that there is less breaking up of the strokes on the text even when you convert to JPG.

User avatar
Xav
Posts: 1209
Joined: Fri May 08, 2009 1:18 am
Location: UK
Contact:

Re: svg to jpg quality

Postby Xav » Mon Jul 16, 2012 9:14 pm

brynn wrote:I'd be surprised if they won't accept PNGs. I don't know for sure, but it's a pretty universally accepted format these days.


It's rare to find a site that doesn't accept PNG now, and browsers without PNG support are rarer still. Even old versions of Internet Explorer (5, 6) support PNGs although they didn't support alpha transparency without additional hacks. If your final export image doesn't have any transparent areas then this won't be an issue anyway.

JPEG is a lossy format - that is to say that some data is discarded when it's saved. This is usually fine for photographic images, where there is enough noise and variation in an image for the missing data to pass unnoticed. For logos or other images with large areas of flat colour this missing data is often more visible, which would seem to be the problem you're facing here.

Ideally there would be a format that lets you store the background image as JPEG, but overlay it with a lossless version of the text. Unfortunately there's no one format that can do this whilst still being broadly compatible with most websites and browsers. Ironically the SVG format that Inkscape uses does allow for exactly this approach, but website support is still somewhat lacking for SVG, even though most modern browsers could handle it.

In summary: if you use PNG the text will be okay, but the image file size will be significantly larger. If you use JPEG then the file size will be smaller, but the text may suffer. You might want to try exporting with various values for the Quality setting of the JPEG image to see if you can find one that produces acceptable text, whilst still remaining smaller than Inkscape's PNG export.
Co-creator of The Greys and Monsters, Inked - Inkscape drawn webcomics
Web SiteFacebookTwitter


Return to “Help with using Inkscape”