Proud of myself for writing this. If there are any suggestions for improvement, let me know! I find this totally cool. You’ll need to give it a directory with a few “jpg” images to run it.
QUESTION:
When I run the code, I get the output below. From that output, it looks like the color depth per pixel is 2 bytes each for r, g, b, a:
16 + 16 + 16 + 16 = 64 bits per pixel
Wikipedia tells me that “Images can have 64-bit pixels with 48-bit color and a 16-bit alpha channel.” (https://en.wikipedia.org/wiki/Color_depth)
When I multiply the color depth per pixel * the total number of pixels, I get a number that doesn’t correspond to the file’s actual size. Is this difference because the file is compressed?
Image 0 pixel 0 r g b a: {60244 62058 63494 65535}
Image 0 pixel 1 r g b a: {60244 62058 63494 65535}
Image 0 pixel 2 r g b a: {60244 62058 63494 65535}
Image 0 pixel 3 r g b a: {60244 62058 63494 65535}
Image 0 pixel 4 r g b a: {60501 62403 63297 65535}
Image 0 pixel 5 r g b a: {60501 62403 63297 65535}
Image 0 pixel 6 r g b a: {60244 62146 63040 65535}
Image 0 pixel 7 r g b a: {60244 62146 63040 65535}
Image 0 pixel 8 r g b a: {60758 62660 63554 65535}
Image 0 pixel 9 r g b a: {60758 62660 63554 65535}
Image 0 pixel 10 r g b a: {61015 62829 64265 65535}
Image 1 pixel 0 r g b a: {1825 14201 32552 65535}
Image 1 pixel 1 r g b a: {1311 13687 32038 65535}
Image 1 pixel 2 r g b a: {1825 14201 32552 65535}
Image 1 pixel 3 r g b a: {2082 14458 32809 65535}
Image 1 pixel 4 r g b a: {1568 13944 32295 65535}
Image 1 pixel 5 r g b a: {1568 13856 32749 65535}
Image 1 pixel 6 r g b a: {1825 14113 33006 65535}
Image 1 pixel 7 r g b a: {1568 13856 32749 65535}
Image 1 pixel 8 r g b a: {1311 13687 32038 65535}
Image 1 pixel 9 r g b a: {1311 13687 32038 65535}
Image 1 pixel 10 r g b a: {1568 13944 32295 65535}
Image 2 pixel 0 r g b a: {65535 65535 65535 65535}
Image 2 pixel 1 r g b a: {65535 65535 65535 65535}
Image 2 pixel 2 r g b a: {65535 65535 65535 65535}
Image 2 pixel 3 r g b a: {65535 65535 65535 65535}
Image 2 pixel 4 r g b a: {65535 65535 65535 65535}
Image 2 pixel 5 r g b a: {65535 65535 65535 65535}
Image 2 pixel 6 r g b a: {65535 65535 65535 65535}
Image 2 pixel 7 r g b a: {65535 65535 65535 65535}
Image 2 pixel 8 r g b a: {65535 65535 65535 65535}
Image 2 pixel 9 r g b a: {65535 65535 65535 65535}
Image 2 pixel 10 r g b a: {65535 65535 65535 65535}
Image 3 pixel 0 r g b a: {65535 65535 65535 65535}
Image 3 pixel 1 r g b a: {65535 65535 65535 65535}
Image 3 pixel 2 r g b a: {65535 65535 65535 65535}
Image 3 pixel 3 r g b a: {65535 65535 65535 65535}
Image 3 pixel 4 r g b a: {65535 65535 65535 65535}
Image 3 pixel 5 r g b a: {65535 65535 65535 65535}
Image 3 pixel 6 r g b a: {65535 65535 65535 65535}
Image 3 pixel 7 r g b a: {65535 65535 65535 65535}
Image 3 pixel 8 r g b a: {65535 65535 65535 65535}
Image 3 pixel 9 r g b a: {65535 65535 65535 65535}
Image 3 pixel 10 r g b a: {65535 65535 65535 65535}