Develop and test a Python program that determines how many images can be stored on a given size USB (flash)
Enter USB size (GB): 4
xxxxx images in GIF format can be stored
xxxxx images in JPEG format can be stored
xxxxx images in PNG format can be stored
xxxxx images in TIFF format can be stored
The ultimate file size of a given image depends not only on the image format used, but also on the image itself. In addition, formats such as JPEG allow the user to select the degree of compression for the image quality desired. For this program, we assume the image compression ratios given below. Also assume that all the images have a resolution of 800 3 600 pixels.
Thus, for example, a 800 x 600 resolution image with 16-bit (2 bytes) color depth would have a total number of bytes of 800 x 600 x 2 = 960,000. For a compression rate of 25:1, the total number of bytes needed to store the image would be 960000/25 38400.
Finally, assume that a GB (gigabyte) equals 1,000,000,000 bytes,
Format Full Name Color Depth Compression
GIF Graphics interchange format 256 colors/ 8 bits lossless / 5:1
JPEG Joint Photographic Experts Group 16 million Colors/24 bits lossy / 25:1
PNG Portable Network Graphics 16 million Colors / 24 bits lossless / 8: 1
TIFF Tagged Image File Format 280 trillion colors / 48 bits lossless / n/a
Note that a "lossless" compression is one in which no information is lost. A "lossy" compression does lose some of the original information.
This problem has been solved!
Do you need an answer to a question different from the above? Ask your question!
Step by Step Answer:
Create a free account to access the answer
Cannot find your solution?
Post a FREE question now and get an answer within minutes. * Average response time.
Question Posted: August 24, 2016 09:50:46