Skip to content

Conversation

@nolan778
Copy link
Contributor

@nolan778 nolan778 commented Sep 1, 2025

I often have to save many images and then run them through batch converters and renaming scripts, so I added some options to remove this step for myself.

New Options:

  • Save Image Format (Default PNG (fast)) - Can now choose PNG (fast), PNG, WebP, WebP (Lossless) and JPEG. This changes which format is used for right click context Save Image in job history thumbnails.
  • Save Image Quality WebP (Default 80) - Hidden option only in settings json file. This will override the default image quality settings in the save function for lossy webp image formats.
  • Save Image Quality JPEG (Default 85) - Hidden option only in settings json file. This will override the default image quality settings in the save function for jpeg image formats.
  • Save Image File Name Template - Hidden option only in settings json file. The default value is the current naming format, but the user can now modify this. I added {current_timestamp} as another possible key, but there may be more in the future.

Modified:

  • Save Image Metadata option is now hidden when neither PNG image save format is chosen.

I had to pass around optional format and quality to the save function and optional quality to the write function. The save function used the file extension to determine format, but we can now be saving 2 different png and 2 different webp formats. The write function used the default quality for each format, but the user may modify these qualities for lossy webp and jpeg by editing the settings.json file.

I couldn't easily figure out how to save the ComfyUI workflow metadata to the jpeg and webp formats, so i left this to someone more qualified than myself. That option remains PNG only, at this time.

@nolan778 nolan778 force-pushed the new_save_img_options branch from ad05d76 to 3e5626f Compare September 1, 2025 21:46
@nolan778 nolan778 force-pushed the new_save_img_options branch from 3e5626f to 65ee828 Compare September 3, 2025 11:48
@nolan778
Copy link
Contributor Author

nolan778 commented Sep 3, 2025

There is a conflict since you moved a nearby line. After rebasing and resolving the conflict, the plugin no longer launches for me. I realized there was also a new file and I got that added, but it still will not launch. There are never any error messages in the client.log file that tell me why the plugin doesn't launch, when something goes wrong. Krita.log also doesn't indicate any issues. Where can I look to find the issue?

EDIT: Fixed the issue (was missing a symbolic link to another changed file), but it would be good to know how to debug issues going forward. So far I have had to resort to comment out half the remaining code changes until it works again and do that un-commenting half of that, doing a manual binary search to find problematic lines of code.

@nolan778 nolan778 force-pushed the new_save_img_options branch from 65ee828 to 8cc24fe Compare September 3, 2025 12:25
@Acly
Copy link
Owner

Acly commented Sep 3, 2025

looks good now, will merge later or tomorrow

Fixed the issue (was missing a symbolic link to another changed file), but it would be good to know how to debug issues going forward.

not sure why you're sumlinking individual files, I think you just want to symlink the entire ai_diffusion folder

this covers most of it: https://github.com/Acly/krita-ai-diffusion/blob/main/CONTRIBUTING.md

One thing that isn't mentioned, on Windows, to get terminal output from Krita, you need to run krita-install-dir/bin/krita.com (NOT krita.exe). If the plugin doesn't load it will print error & trace to the terminal. You can also use prints in code, or attach debugger.

And running pyright will catch syntax problems, don't have to run Krita for that.

@Acly Acly merged commit b80bb35 into Acly:main Sep 4, 2025
2 checks passed
@nolan778 nolan778 deleted the new_save_img_options branch September 4, 2025 20:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants