⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 39078

📁 神经网络昆斯林的新闻组分类2006
💻
📖 第 1 页 / 共 4 页
字号:
Xref: cantaloupe.srv.cs.cmu.edu comp.graphics:39078 alt.graphics.pixutils:5408 alt.binaries.pictures.utilities:4362 alt.binaries.pictures.d:8964 alt.binaries.pictures.erotica.d:15266 comp.answers:613 alt.answers:249 news.answers:8117Newsgroups: comp.graphics,alt.graphics.pixutils,alt.binaries.pictures.utilities,alt.binaries.pictures.d,alt.binaries.pictures.erotica.d,comp.answers,alt.answers,news.answersPath: cantaloupe.srv.cs.cmu.edu!tglFrom: tgl+@cs.cmu.edu (Tom Lane)Subject: JPEG image compression: Frequently Asked QuestionsMessage-ID: <jpeg-faq_736398890@g.gp.cs.cmu.edu>Followup-To: alt.binaries.pictures.dSummary: Useful info about JPEG (JPG) image files and programsKeywords: JPEG, image compression, FAQSender: news@cs.cmu.edu (Usenet News System)Supersedes: <jpeg-faq_735169170@g.gp.cs.cmu.edu>Nntp-Posting-Host: g.gp.cs.cmu.eduReply-To: jpeg-info@uunet.uu.netOrganization: School of Computer Science, Carnegie MellonDate: Mon, 3 May 1993 03:15:23 GMTApproved: news-answers-request@MIT.EduExpires: Mon, 31 May 1993 03:14:50 GMTLines: 1034Archive-name: jpeg-faqLast-modified: 2 May 1993This FAQ article discusses JPEG image compression.  Suggestions foradditions and clarifications are welcome.New since version of 18 April 1993:  * New version of XV supports 24-bit viewing for X Windows.  * New versions of DVPEG & Image Alchemy for DOS.  * New versions of Image Archiver & PMView for OS/2.  * New listing: MGIF for monochrome-display Ataris.This article includes the following sections:[1]  What is JPEG?[2]  Why use JPEG?[3]  When should I use JPEG, and when should I stick with GIF?[4]  How well does JPEG compress images?[5]  What are good "quality" settings for JPEG?[6]  Where can I get JPEG software?    [6A] "canned" software, viewers, etc.    [6B] source code[7]  What's all this hoopla about color quantization?[8]  How does JPEG work?[9]  What about lossless JPEG?[10]  Why all the argument about file formats?[11]  How do I recognize which file format I have, and what do I do about it?[12]  What about arithmetic coding?[13]  Does loss accumulate with repeated compression/decompression?[14]  What are some rules of thumb for converting GIF images to JPEG?Sections 1-6 are basic info that every JPEG user needs to know;sections 7-14 are advanced info for the curious.This article is posted every 2 weeks.  You can always find the latest versionin the news.answers archive at rtfm.mit.edu (18.70.0.226).  By FTP, fetch/pub/usenet/news.answers/jpeg-faq; or if you don't have FTP, send e-mail tomail-server@rtfm.mit.edu with body "send usenet/news.answers/jpeg-faq".Many other FAQ articles are also stored in this archive.  For moreinstructions on use of the archive, send e-mail to the same address with thewords "help" and "index" (no quotes) on separate lines.  If you don't get areply, the server may be misreading your return address; add a line such as"path myname@mysite" to specify your correct e-mail address to reply to.----------[1]  What is JPEG?JPEG (pronounced "jay-peg") is a standardized image compression mechanism.JPEG stands for Joint Photographic Experts Group, the original name of thecommittee that wrote the standard.  JPEG is designed for compressing eitherfull-color or gray-scale digital images of "natural", real-world scenes.It does not work so well on non-realistic images, such as cartoons or linedrawings.JPEG does not handle black-and-white (1-bit-per-pixel) images, nor does ithandle motion picture compression.  Standards for compressing those typesof images are being worked on by other committees, named JBIG and MPEGrespectively.JPEG is "lossy", meaning that the image you get out of decompression isn'tquite identical to what you originally put in.  The algorithm achieves muchof its compression by exploiting known limitations of the human eye, notablythe fact that small color details aren't perceived as well as small detailsof light-and-dark.  Thus, JPEG is intended for compressing images that willbe looked at by humans.  If you plan to machine-analyze your images, thesmall errors introduced by JPEG may be a problem for you, even if they areinvisible to the eye.A useful property of JPEG is that the degree of lossiness can be varied byadjusting compression parameters.  This means that the image maker can tradeoff file size against output image quality.  You can make *extremely* smallfiles if you don't mind poor quality; this is useful for indexing imagearchives, making thumbnail views or icons, etc. etc.  Conversely, if youaren't happy with the output quality at the default compression setting, youcan jack up the quality until you are satisfied, and accept lesser compression.[2]  Why use JPEG?There are two good reasons: to make your image files smaller, and to store24-bit-per-pixel color data instead of 8-bit-per-pixel data.Making image files smaller is a big win for transmitting files acrossnetworks and for archiving libraries of images.  Being able to compress a2 Mbyte full-color file down to 100 Kbytes or so makes a big difference indisk space and transmission time!  (If you are comparing GIF and JPEG, thesize ratio is more like four to one.  More details below.)If your viewing software doesn't support JPEG directly, you'll have toconvert JPEG to some other format for viewing or manipulating images.  Evenwith a JPEG-capable viewer, it takes longer to decode and view a JPEG imagethan to view an image of a simpler format (GIF, for instance).  Thus, usingJPEG is essentially a time/space tradeoff: you give up some time in order tostore or transmit an image more cheaply.It's worth noting that when network or phone transmission is involved, thetime savings from transferring a shorter file can be much greater than theextra time to decompress the file.  I'll let you do the arithmetic yourself.The other reason why JPEG will gradually replace GIF as a standard Usenetposting format is that JPEG can store full color information: 24 bits/pixel(16 million colors) instead of 8 or less (256 or fewer colors).  If you haveonly 8-bit display hardware then this may not seem like much of an advantageto you.  Within a couple of years, though, 8-bit GIF will look as obsolete asblack-and-white MacPaint format does today.  Furthermore, for reasons detailedin section 7, JPEG is far more useful than GIF for exchanging images amongpeople with widely varying color display hardware.  Hence JPEG is considerablymore appropriate than GIF for use as a Usenet posting standard.[3]  When should I use JPEG, and when should I stick with GIF?JPEG is *not* going to displace GIF entirely; for some types of images,GIF is superior in image quality, file size, or both.  One of the firstthings to learn about JPEG is which kinds of images to apply it to.As a rule of thumb, JPEG is superior to GIF for storing full-color orgray-scale images of "realistic" scenes; that means scanned photographs andsimilar material.  JPEG is superior even if you don't have 24-bit displayhardware, and it is a LOT superior if you do.  (See section 7 for details.)GIF does significantly better on images with only a few distinct colors,such as cartoons and line drawings.  In particular, large areas of pixelsthat are all *exactly* the same color are compressed very efficiently indeedby GIF.  JPEG can't squeeze these files as much as GIF does withoutintroducing visible defects.  This sort of image is best kept in GIF form.(In particular, single-color borders are quite cheap in GIF files, but theyshould be avoided in JPEG files.)JPEG also has a hard time with very sharp edges: a row of pure-black pixelsadjacent to a row of pure-white pixels, for example.  Sharp edges tend tocome out blurred unless you use a very high quality setting.  Again, thissort of thing is not found in scanned photographs, but it shows up fairlyoften in GIF files: borders, overlaid text, etc.  The blurriness isparticularly objectionable with text that's only a few pixels high.If you have a GIF with a lot of small-size overlaid text, don't JPEG it.Computer-drawn images (ray-traced scenes, for instance) usually fall betweenscanned images and cartoons in terms of complexity.  The more complex andsubtly rendered the image, the more likely that JPEG will do well on it.The same goes for semi-realistic artwork (fantasy drawings and such).Plain black-and-white (two level) images should never be converted to JPEG.You need at least about 16 gray levels before JPEG is useful for gray-scaleimages.  It should also be noted that GIF is lossless for gray-scale imagesof up to 256 levels, while JPEG is not.If you have an existing library of GIF images, you may wonder whether youshould convert them to JPEG.  You will lose a little image quality if you do.(Section 7, which argues that JPEG image quality is superior to GIF, onlyapplies if both formats start from a full-color original.  If you start froma GIF, you've already irretrievably lost a great deal of information; JPEGcan only make things worse.)  However, the disk space savings may justifyconverting anyway.  This is a decision you'll have to make for yourself.If you do convert a GIF library to JPEG, see section 14 for hints.  Beprepared to leave some images in GIF format, since some GIFs will notconvert well.[4]  How well does JPEG compress images?Pretty darn well.  Here are some sample file sizes for an image I havehandy, a 727x525 full-color image of a ship in a harbor.  The first threefiles are for comparison purposes; the rest were created with the free JPEGsoftware described in section 6B.File	   Size in bytes		Commentsship.ppm	1145040  Original file in PPM format (no compression; 24 bits			 or 3 bytes per pixel, plus a few bytes overhead)ship.ppm.Z	 963829  PPM file passed through Unix compress			 compress doesn't accomplish a lot, you'll note.			 Other text-oriented compressors give similar results.ship.gif	 240438  Converted to GIF with ppmquant -fs 256 | ppmtogif			 Most of the savings is the result of losing color			 info: GIF saves 8 bits/pixel, not 24.  (See sec. 7.)ship.jpg95	 155622  cjpeg -Q 95    (highest useful quality setting)			 This is indistinguishable from the 24-bit original,			 at least to my nonprofessional eyeballs.ship.jpg75	  58009  cjpeg -Q 75    (default setting)			 You have to look mighty darn close to distinguish this			 from the original, even with both on-screen at once.ship.jpg50	  38406  cjpeg -Q 50			 This has slight defects; if you know what to look			 for, you could tell it's been JPEGed without seeing			 the original.  Still as good image quality as many			 recent postings in Usenet pictures groups.ship.jpg25	  25192  cjpeg -Q 25			 JPEG's characteristic "blockiness" becomes apparent			 at this setting (djpeg -blocksmooth helps some).			 Still, I've seen plenty of Usenet postings that were			 of poorer image quality than this.ship.jpg5o	   6587  cjpeg -Q 5 -optimize  (-optimize cuts table overhead)			 Blocky, but perfectly satisfactory for preview or			 indexing purposes.  Note that this file is TINY:			 the compression ratio from the original is 173:1 !In this case JPEG can make a file that's a factor of four or five smallerthan a GIF of comparable quality (the -Q 75 file is every bit as good as theGIF, better if you have a full-color display).  This seems to be a typicalratio for real-world scenes.[5]  What are good "quality" settings for JPEG?Most JPEG compressors let you pick a file size vs. image quality tradeoff byselecting a quality setting.  There seems to be widespread confusion aboutthe meaning of these settings.  "Quality 95" does NOT mean "keep 95% of theinformation", as some have claimed.  The quality scale is purely arbitrary;it's not a percentage of anything.The name of the game in using JPEG is to pick the lowest quality setting(smallest file size) that decompresses into an image indistinguishable fromthe original.  This setting will vary from one image to another and from oneobserver to another, but here are some rules of thumb.The default quality setting (-Q 75) is very often the best choice.  Thissetting is about the lowest you can go without expecting to see defects in atypical image.  Try -Q 75 first; if you see defects, then go up.  Except forexperimental purposes, never go above -Q 95; saying -Q 100 will produce afile two or three times as large as -Q 95, but of hardly any better quality.If the image was less than perfect quality to begin with, you might be able togo down to -Q 50 without objectionable degradation.  On the other hand, youmight need to go to a HIGHER quality setting to avoid further degradation.The second case seems to apply much of the time when converting GIFs to JPEG.The default -Q 75 is about right for compressing 24-bit images, but -Q 85 to95 is usually better for converting GIFs (see section 14 for more info).If you want a very small file (say for preview or indexing purposes) and areprepared to tolerate large defects, a -Q setting in the range of 5 to 10 isabout right.  -Q 2 or so may be amusing as "op art".(Note: the quality settings discussed in this article apply to the free JPEGsoftware described in section 6B, and to many programs based on it.  OtherJPEG implementations, such as Image Alchemy, may use a completely differentquality scale.  Some programs don't even provide a numeric scale, just"high"/"medium"/"low"-style choices.)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -