Converting ps/any file to gif/any file for web pages with fix image size

Problem: web browsers use lousy algorithms to rescaling images. This makes graphs unreadable most of the time.

Solution: Method 3 or 4 clearly gives good results, even files are smaller!

In any case, increase the size of lines in the ps file by changing the numbers in front of 'setlinewidth' in the ps file. (One liner/script?)

Here is a comparision of different methods. Let's call the original ps file as graph.ps. Assume we want a width=300 image on the web page.

  • Method 1:

    convert graph.ps graph.gif

  • Method 2:

    convert -geometry 300x300 graph.ps graph300.ps

  • Method 3:

    convert -geometry 300x300 graph.ps graph300.gif;

    xv -> algorithm -> sharpen -> 50% -> save as graph300s.gif; (or convert -sharpen 5x20 -geometry 300x300 graph.ps graph300s.gif, but the sharpen parameter is difficult to tune.)

    link to original ps/bigger gif file

  • Method 4:

    See graph3.ps, add the following to the first non-comment line of the ps file:

    2 2 scale

    (or bigger if you're crazy) and also increase the bounding box. Then follow the step in Method 3, the result is the best, but steps are painful. (Notice the detail in word "bulk")

    Without sharpen:

  • With sharpen:

    Note: The sharpen picture is more *pleasing*, but may also be misleading, e.g. it becomes hard to distinguish the GWA and the bulk curves. Watch out for how much to sharpen!

    Suggestions/comments: tschoy@pacific.mps.ohio-state.edu