User: Password:
|
|
Subscribe / Log in / New account

[OT] JPEG + graphs == hideous

[OT] JPEG + graphs == hideous

Posted Jan 11, 2008 3:12 UTC (Fri) by roelofs (guest, #2599)
In reply to: [OT] JPEG + graphs == hideous by PaulMcKenney
Parent article: What is RCU? Part 2: Usage

No apologies necessary! Sorry if I was a little strident, but this comes up over and over again, and it seemed like the time was ripe for a public-service announcement. ;-) (And while bandwidth is far less of an issue these days than it was 15 years ago, I'm still an efficiency geek. Why use 3 KB when 1 KB would suffice?)

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.

Greg


(Log in to post comments)

[OT] JPEG + graphs == hideous

Posted Jan 11, 2008 5:35 UTC (Fri) by PaulMcKenney (subscriber, #9624) [Link]

Well, there certainly still are geographies where the bandwidth is quite restricted, so I cannot complain.

For xfig, how about this .gif, as opposed to the six-times-bigger .jpg?

For gnuplot, how about this .gif, as opposed to the nine-times-bigger .jpg?

Now I just have to remember to cut-and-paste from the right set of scripts for next time!

[OT] JPEG + graphs == hideous

Posted Jan 11, 2008 6:42 UTC (Fri) by roelofs (guest, #2599) [Link]

For xfig, how about this .gif, as opposed to the six-times-bigger .jpg?

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.)

Greg

[OT] JPEG + graphs == hideous

Posted Jan 15, 2008 6:13 UTC (Tue) by PaulMcKenney (subscriber, #9624) [Link]

Cool!  I just installed pngcrush, will try it out!


Copyright © 2017, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds