如何在 python 中将 jpeg 转换为 tiff 文件

how to convert jpeg to tiff file in python

有什么方法可以将 .jpeg 文件转换为 .tiff 文件吗?

如果是,那该怎么做?

Python 中有许多库可以将文件从一种格式转换为另一种格式。

但是,我还没有找到关于这个问题的任何信息。

提前致谢!

see this

from PIL import Image
im = Image.open('yourImg.jpg')
im.save("pathToSave/hello.tiff", 'TIFF')

您可以为此使用 PIL (Python Imaging Library)

import Image
im = Image.open('test.jpg')
im.save('test.tiff')  # or 'test.tif'

此外,这是您在 Google 上的问题的第一个结果,请确保您首先 google 广泛。

根据 OpenCV docs for functions used for image and video reading and writing imread 确实支持 JPEG 文件并且 imwrite 可以保存 TIFF 文件,但有一些限制:

Only 8-bit (or 16-bit unsigned (CV_16U) in case of PNG, JPEG 2000, and TIFF) single-channel or 3-channel (with ‘BGR’ channel order) images can be saved using this function.