Skip to content

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

@hipsterusername hipsterusername force-pushed the feat/image-import-script branch from 4043a4c to 12e51c8 Compare August 5, 2023 21:26
@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
Contributor

@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)

@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
Contributor

@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)

@lstein lstein merged commit 2d29ac6 into main Aug 9, 2023
@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.

7 participants