linuxmint / pix

Image management application
GNU General Public License v2.0
214 stars 43 forks source link

PNG tEXt chunk metadata #175

Open Technologicat opened 1 year ago

Technologicat commented 1 year ago
 * Pix 2.8.9
 * Mint 21.1

Issue

Feature suggestion: metadata support for PNG tEXt chunks.

Steps to reproduce

View a PNG image in Pix. Even if the PNG file contains tEXt chunks, the Properties pane does not see them.

Expected behaviour

The Properties pane should list the PNG tEXt chunks, too.

It should show their contents (right there in the pane), and allow copying the text (or parts of it) with the mouse, so that the text can be easily pasted into another app.

Other information

The would be highly useful with the Stable Diffusion AI art tool. Use cases:

There is an image browser for the Automatic1111 GUI for SD that already does these things, but usability-wise Pix is much better - an order of magnitude faster, many more images shown simultaneously, easy navigation between folders, much more efficient use of screen real estate, ...

SD saves its output as PNG, and puts the generation metadata into a tEXt chunk in a plain-text format. There may be approximately 1-2 kB of text, depending on how detailed the prompt and negative prompt were.

Currently, the workflow for doing this with Pix is: quickly find the relevant image in Pix, then copy its file path, then in a terminal, pngcheck -ct "<paste full path here>", and finally copy the text from the terminal window. Even though clumsy, this is still faster than doing it in the image browser in the SD GUI!

I can supply some test PNG files, if needed.

Technologicat commented 1 year ago

Just for additional information, different SD GUIs use different ways to store the metadata.

For reference, there is a standalone SD prompt reader by receyuki that supports many of them, but it has no gallery mode.


EDIT: Also, the standalone SD prompt reader works as a workaround solution for my use cases.

If you associate it to images, you can use Pix as a gallery, then right-click an image in Pix, Open with..., and pick the SD prompt reader. This opens a separate window that shows the SD metadata and allows easily copying it (or parts of it) to the clipboard.

In case anyone else needs this, here's a launcher file for the SD prompt reader. First, install the SD prompt reader (following the instructions in its README on GitHub).

Then save this as SD Prompt Reader.desktop:

[Desktop Entry]
Name=SD Prompt Reader
Exec=python /home/user/full-path-to/stable-diffusion-prompt-reader/main.py %U
Comment=Extract prompts from Stable Diffusion generated images.
Terminal=false
Icon=/home/user/full-path-to/stable-diffusion-prompt-reader/resources/icon.png
Type=Application

Be sure to adjust the paths to match your installation.

Add this launcher to your Menu. Then, to associate it to images, Open with... an image in Nemo, pick the SD prompt reader, and Add to list.

Not quite as convenient as having the info available without opening a separate window each time, but works well enough for now.