I am trying to convert a group of 24 bit-per-pixel bitmap files into 16 bit-per-pixel images.
After looking around it appeared that Python's Image Library (PIL) could do it but so far I have only been able to do 8 or 24 bit picture exports. I need five bits per color 5 bits per channel and 1 alpha bit. What method of converting should I use? Here is my code:
import os
from PIL import Image
file_list = []
location = "C:/bad_images"
os.chdir(location)
for file in os.listdir(location):
if file.endswith(".bmp"):
BMP_file = os.path.basename(file)
print(os.path.join("/mydir", file))
##im = Image.open(BMP_file).convert("RGB", colors = 256) ##Does not
work Nor does L
im = Image.open(BMP_file).convert("P", colors = 256)
im.save('converted/' + BMP_file)
The images this script spits out are 8 bit colors. I cannot find any examples of 16 bit format. Thanks!