spacepxl / ComfyUI-HQ-Image-Save

Load/save images and latents as 32bit EXRs
MIT License
43 stars 6 forks source link

LoadEXR: "too many indices for array: array is 2-dimensional, but 3 were indexed" #11

Open Poppi2 opened 1 month ago

Poppi2 commented 1 month ago

Hi! The attached error message appears whenever I try to generate with ObjectNormals.exr HOWEVER CameraNormals.exr loads perfectly fine. The export settings are identical. Same problem with exported depth passes and so on, only that one file works. I tried switching between rgb and rgba but to not avail. Would appreciate your help!

Issue file upload doesnt support exrs so here is a drive link containg all relevant files. https://drive.google.com/drive/folders/1i5hOtphTVBKczZMOw1IPUt1CiDyrErQq?usp=sharing This is the workflow.json

Screenshot 2024-09-29 203857

BTW you mentioned somewhere that people probably won't want to use a multipass workflow with this..Just to let you know, I want to! I think it's an interesting workflow. Using perfect cg renders as input and guiding ai generation.

ComfyUI Error Report

Error Details

Poppi2 commented 1 month ago

There is something weird going on here.. I managed to get multiple files working that weren't doing so before - by randomly trying different conversions and overwriting the files. I then did a test of dozens of conversions, doing the same thing I did before but now with dedicated names so I'd know which would work and none of them did.

If using depth render instead of normals I get this error instead. Not sure how I can further assist debugging.

ComfyUI Error Report

Error Details

spacepxl commented 1 month ago

I've just added a check to handle 2-dim (aka 1 channel) EXRs, which should prevent the initial error, although it's not really a solution to load the ObjectNormals.exr you provided. The issue there is that blender is not exporting the channels with the names that opencv expects, it's exporting XYZ instead of RGB. Opencv I think just picks the first channel if it doesn't see RGB or RGBA in the channel names.

You can see the difference in metadata by loading the renders in nuke: image

I would like to find a better solution for multichannel and non-RGBA channel names, but opencv just doesn't support that, and the proper solution, using the official OpenEXR python bindings, would require building the binaries from scratch as they don't distribute prebuilt ones for windows AFAIK.