Mise à jour mineure éval et svg
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
Cours de Florent.
|
||||
|
||||
# Information Theory
|
||||
|
||||
## A quick introduction to compression
|
||||
@@ -22,12 +20,12 @@ In contrast with the above where there is no loss of information, let us cite th
|
||||
If you are interested in patent controversy, which seems to be an american sport, there are historical examples with both the gif and jpg format.
|
||||
|
||||
|
||||
* (run length encoding)[https://en.wikipedia.org/wiki/Run-length_encoding]
|
||||
* (gif)[https://en.wikipedia.org/wiki/GIF]
|
||||
* (LSW)[https://en.wikipedia.org/wiki/Lempel%E2%80%93Ziv%E2%80%93Welch]
|
||||
* (jpg)[https://en.wikipedia.org/wiki/JPEG]
|
||||
* [run length encoding](https://en.wikipedia.org/wiki/Run-length_encoding)
|
||||
* [gif](https://en.wikipedia.org/wiki/GIF)
|
||||
* [LSW](https://en.wikipedia.org/wiki/Lempel%E2%80%93Ziv%E2%80%93Welch)
|
||||
* [jpg](https://en.wikipedia.org/wiki/JPEG)
|
||||
|
||||
## a digression : vectorial graphics format.
|
||||
## A digression : vectorial graphics format.
|
||||
|
||||
So far we mentionned only so called *raster graphics* formats, i.e. rectangles of pixels.
|
||||
There is an alternative, in particular for artifical images : icons, diagrams, maps etc.
|
||||
@@ -40,22 +38,79 @@ Just like HTML, this XML text format allows also many manipulation by scripting
|
||||
|
||||
You may draw some svg pictures instead of coding using for example inkscape.
|
||||
|
||||
* (svg)[https://en.wikipedia.org/wiki/SVG]
|
||||
* (tutorial and examples on w3 schools)[https://www.w3schools.com/graphics/tryit.asp?filename=trysvg_myfirst]
|
||||
* [svg](https://en.wikipedia.org/wiki/SVG)
|
||||
* [tutorial and examples on w3 schools](https://www.w3schools.com/graphics/tryit.asp?filename=trysvg_myfirst)
|
||||
|
||||
## An experiment : size does matter.
|
||||
We consider several files in the folder [jokeTextInImage](jokeTextInImage/).
|
||||
|
||||
Save them on a computer on which you have access to a terminal with basic linux commands.
|
||||
|
||||
Use the command ls with the appropriate option to find out the size that the data requires.
|
||||
|
||||
NB. the jpg file is the original "joke" I found on the web. The txt, svg and html were crafted by hand to provide the same information content (txt) and mimic the displayed format (svg, html).
|
||||
The other two png files were obtained by using the print screen option.
|
||||
|
||||
|
||||
```bash
|
||||
ls -Shl
|
||||
```
|
||||
|
||||
The manual explain the role of the options.
|
||||
```bash
|
||||
man ls
|
||||
```
|
||||
|
||||
This variant gives larger sizes (actual size on disk) because it includes meta data not just the data, and also the way the disk is organised means that block of certain minimal size are used (probably at least 4kB).
|
||||
```bash
|
||||
ls -sSh
|
||||
```
|
||||
Hang on : what does the size mean here? What is the actual unit?
|
||||
|
||||
[Byte](https://en.wikipedia.org/wiki/Byte)
|
||||
|
||||
En français on dit donc un octet (8 bits).
|
||||
For historical reasons, byte may mean e.g. 6 bits, but in practice it is now uniformly understood as 8 bits.
|
||||
|
||||
We can compute the size of the text file without too much problem.
|
||||
We just have to count the number of characters.
|
||||
We already discussed ASCII and we know that we need 7 bits, and in practice 8 bits, for a basic character as used in english speaking countries.
|
||||
|
||||
The following command can help us to the counting (manual of the command wc)
|
||||
```bash
|
||||
man wc
|
||||
```
|
||||
Number of bytes
|
||||
```bash
|
||||
wc -c joke_as_a_text_file.txt
|
||||
```
|
||||
Number of characters
|
||||
```bash
|
||||
wc -m joke_as_a_text_file.txt
|
||||
```
|
||||
is the same here.
|
||||
|
||||
It does coincide with the data size given by the ls command.
|
||||
|
||||
We can reproduce the experiment with the html and svg files (they are also text files) with the same result.
|
||||
|
||||
For the jpg file it is harder to understand why the image has this data size.
|
||||
|
||||
|
||||
|
||||
## A first concrete example of compression : image and run length encoding
|
||||
|
||||
(activité informatique débranché irem clermont)[http://www.irem.univ-bpclermont.fr/Images-numeriques]
|
||||
[activité informatique débranché irem clermont](http://www.irem.univ-bpclermont.fr/Images-numeriques)
|
||||
|
||||
## Variable length encoding : Hufman code.
|
||||
|
||||
(Hufman)[https://en.wikipedia.org/wiki/Huffman_coding]
|
||||
[Hufman](https://en.wikipedia.org/wiki/Huffman_coding)
|
||||
|
||||
|
||||
## Archive
|
||||
|
||||
(tar)["https://en.wikipedia.org/wiki/Tar_(computing)"]
|
||||
[tar]("https://en.wikipedia.org/wiki/Tar_(computing)")
|
||||
|
||||
## Backup
|
||||
|
||||
(rsync)[https://en.wikipedia.org/wiki/Rsync]
|
||||
[rsync](https://en.wikipedia.org/wiki/Rsync)
|
||||
|
Reference in New Issue
Block a user