From: Eric Durant Subject: Re: JPEG and Compresion Ratio Date: 03 May 2000 00:00:00 GMT Message-ID: <3910F193.81C507D5@engin.umich.edu> Content-Transfer-Encoding: 7bit References: <8enc6v$iu8$1@hercules.iupui.edu> X-Accept-Language: en,pdf Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@eecs.umich.edu X-Trace: news.eecs.umich.edu 957411791 3398 141.213.6.50 (4 May 2000 03:43:11 GMT) Organization: EECS Dept. Univ. of Michigan Mime-Version: 1.0 Newsgroups: comp.soft-sys.matlab,sci.image.processing omirf wrote: >IMWRITE function in Image Procesing Toolbox of Matlab [...] >2. I am trying to assess the actual compression provied by this >function. I can compare the file sizes for original and compressed >images. However, this might be misleading due to the existance of >file header, which might be independent of compression ratio. Can >you suggest a method to estimate the actual compression acheived, >assuming one has non-compressed and compressed images. The other followups are generally correct. To make it explicit -- there is no simple relation between the quality factor and the compression ratio; it depends upon the image. You should be safe assuming the header sizes are approximately constant for a given program. Software can insert optional information, such as the creator name, into the JPEG stream, so the bytes of side information may vary significantly between programs. If you want the true compression ratio, you could write a program to parse through the JPEG file and add up the lengths of the image data blocks. I wrote a program in C++ a couple of years ago to extract the image size block from a JPEG file; in the process, it finds blocks and interprets their length fields. This may be useful as a basis for such a program. It is available on my Website. The following is a good article on the details of JPEG compression. It does not discuss the JFIF stream format, though. @ARTICLE{Wal91, author = "Gregory K. Wallace", title = "The {JPEG} still picture compression standard", journal = "Communications of the ACM", year = 1991, volume = 34, number = 4, pages = "30--44", month = apr, } -- Eric Durant http://www.edurant.com/