Difference between revisions of "Network data compression"

From Computer Science Wiki
(Why compression of data is often necessary when transmitting across a network)
(Difference between JPG and PNG)
 
(One intermediate revision by the same user not shown)
Line 12: Line 12:
 
</html>
 
</html>
  
== a much better video to help you understand it ==
+
== A much better video to help you understand it ==
 
This video below is used with gratitude from computerphile <ref>https://www.youtube.com/watch?v=Lto-ajuqW3w</ref>
 
This video below is used with gratitude from computerphile <ref>https://www.youtube.com/watch?v=Lto-ajuqW3w</ref>
 
<br />
 
<br />
Line 36: Line 36:
  
 
If you are still stuck, or you have other questions,  you may want to [https://discuss.computersciencewiki.org/ '''ask a question on our discussion board'''].
 
If you are still stuck, or you have other questions,  you may want to [https://discuss.computersciencewiki.org/ '''ask a question on our discussion board'''].
 +
 +
== Difference between JPG and PNG ==
 +
One of my students asked this question. I like the answer below.
 +
 +
JPG aka JPEG is a standard of the Joint Photo Experts Group and works great for photographs. It doesn’t work well for line art or text, is optimum for photos that will be seen in browsers or on phones.
 +
 +
JPG allows ‘compression’ so an image’s file-size can be reduced by a scheme that takes surrounding pixels and ‘averages’ them into a larger spot so the result is a somewhat coarser looking photo but a smaller file size.
 +
 +
JPG compression is called ‘lossy’ because you can lose all the quality of an image if you compress it too much. _Some_ compression can greatly reduce the file size, and bandwidth for downloading to a browser, without making any noticeable difference. Too much compression and it looks ‘pixelated’.
 +
 +
JPEGs don’t support transparency so the effect is always a photo with squared edges.
 +
 +
PNG is a somewhat later standard. It can make a spectacular photo, but the file-size is larger relative to the same photo in a jpg. PNG is compressible, too, but the algorithm will not compress the quality out of the image, so it’s always safe to specify max compression.
 +
 +
PNGs can also handle line art and text and keep the sharp edges. The PNG compression algorithm works really well for line art or text with solid-color backgrounds. It doesn’t reduce the file size much if it’s a busy graphic but can reduce it dramatically with line art and maintain the quality.
 +
 +
PNGs can support transparency by adding an ‘alpha channel’, another 8 bits per pixel, that holds the opacity for that pixel. By making backgrounds transparent, graphics can appear to have irregular edges on any background.
 +
 +
GIFs work well for graphics that are generated with a drawing tool, but have a very limited pallette and don’t work well for photos or scanned documents. GIFs can support transparency, and the can also be animated. BMP or ‘bit maps’ are seldom used for anything except little doodads, button faces, or other smaller graphics.
 +
 +
JPEG, PNG, GIF, or BMP are ‘web graphics formats’ and work well for stuff seen in a browser or on a phone where the effective resolution is only something like 100 dots per inch and images are relatively small.<ref>https://www.quora.com/What-is-difference-between-JPG-and-PNG</ref>
  
 
== Standards ==
 
== Standards ==

Latest revision as of 13:42, 10 February 2020

Networks[1]

Data compression involves encoding information using fewer bits than the original representation. Compression can be either lossy or lossless. Lossless compression reduces bits by identifying and eliminating statistical redundancy. No information is lost in lossless compression. Lossy compression reduces bits by removing unnecessary or less important information. The process of reducing the size of a data file is often referred to as data compression. [2]


A good INTRODUCTORY video to help you understand this[edit]

The video below is used with gratitude from code.org[3]

A much better video to help you understand it[edit]

This video below is used with gratitude from computerphile [4]

Compression has enabled information to be disseminated more rapidly.

See Also[edit]

Why compression of data is often necessary when transmitting across a network[edit]

Because networks are sensitive to congestion, and network availability is often expensive. The key reason is because compressed data can be transmitted and received much faster than non-compressed data.

Do you understand this?[edit]

If you are still stuck, or you have other questions, you may want to ask a question on our discussion board.

Difference between JPG and PNG[edit]

One of my students asked this question. I like the answer below.

JPG aka JPEG is a standard of the Joint Photo Experts Group and works great for photographs. It doesn’t work well for line art or text, is optimum for photos that will be seen in browsers or on phones.

JPG allows ‘compression’ so an image’s file-size can be reduced by a scheme that takes surrounding pixels and ‘averages’ them into a larger spot so the result is a somewhat coarser looking photo but a smaller file size.

JPG compression is called ‘lossy’ because you can lose all the quality of an image if you compress it too much. _Some_ compression can greatly reduce the file size, and bandwidth for downloading to a browser, without making any noticeable difference. Too much compression and it looks ‘pixelated’.

JPEGs don’t support transparency so the effect is always a photo with squared edges.

PNG is a somewhat later standard. It can make a spectacular photo, but the file-size is larger relative to the same photo in a jpg. PNG is compressible, too, but the algorithm will not compress the quality out of the image, so it’s always safe to specify max compression.

PNGs can also handle line art and text and keep the sharp edges. The PNG compression algorithm works really well for line art or text with solid-color backgrounds. It doesn’t reduce the file size much if it’s a busy graphic but can reduce it dramatically with line art and maintain the quality.

PNGs can support transparency by adding an ‘alpha channel’, another 8 bits per pixel, that holds the opacity for that pixel. By making backgrounds transparent, graphics can appear to have irregular edges on any background.

GIFs work well for graphics that are generated with a drawing tool, but have a very limited pallette and don’t work well for photos or scanned documents. GIFs can support transparency, and the can also be animated. BMP or ‘bit maps’ are seldom used for anything except little doodads, button faces, or other smaller graphics.

JPEG, PNG, GIF, or BMP are ‘web graphics formats’ and work well for stuff seen in a browser or on a phone where the effective resolution is only something like 100 dots per inch and images are relatively small.[5]

Standards[edit]

These standards are used from the IB Computer Science Subject Guide[6]

  • Explain why compression of data is often necessary when transmitting across a network.

References[edit]

  1. http://www.flaticon.com/
  2. https://en.wikipedia.org/wiki/Data_compression
  3. https://www.youtube.com/watch?v=By30SCp-Tsw
  4. https://www.youtube.com/watch?v=Lto-ajuqW3w
  5. https://www.quora.com/What-is-difference-between-JPG-and-PNG
  6. IB Diploma Programme Computer science guide (first examinations 2014). Cardiff, Wales, United Kingdom: International Baccalaureate Organization. January 2012.

a group or system of interconnected people or things.

a group or system of interconnected people or things.

a group or system of interconnected people or things.

Give a detailed account including reasons or causes.