Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
31 views

Compression Compression Compression Compression and and and and G Hi G Hi Graphics Graphics

The document discusses different methods for representing and compressing graphical images, including vector graphics, raster graphics, and pixels. It describes common image file formats like BMP, JPEG, GIF, TIFF, and PNG. It provides details on bits per pixel, color representation, and compression algorithms like JPEG lossy compression and LZW lossless text compression. Specific examples are given to show how JPEG compression reduces file size at different quality levels with some loss of image quality. Recommendations are provided on which formats are best for different types of images.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views

Compression Compression Compression Compression and and and and G Hi G Hi Graphics Graphics

The document discusses different methods for representing and compressing graphical images, including vector graphics, raster graphics, and pixels. It describes common image file formats like BMP, JPEG, GIF, TIFF, and PNG. It provides details on bits per pixel, color representation, and compression algorithms like JPEG lossy compression and LZW lossless text compression. Specific examples are given to show how JPEG compression reduces file size at different quality levels with some loss of image quality. Recommendations are provided on which formats are best for different types of images.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

Compression and G hi Graphics

COMP370 IntrotoComputerArchitecture

Pictures
Vector Picturesaredrawnasaseriesof lines.Thehardwaredrawsalinefromp pointA topointB. Raster Picturesarerepresentedasamatrix ofpictureelementsorpixels.

PictureSizeandResolution
Screenresolutionismeasuredinhorizontal andverticalp pixelsper p inch. Agoodmonitorcandisplayabout90pixels perinch inch. Agoodprintercanprintabout600to1200 pixelsperinch. Truesizeofapicturedependsonthenumber ofpixelsandthedevice.

Pixel
Eachpixelhasacolor. Monochromepictureshaveonlytwocolors. Thecolorisusuallyrepresentedasthree numbers b that h arethe h intensity i i of fthe h three h primarycolors,Red,GreenandBlue(RGB) Thepixelrepresentsboththecolorandthe intensityordarknessofthepixel pixel.

Bits/Pixel
Thenumberofbitsittakestorepresentapixel depends p onthenumberofp possiblecolors. Blackandwhiterequiresonly1bitsperpixel. Full llcolor l pictures i require i 24bi bitsperpixel i l Simple p g graphics p canuse4or8bitsper p pixel p

GraphicsFormats
Therearemanyformatsforgraphicaldata

BMP JPEG GIF TIFF PNG etc.

BitMappedFile
BMPisaverysimpleformatforgraphics. UsedfrequentlybyMicrosoftsystem. Eachpixelisstoredasanumber.Thenumber of fbi bitsperpixel i l i isd determined i d b bythe h number b ofdifferentcolors.

BMPformat
Storesgeneralinformation BMPFileHeader abouttheBMPfile. Bitmap Storesdetailedinformation Information (DIB aboutthebitmapimage. header) h d definition fi i i of fthe h Storesthe colorsbeingusedforindexed ColorPalette colorbitmaps. Storestheactualimage, image pixel BitmapData bypixel.

BMPEfficiency
EachpixelinaBMPfileisrepresentedbya number. Thereisnocompression. It I d doesnotmatterh how complex l the h image, i thefilesizeisdeterminedbythenumberof pixelsorthesizeofthepicture.

JPEGfiles
TheJPEGformatwascreatedbytheJoint PhotographicExpertsGroup JPEGisacommonlyusedmethodof compression p forphotographic p g p images g JPEGuseslossycompression.Someimage qualityislost. lost Youcancontrolthelevelofcompressionand thereforetheimagequality. JPEGusesaDiscretecosinetransformfor compression.

JPEGExample
Q=100 81.3KB 219,726bytes ifBMP 37%ofBMP

JPEGExample
Q=50 14.7KB 18%ofQ100 6.7%ofBMP

JPEGExample
Q=25 9.32KB 11.5%ofQ100 4.2%ofBMP

JPEGExample
Q=10 4.67KB 5.7%ofQ100 2.1%ofBMP

JPEGExample
Q=1 1.48KB 1.8%ofQ100 0.67%ofBMP

JPEGArtifacts

Recommendations
BMPfilesarenotdistortedinanyway,but they yarelarge. g JPEGworkswellforphotographs GIF GI works k well llf fordi diagramsorcharts. h

TextCompressionMethods
Reducethenumberofbitspercharacter Createatableofusedcharacters.Thedatais representedasindexesintothetable. Store S repeating i characters h asaspecial i lmarker k andarunlength. LempelZivWelch(LZW)compression.

LZWCompression
LempelZivWelch(LZW)isauniversallossless datacompression p algorithm g createdby y AbrahamLempel,JacobZiv,andTerryWelch in1984 Itcreatesatableofstrings Eachtimeanewstringisfounditisenteredin thetable. Dataisrepresentedasindexesintothetable.

LZWAlgorithm
w=NIL; NIL addallpossiblecharcodes tothedictionary for(everycharactercintheuncompresseddata)do if((w+c)existsinthedictionary)then w=w+c; else add(w+c)tothedictionary; addthedictionarycodeforwtooutput; w=c; endif done addthedictionarycodeforwtooutput; displayoutput;

You might also like