LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General > LinuxQuestions.org Member Success Stories
User Name
Password
LinuxQuestions.org Member Success Stories Just spent four hours configuring your favorite program? Just figured out a Linux problem that has been stumping you for months?
Post your Linux Success Stories here.

Notices



Reply
 
Search this Thread
Old 09-01-2011, 07:46 PM   #1
chadwick
Member
 
Registered: Apr 2005
Location: At the 100th Meridian where the great plains begin
Distribution: Debian Testing on T60 laptop
Posts: 105

Rep: Reputation: 16
Producing a good quality png/jpg/gif etc from inkscape


Producing a decent quality png from inkscape wasn't obvious to me. By the time I need to do such a thing again, I'll probably have forgotten what I did, so I'm recording here the steps involved. People who are well-versed in image manipulations will probably know other ways, but here's what worked for me.

1) From inkscape, save your file as an eps. File->Save a Copy and then choose Encapsulated Postcript (*.eps) in the dropdown for the file type. I chose Postscript Level 3 (although I don't know what the significance of that is) and resolution for rasterization of 500 dpi. It may be good to play around with this dpi resolution if that's worthwhile in your case.

2) Now we can use pstoimg to convert the ps file to a bitmapped image. In Debian, pstoimg is available in the package latex2html. The good thing about the eps file type is that it makes it easier for pstoimg to know what the appropriate boundaries of the image are. We can crop around the edges using the option "-crop a". The "-density" option allows us to control the quality of the output (as in dots per inch density).

Suppose you saved this eps file to mydir/myfile.eps
Then change to the directory mydir/ and issue a command like:

$pstoimg -crop a -density 500 myfile.eps

This by default converts to png with output myfile.png although if you look through the options it seems it allows you to produce other formats as well. But if you want another format, you can wait till step 3 anyway.

3) The result of step 2 can take up a large pixel x pixel area. Now we resize it to how many pixels we want using convert. In my case I want it 1000 pixels wide so I do:

$convert myfile.png -resize 1000 myfile.png

Note that convert can also convert to jpg or gif among other image types so say for example if you want jpg format then in this last step you can output to myfile.jpg instead:

$convert myfile.png -resize 1000 myfile.jpg

Last edited by chadwick; 09-01-2011 at 08:02 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Program to determine if a file is a valid image (jpg, png, gif, etc.) KDHofAvalon Linux - Software 7 06-09-2009 05:54 PM
gnuplot 4.2 no png, jpg or gif terminals datasink Programming 4 04-26-2007 11:13 AM
Graphics: PNG (or whatever) to GIF (without losing quality) robbbert Linux - Software 5 03-28-2007 04:07 PM
What can plotting Lat, Long on a map. (in gif, png or jpg) MikeyCarter Linux - Software 2 03-09-2007 03:07 PM
CMD line tool for PDF -> HTML or JPG/PNG/GIF ilhbutshm Linux - Software 5 10-23-2004 05:18 AM


All times are GMT -5. The time now is 05:45 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration