Skip to content

Commit

Permalink
Merge pull request #307 from JeremyPike/comparing-compression-windows
Browse files Browse the repository at this point in the history
Comparing lossless versus lossy compression for Windows users
  • Loading branch information
tobyhodges authored Dec 19, 2023
2 parents 42bb13a + e79a076 commit 0c8bfff
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
10 changes: 6 additions & 4 deletions episodes/02-image-basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -921,20 +921,22 @@ two orders of magnitude smaller than the bitmap version.
## Comparing lossless versus lossy compression (optional, not included in timing)

Let us see a hands-on example of lossless versus lossy compression.
Once again, open a terminal and navigate to the `data/` directory.
Open a terminal (or Windows PowerShell) and navigate to the `data/` directory.
The two output images, `ws.bmp` and `ws.jpg`, should still be in the directory,
along with another image, `tree.jpg`.

We can apply lossless compression to any file by using the `zip` command.
Recall that the `ws.bmp` file contains 75,000,054 bytes.
Apply lossless compression to this image by executing the following command:
`zip ws.zip ws.bmp`.
`zip ws.zip ws.bmp`
(`Compress-Archive ws.bmp ws.zip` with PowerShell).
This command tells the computer to create a new compressed file,
`ws.zip`, from the original bitmap image.
Execute a similar command on the tree JPEG file: `zip tree.zip tree.jpg`.
Execute a similar command on the tree JPEG file: `zip tree.zip tree.jpg`
(`Compress-Archive tree.jpg tree.zip` with PowerShell).

Having created the compressed file,
use the `ls -al` command to display the contents of the directory.
use the `ls -l` command (`dir` with PowerShell) to display the contents of the directory.
How big are the compressed files?
How do those compare to the size of `ws.bmp` and `tree.jpg`?
What can you conclude from the relative sizes?
Expand Down
6 changes: 3 additions & 3 deletions episodes/03-skimage-images.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,10 @@ Don't forget to use `fig, ax = plt.subplots()` so you don't overwrite
the first image with the second.
Images may appear the same size in jupyter,
but you can see the size difference by comparing the scales for each.
You can also see the differnce in file storage size on disk by
You can also see the difference in file storage size on disk by
hovering your mouse cursor over the original
and the new file in the jupyter file browser, using `ls -l` in your shell,
or the OS file browser if it is configured to show file sizes.
and the new files in the Jupyter file browser, using `ls -l` in your shell
(`dir` with Windows PowerShell), or viewing file sizes in the OS file browser if it is configured so.

::::::::::::::: solution

Expand Down
4 changes: 4 additions & 0 deletions learners/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,4 +132,8 @@ e.g. your Desktop or a folder you have created for using in this workshop.

:::::::::::::::::::::::::

5. A small number of exercises will require you to run commands in a terminal. Windows users should
use PowerShell for this. PowerShell is probably installed by default but if not you should
[download and install](https://apps.microsoft.com/detail/9MZ1SNWT0N5D?hl=en-eg&gl=EG) it.

[figshare-data]: https://figshare.com/articles/dataset/Data_Carpentry_Image_Processing_Data_beta_/19260677

0 comments on commit 0c8bfff

Please sign in to comment.