Not logged in
Log in now
Create an account
Subscribe to LWN
LWN.net Weekly Edition for May 23, 2013
An "enum" for Python 3
An unexpected perf feature
LWN.net Weekly Edition for May 16, 2013
A look at the PyPy 2.0 release
Please accept my apologies for the excessive bandwidth and low quality! For my future
reference, if you have a recommended sequence of commands to get xfig, gnuplot, and Gnome's
screenshot capability to generate optimal images, please let me know.
[OT] JPEG + graphs == hideous
Posted Jan 11, 2008 1:24 UTC (Fri) by PaulMcKenney (subscriber, #9624)
(You have to understand that I started out doing character-graphics plots on machines that
didn't even support lower-case alphabetic characters. So I cannot trust my own judgement and
aesthetics with these new-fangled bit-map plots. Even the jpegs look wonderful to me!)
Posted Jan 11, 2008 3:12 UTC (Fri) by roelofs (guest, #2599)
Anyway, I'm most familiar with gnuplot, which has both "png" and "gif" terminal types; a simple set terminal png or set terminal gif command will select one of them, and you can set the filename with set out 'foo.png', for example. Then replot or whatever you normally do.
xfig is a vector editor that uses its own .fig format by default, but it can export to all sorts of things, including PNG and GIF, if you've got the requisite helper apps installed. I think I've used it about once--and more than a decade ago at that--but according to the manual, you just bring up the export menu and select "Language" (a.k.a. output format) from the dropdown at the top. Alternatively, you can set the Fig.exportLanguage resource in your .Xdefaults file. Or you could just save to PostScript and use Ghostscript to convert to PNG or GIF, or ps2pdf and your favorite PDF viewer, or use a screen-capture utility.
I haven't used GNOME's screenshot function and don't actually have a GNOME desktop handy anymore (Slackware dropped it :-) ), but I'd bet it's based on imlib2, which has had PNG support pretty much forever. Alternatively, if you've got PBMPLUS/NetPBM installed, you can do xwd -out foo.xwd (and click on relevant window) and then xwdtopnm foo.xwd | pnmtopng > foo.png (or similar). No doubt ImageMagick/GraphicsMagick are also capable of doing such conversions. And then there's XV, which I currently sort of maintain (for loose definitions of "maintain"); it's not Free software, but it's really well written and can capture screenshots and write them out in many formats.
Posted Jan 11, 2008 5:35 UTC (Fri) by PaulMcKenney (subscriber, #9624)
For xfig, how about this
.gif, as opposed to the six-times-bigger
For gnuplot, how about this
as opposed to the nine-times-bigger
Now I just have to remember to cut-and-paste from the right set of scripts for next time!
Posted Jan 11, 2008 6:42 UTC (Fri) by roelofs (guest, #2599)
Indeed--and notice how the red dashed line is so much brighter now, and the black-on-green text is far sharper? JPEG hates sharp boundaries. (Gibbs' phenomenon and all.)
For gnuplot, how about this .gif, as opposed to the nine-times-bigger .jpg?
You (or gnuplot) must have used a very high quality setting for the JPEG, because that nine-times-bigger JPEG is actually grayscale (i.e., nominally one-third the raw data, or at least one-half given the usual YCbCr subsampling of the color channels in a three-component JPEG). Indeed, it's so high-quality that it has only four gray shades in it (two white, two black) and is visibly flawless even to my eye.
Just for jollies, I converted your images to PNG (gif2png -s rwlock*.gif) and then ran them through pngcrush (pngcrush -brute -e -crb.png -rem alla rwlock*.png). Here are the results:
44965 Jan 10 21:13 rwlockRCUupdate.jpg // 24-bit, 504 x 350 (xfig)
7266 Jan 10 21:10 rwlockRCUupdate.gif // 3-bit palette
3350 Jan 10 22:13 rwlockRCUupdate.png // 4-bit palette (gif2png)
2867 Jan 10 22:13 rwlockRCUupdate-crb.png // 4-bit palette (pngcrush)
45664 Jan 10 21:22 rwlockRCUperfwtPREEMPT.jpg // 8-bit, 640 x 480 (gnuplot)
4940 Jan 10 21:22 rwlockRCUperfwtPREEMPT.gif // 1-bit palette
3326 Jan 10 22:13 rwlockRCUperfwtPREEMPT.png // 1-bit grayscale (gif2png)
2967 Jan 10 22:13 rwlockRCUperfwtPREEMPT-crb.png // 1-bit grayscale (pngcrush)
In short, more than a factor of 15 smaller than the JPEGs, yet perfect quality. (These are the kinds of images for which PNG was designed.)
Posted Jan 15, 2008 6:13 UTC (Tue) by PaulMcKenney (subscriber, #9624)
Cool! I just installed pngcrush, will try it out!
Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds