receyuki / stable-diffusion-prompt-reader

A simple standalone viewer for reading prompts from Stable Diffusion generated image outside the webui.
MIT License
1.06k stars 69 forks source link

[BUG] - Attempting to read previously edited file causes launch error #61

Closed hal0thane closed 10 months ago

hal0thane commented 10 months ago

Description

When attempting to open a file that was previously edited by SD Prompt Reader, the application crashes with Launch error Please report this issue to GitHub in certain conditions.

I have not tested whether this happens when a file already contains infotext and that infotext was edited. I was adding infotext to files that had none using SD Prompt Reader's Edit feature. Then when I tried to read back the edited file (with the suffix _edited), I receive this error. I added only to the Prompt, not the other two boxes.

It also seems it only happens when dragging a file from the Finder (actually Path Finder in my case, but the application from which it is pulled is unlikely to be related) and dropping it over SD Prompt Reader's icon in the Task Switcher. If I attempt to open the same file from within the choose file box, it does not open the file (which is likely another bug), but it also does not crash. That's also true if I pick up the icon from the Finder, then switch to SD Prompt Reader, and then drop the icon on the "Drop image here" portion of the screen. It appears to crash only when dropping the file onto the app icon in the Task Switcher (Command-Tab), which is expected to open the dropped file and read its infotext.

Reproduction steps

  1. Open a file with no infotext in SD Prompt Reader. May also occur for files that do have infotext.
  2. Hit the Edit button to turn on edit mode.
  3. Add text to the first text box (Prompt). This bug possibly occurs regardless of which box or boxes text is added to, or even if text is removed or simply changed. These cases were not part of what I was doing when encountering the bug.
  4. Press the Save button. A message: A new image file with suffix has been generated.
  5. Locate the new image file with the suffix in the Finder.
  6. Mouse down and hold on the image file.
  7. While holding down (Command), tap the Tab button to bring up the Task Switcher.
  8. Drag the image file from step 6 into the Task Switcher and when it is hovering over the icon for SD Prompt Reader, release the mouse button to drop the file into the application.

These steps will generate this bug.

Image file

No response

Version

1.3.4

OS

Mac (Apple silicon)

Tool

Other

receyuki commented 10 months ago

Could you please post the problematic image here?

hal0thane commented 10 months ago

I have several images that cause the problem. Here is one. The image was generated in Diffusion Bee (which I normally do not use), and then opened in SD Prompt Reader to add the infotext to the image. StreetArtModiglianiApowe_71276865

receyuki commented 10 months ago

Please try out the new dev version.

If you have Homebrew, please use the following command to install: brew install --no-quarantine receyuki/sd-prompt-reader/sd-prompt-reader-dev

otherwise, download it from here: https://receyuki.com/sdpr/SDPRdev.zip

Sorry for the inconvenience, the installation package for Mac is too large to be uploaded as an attachment.

hal0thane commented 10 months ago

Thanks for the quick update, @receyuki. This does indeed seem to fix the problem I was encountering. I'll go ahead and mark it as closed. Have a good new year.