在魔杖中缓慢打开RAW文件

问题描述 投票:0回答:1

我正在使用魔杖(Python的MagickWand API绑定)生成尼康原始图像“file.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(打开文件的时间!)

搜索ImageMagick论坛,我发现了这个:http://www.imagemagick.org/

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

For a file from a Nikon D800 camera, exiftool shows:

 Composite:JpgFromRaw='(Binary data 2307391 bytes, use -b option to extract)'
 Composite:OtherImage='(Binary data 918709 bytes, use -b option to extract)'
 Composite:PreviewImage='(Binary data 101723 bytes, use -b option to extract)'

ImageMagick can't see these images. They can be extracted by exiftool:

exiftool -JpgFromRaw -b AGA_2983.NEF >fromraw.jpg
exiftool -OtherImage -b AGA_2983.NEF >other.jpg
exiftool -PreviewImage -b AGA_2983.NEF >preview.jpg

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

谢谢!

python thumbnails wand
1个回答
0
投票

UPDATE! - 问题解决了!

加载图像需要这么长时间的原因是文件检测的类型。一旦我使用代码格式=“raw”如下:

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

现在花了不到一秒钟来处理75个原始文件!该死的!

我只看到“format = raw”阅读源代码,它不在Doc的中。

无论如何,希望这有助于将来的某个人。

© www.soinside.com 2019 - 2024. All rights reserved.