2

JPEG-XR 画像を JPG 形式に変換できるようにする必要があり、ImageMagick 自体でこれを機能させました。ただし、Python アプリケーションからこれを実行できるようにする必要があり、Wand の使用を検討しています。Wand が JXR 画像へのパスを適切に使用していないようです。

with open(os.path.join(args.save_location, img_name[0], result[0]+".jxr"), "wb") as output_file:
    output_file.write(result[1])
    with Image(filename=os.path.join(args.save_location, img_name[0], result[0]+".jxr")) as original:
        with original.convert('jpeg') as converted:
            print(converted.format)
            pass

この最初の部分 - output_file の作成と結果 [1] (SQLite データベースからの JXR 画像のブロブ) の書き込み - は正常に動作します。ただし、Python と Wand を使用して新しく保存したファイルを画像として開こうとすると、Wand が画像の正しい場所を検索していないことを最終的に示唆するエラーが表示されます。

    Extracting panorama 00000
FAILED: -102=pWS->Read(pWS, szSig, sizeof(szSig))
        JXRGlueJxr.c:1806
FAILED: -102=ReadContainer(pID)
        JXRGlueJxr.c:1846
FAILED: -102=pDecoder->Initialize(pDecoder, pStream)
        JXRGlue.c:426
FAILED: -102=pCodecFactory->CreateDecoderFromFile(args.szInputFile, &pDecoder)
        e:\coding\python\sqlite panoramic image extraction tool\jxrlib\jxrencoderdecoder\jxrdecapp.c:477

JPEG XR Decoder Utility
Copyright 2013 Microsoft Corporation - All Rights Reserved

... [it outputs its help page in case of errors; snipped]

The system cannot find the file specified.
Traceback (most recent call last):
  File "E:\Coding\Python\SQLite Panoramic Image Extraction Tool\SQLitePanoramicImageExtractor\trunk\PanoramicImageExtractor.py", line 88, in <module>
    with Image(filename=os.path.join(args.save_location, img_name[0], result[0]+".jxr")) as original:
  File "C:\Python34\lib\site-packages\wand\image.py", line 1991, in __init__
    self.read(filename=filename, resolution=resolution)
  File "C:\Python34\lib\site-packages\wand\image.py", line 2048, in read
    self.raise_exception()
  File "C:\Python34\lib\site-packages\wand\resource.py", line 222, in raise_exception
    raise e
wand.exceptions.BlobError: unable to open image `C:/Users/RPALIW~1/AppData/Local/Temp/magick-14988CnJoJDwMRL4t': No such file or directory @ error/blob.c/OpenBlob/2674

最後に見られるように、一時ファイル「C:/Users/RPALIW~1/AppData/Local/Temp/magick-14988CnJoJDwMRL4」を開こうとして実行しようとしたようです。この時点で使用されるファイル名は、画像をファイルとして保存するために使用されるファイル名とまったく同じである必要がありますが、Wand は別のものに置き換えましたか? これは、週末に修正された ImageMagick で発生した最後の問題と似ています (詳細はこちら: http://www.imagemagick.org/discourse-server/viewtopic.php?f=1&t=27027&p=119702# p119702)。

Wand で JXR 画像を Python で画像として開き、別の形式に変換することに成功した人はいますか? ここで何か間違ったことをしていますか、それとも ImageMagick または Wand のせいですか?

4

1 に答える 1

0

非常によく似たことが私に起こっています。エラーが発生します:

wand.exceptions.BlobError: unable to open image `/var/tmp/magick-454874W--g1RQEK3H.ppm': No such file or directory @ error/blob.c/OpenBlob/2701

指定されたパスは、開こうとしている画像のファイル パスではありません。

ドキュメントから:

バイナリ ラージ オブジェクトの割り当て、読み取り、または書き込みができませんでした。

そして、大きなファイルを開こうとしています。(18MB .cr)。ファイルサイズが問題でしょうか?

私のため:

from wand.image import Image as WImage

with open(file_name, 'r+') as f:
    with WImage(file = f) as img:
        print 'Opened large image'

または:

with open(file_name, 'r+') as f:
    image_binary = f.read()

    with WImage(blob = image_binary) as img:
        print 'Opened Large Image'

トリックをした

〜ビクター

于 2015-02-20T04:21:58.603 に答える