@@ -615,13 +615,23 @@ computing platforms.
615
615
> ## Examining actual image sizes (optional, not included in timing)
616
616
>
617
617
> Let us see the effects of image compression on image size with actual images.
618
- > Open a terminal and navigate to the `code/02-image-basics/`
619
- > directory. This directory contains a simple program, `ws.py` that creates a
620
- > square white image of a specified size, and then saves it as a BMP and as a
621
- > JPEG image.
622
- >
623
- > To create a 5,000 x 5,000 white square, execute the program by typing
624
- > `python ws.py 5000` and then hitting enter. Then, examine the file sizes of
618
+ > The following script creates a square white image 5000 X 5000 pixels, and then
619
+ > saves it as a BMP and as a JPEG image.
620
+ > ~~~
621
+ > import skimage.io
622
+ > import numpy as np
623
+ >
624
+ > dim = 5000
625
+ >
626
+ > img = np.zeros((dim, dim, 3), dtype="uint8")
627
+ > img.fill(255)
628
+ >
629
+ > skimage.io.imsave(fname="data/ws.bmp", arr=img)
630
+ > skimage.io.imsave(fname="data/ws.jpg", arr=img)
631
+ > ~~~
632
+ > {: .language-python}
633
+
634
+ > Examine the file sizes of
625
635
> the two output files, `ws.bmp` and `ws.jpg`. Does the BMP image size
626
636
> match our previous prediction? How about the JPEG?
627
637
>
@@ -637,7 +647,7 @@ computing platforms.
637
647
> ## Comparing lossless versus lossy compression (optional, not included in timing)
638
648
>
639
649
> Let us see a hands-on example of lossless versus lossy compression. Once again,
640
- > open a terminal and navigate to the `code/02-image-basics /`
650
+ > open a terminal and navigate to the `data /`
641
651
> directory. The two output images, `ws.bmp` and `ws.jpg`, should still be in the directory,
642
652
> along with another image, `tree.jpg`.
643
653
>
0 commit comments