結論
imagecodecs というライブラリを使えばよい。
筆者が試した例の紹介
インストール
python -m pip install -U imagecodecs[all]
サンプルコードと実行結果
サンプルコードを以下に示す。
# -*- coding: utf-8 -*- import sys from imagecodecs import JPEGXR, imread if not JPEGXR.available: print("JPEG XR is not supported.") sys.exit() jpeg_xr_fname = "./Windows_HDR_Capture/600.jxr" image = imread(jpeg_xr_fname) print(f"image.shape = {image.shape}") print(f"image.dtype = {image.dtype}") print(f"image[1080, 1920] = {image[1080, 1920]}")
実行結果は以下の通り。RGBA の half float 形式であることがわかる。
image.shape = (2160, 3840, 4) image.dtype = float16 image[1080, 1920] = [4.914 4.91 4.914 1. ]
上記のサンプルコードで使用した画像データも参考までに添付しておく。
その他の情報
JPEG XR ファイルを開けるビューアソフト
- Windows 11 標準の Photos App
- Affinity Photo 2
参考資料
[1] GitHub, "cgohlke/imagecodecs", https://github.com/cgohlke/imagecodecs