I'd prefer explicit check for that, like this:
```
if depth == 1:
    bytes_per_pixel = 1
else:
    bytes_per_pixel = depth // 8
```