I want to open a .tif image but I always get error for every library I tried to use. I tried with PIL:
from PIL import Image
img = Image.open('filepath/img_name.tif')
but I get the following error:
UnidentifiedImageError: cannot identify image file 'filepath/img_name.tif'
(This error does not mean that I can not find the file so the directory should be good)
I tried with tifffile:
import tifffile
img = tifffile.imread('filepath/img_name.tif')
I got the following error:
NotImplementedError: unpacking 14-bit integers to uint16 not supported.
I am pretty sure the problem is that the picture because I tried to open a tif image on the internet and it work just by doing this: this is the picture
from PIL import Image
im = Image.open('a_image.tif')
Is there a way to convert my 14-bit picture to a 16-bit picture? (I know that I could multiply by 4 to get to 16-bit but I do not know how)
I installed imagedecodecs and tifffile has been able to open it
import tifffile
img = tifffile.imread(tif_name)
The problem was that my image was in 14bits.