mcmonkeyprojects/sd-infinity-grid-generator-script

feature request: easy display of full gen info if present

itswhateverman opened this issue · 2 comments

If i find something cool in a large grid I can save it again, or work backward to derive where it lives on disk but it would be nice if there were an easier way to see full gen info (for a selected image) as well as path on disk (perhaps in pop out/over suggested in #5.
Thanks!

The path is now displayed in the popup for #5.

I'd like to display the image's metadata there, but, I ... can't? I'm very confused right now. I can't see to find any way to read the metadata on an image, nor any way to read the binary content of an image file in JavaScript to be able to read the image metadata,

The only way to load the binary data directly appears to require JavaScript functions that have very strict cross-origin control - ie it can't work for a webpage stored on your own local filesystem.
The display in the Automatic1111 WebUI png info tab only works because it forces you to directly upload a file first, and directly uploaded individual files may have their binary data scanned.

Potentially some JavaScript expert out there can help me find if there's something missing.

Otherwise my best option would I guess be to store metadata using a separate file? That'd be a lil awkward - it'd have to be a second file next to every image file, which will be painful for filesystem reasons, or a big megafile in the root, that contains as many datapoints as there are images. So for example with the megagrid and it's 300k images, that'd be 300k values in one file... multiplied by, say, 1KiB per image, that's a 300MiB file, which is not going to work.

Maybe as an exclusively optional feature, with a little warning that it's only valid if you have a (relatively) small number of images.


Alternately actually now that I'm thinking about it, I could also store core metadata used for the whole page generation somewhere, and then calculate what the per-image metadata would be based on that.

After experimenting, the last idea actually totally works, and works well! Metadata is now visible when you click an image to view it.
It is also optional on the in-WebUI generation options, for users that want to hide it for privacy reasons.

It's output specifically in a format that matches how the WebUI formats metadata, to make it easy to copy-paste the metadata to the WebUI.
Because of the hacky way its implemented, it will be missing data that isn't available as an option in the grid generator, or data that gets added to the WebUI's format in the future (until the grid gen is updated to include it).