在魔杖中缓慢打开原始文件

2024-09-26 22:53:55 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在使用wand(MagickWand API bindings for Python)生成尼康原始图像的缩略图。”文件.nef". 在

以下是部分代码:

for arquivo in os.listdir(caminho):

    # Se arquivo termina com
     if arquivo.endswith(".NEF"):

          Inicio = time.time()

          caminho_arquivo = caminho + "/" + arquivo

          with Image(filename=caminho_arquivo) as img:

               Abertura = time.time()

               print("Tempo para abrir: {}".format(int(Abertura - Inicio)))

Tempo para abrir = 12s (time to just open the file!)

在ImageMagick论坛上,我发现: http://www.imagemagick.org/

如果你不想打开链接,这里有一个简历:

^{pr2}$

这个exiftool似乎正是我所需要的。我可以通过魔杖使用exiftool吗?
有没有其他方法可以解决我的问题?

谢谢!在


Tags: 图像apifortimebindingswandmagickwandpara
1条回答
网友
1楼 · 发布于 2024-09-26 22:53:55

UPDATE! - Problem Solved!

加载图像花费这么长时间的原因是文件检测类型。一旦我使用了代码format=“raw”

with wand.Image(filename=caminho_arquivo, format="raw") as img:

现在只需不到一秒钟就可以处理75个原始文件!该死!在

我只是在读sorce代码时遇到了“format=raw”,它不在Doc中

不管怎样,希望这对将来的人有帮助。在

相关问题 更多 >

    热门问题