Image file format: Difference between revisions

Content deleted Content added
m grammer issue fixes , citation fixes
it was fine before
 
Line 11:
 
== Image file sizes ==
The size of raster image files is positively correlated with the number of pixels in the image and the color depth (bits per pixel). However, imagesImages can be compressed in various ways, however. A compression [[algorithm]] stores either an exact representation or an approximation of the original image in a smaller number of bytes, whichthat can later be expanded back to its uncompressed form usingwith a corresponding decompression algorithm. Images with the same number of pixels and color depth can have very different compressed file sizes. Considering exactly the same compression, number of pixels, and color depth for two images, different graphical complexity of the original images may also result in very different file sizes after compression due to the nature of compression algorithms. With some compression formats, images that are less complex may result in smaller compressed file sizes. This characteristic sometimes results in a smaller file size for some lossless formats than lossy formats. For example, graphically simple images (i.e., images with large continuous regions like line art or animation sequences) may be losslessly compressed into a GIF or PNG format and result in a smaller file size than a lossy JPEG format.
 
For instanceexample, a 640 × 480640{{resx}}480 pixel image with 24-bit color would occupy almost onea megabyte of space:
Images with the same number of pixels and color depth can still have very different compressed file sizes. When applying the same compression method to two images with identical pixel counts and color depth, variations in the graphical complexity of the images may lead to different file sizes after compression. In some formats, less complex images result in smaller compressed file sizes. This can even cause certain lossless formats to produce smaller files than lossy formats. For example, graphically simple images (i.e., those with large continuous regions, such as line art or animation sequences) may be losslessly compressed into GIF or PNG formats, resulting in smaller file sizes than when compressed into a lossy JPEG format.
 
:640 × {{resx}}480 × {{resx}}24 = 7,372,800  bits = 921,600  bytes = 900  [[KiB]]
For instance, a 640 × 480 pixel image with 24-bit color would occupy almost one megabyte of space:
 
With vector images, the file size increases only with the addition of more vectors.
640 × 480 × 24 = 7,372,800 bits = 921,600 bytes ≈ 900 KiB
 
In contrast, the size of vector images increases only with the addition of more vectors.<ref>{{Cite web |last=zaryab |first=zaryab |title=How to Resize Images Easily Without Losing Quality: A Complete Guide |url=https://medium.com/@sark60362/how-to-resize-images-easily-without-losing-quality-a-complete-guide-247b2a874914 |url-status=live |archive-url=https://medium.com/@sark60362/how-to-resize-images-easily-without-losing-quality-a-complete-guide-247b2a874914 |archive-date=Aug 10, 2025 |access-date=Aug 10, 2025 |website=medium .com}}</ref>
 
== Image file compression ==
There are two main types of '''[[image file compression]]''' algorithms: '''[[lossless''']] and '''[[lossy''' (Author, Year)]].
 
'''Lossless compression''' algorithms reduce file size<ref>{{Cite web |last=zaryab |first=zaryab |title=https://medium.com/@sark60362/how-to-compress-images-for-website-speed-28eb72ee174d |url=https://medium.com/@sark60362/how-to-compress-images-for-website-speed-28eb72ee174d |url-status=live |archive-url=https://medium.com/@sark60362/how-to-compress-images-for-website-speed-28eb72ee174d |access-date=Aug 23, 2025 |website=medium .com}}</ref> while preserving a perfect copy of the original uncompressed image. Although losslessLossless compression generally, but not always, results in larger files than lossy compression,. it isLossless preferablecompression whenshould repeatedbe editingused is required, as it prevents the accumulation of quality lossto fromavoid multipleaccumulating stages of re-compression (Author,when Year)editing images.
 
In contrast, lossy'''Lossy compression''' algorithms createpreserve a representation of the original uncompressed image that may appear identical to thebe uncompresseda versionperfect copy, but is not ana exactperfect copy. Lossy Often lossy compression is often able to achieve smaller file sizes than lossless methodscompression. Many Most lossy compression algorithms also allow for adjustablevariable compression levels,that enabling users to tradetrades image quality for reduced file size (Author, Year).
 
== Major graphic file formats ==