Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add techjedi's image import script #4171

Merged
merged 12 commits into from
Aug 9, 2023
Merged

Add techjedi's image import script #4171

merged 12 commits into from
Aug 9, 2023

Conversation

lstein
Copy link
Collaborator

@lstein lstein commented Aug 5, 2023

What type of PR is this? (check all applicable)

  • [X ] Feature

Have you discussed this change with the InvokeAI team?

  • Yes

Have you updated all relevant documentation?

  • Yes

Description

This PR adds the invokeai-import-images script, which imports a directory of 2.. -generated images into the current InvokeAI root directory, preserving and converting their metadata. The script also handles 3.* images.

Many thanks to @techjedi for writing this. This version differs from the original in two minor respects:

  1. It is installed as an invokeai-import-images command.
  2. The prompts for image and database paths use file completion provided by the prompt_toolkit library.

To Test

  1. Activate the virtual environment for the destination root to import INTO
  2. Run invokeai-import-images
  3. Follow the prompts

Related Tickets & Documents

This is a frequently-requested feature on Discord, but I couldn't find an Issue.

QA Instructions, Screenshots, Recordings

Added/updated tests?

  • Yes
  • No : but should in the future

@lstein
Copy link
Collaborator Author

lstein commented Aug 5, 2023

Note that this needs further work to make runnable in headless mode, but it is good to merge now given the demand for it.

Copy link
Collaborator

@psychedelicious psychedelicious left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great, thank you!

Can you please attach your test images to this PR so those of us without old images can test?

I made one comment, but I'm not sure if any change is really needed.

(I also ran black on it)

invokeai/frontend/install/import_images.py Show resolved Hide resolved
@f412design
Copy link

f412design commented Aug 8, 2023

Can you please attach your test images to this PR so those of us without old images can test?

All the metadata samples provided by lstein and others, as well as the ones I pulled from outdir and some of my own can be found at the link below:
https://1drv.ms/f/s!AtXsq10ysfY6lfYyxqHIh5_P6FJEBQ?e=4WVHVN

Versions included: 1.15, 2.0.2, 2.2.3, 2.2.4, 2.2.5, 2.3.0, 2.3.0_a0, 2.3.1, 2.3.5, 2.3.5_post2, 3.0.0_a0, 3.0.0_b1-5, 3.0.0_b6+, (also includes pre1.x files that only had a dream tag with prompt/seed.)

@lstein lstein enabled auto-merge August 9, 2023 12:55
Copy link
Member

@ebr ebr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import works really well!! Amazing job 👏

(apply suggestion to fix a typo, otherwise LGTM)

invokeai/frontend/install/import_images.py Outdated Show resolved Hide resolved
@lstein lstein merged commit 2d29ac6 into main Aug 9, 2023
8 checks passed
@lstein lstein deleted the feat/image-import-script branch August 9, 2023 17:17
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.

6 participants