if colorspace.reverse_pixels_in_byte:
# Reverse the shift by subtracting it from the leftmost shift
shift = (pixels_per_byte - 1) * colorspace.depth - shift
if colorspace.reverse_pixels_in_byte:
# Reverse the shift by subtracting it from the leftmost shift
shift = (pixels_per_byte - 1) * colorspace.depth - shift