Just fair warning: better models than I'm using most probably exist. Development of these tools goes so fast, anything I get used to will be obsolete. I'm mainly listing the tools in case anyone's curious.
And also fair warning: Developing is absolutely tedious and an incredible time sink. I looked it up, and I think I generated close to 10K images for Cubsitting Simulator, of which 1070 ended up actually being used, with about 500 making it into the final game (the other 570 were used as intermediates to generate other pictures).
It's a ton of fun though! I can highly recommend it to give it a go.
To correct minor mistakes, remove background, and other image manipulation, I'm using: https://krita.org/en/
In the Cubsitting Simulator folder, I have three folders: 'reference images~' for the original generated PNGs (every PNG contains metadata about the prompt used which is seriously convenient), 'krita~' for the edited files with for example their backgrounds removed and 'images' for images that'll ship with the game and that I compressed to .avif at quality 60 from the 'krita~' files. I've added a '~' at the end because Ren'Py will know not to pack those folders ending with ~.
For version control I can't recommend git more. It's super convenient to have backups, to cooperate with others, and to be able to revert changes if they cause problems. https://gitforwindows.org/
public final static String START_DIR = "START_DIR_METADATA_EXTRACTION"; private final PrintWriter fos; private final File metadatadir;
private final Pattern pattern = Pattern.compile( "tEXtparameters\0(.*)\n(?:Negative prompt: (.*)\n)?Steps: (\\d+), Sampler: (.*), CFG scale: (\\d+), Seed: (\\d+), Size: (\\d+)x(\\d+), Model hash: (.*), Model: ([A-Za-z0-9$&+,:;=?@#|'<>.-^*()%!_ \"]*\\d)"); private final Map<String, Set<Image>> map = new TreeMap<>();
public Analyzer(String root) throws FileNotFoundException { fos = new PrintWriter(new FileOutputStream(new File(root,"generated_prompts.txt"))); metadatadir = new File("metadata"); if (!metadatadir.exists()) { metadatadir.mkdir(); } }
public static void main(String[] args) throws IOException { Preferences prefs = Preferences.userRoot().node(Analyzer.class.getName()); JFileChooser chooser = new JFileChooser(); FileNameExtensionFilter filter = new FileNameExtensionFilter( "PNG Images", "png"); chooser.setFileFilter(filter); chooser.setAcceptAllFileFilterUsed(true); chooser.setCurrentDirectory(new File(prefs.get(START_DIR, "."))); chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); int returnVal = chooser.showOpenDialog(null); if (returnVal != JFileChooser.APPROVE_OPTION) { System.out.println("You cancelled the metadata extraction."); return; } File selected = chooser.getSelectedFile(); prefs.put(START_DIR, selected.isFile() ? selected.getParent() : selected.getAbsolutePath()); Analyzer analyzer = new Analyzer(selected.isFile() ? selected.getParent() : selected.getAbsolutePath()); analyzer.analyze(selected); analyzer.printAll(); }
public void analyze(File start) { if (start.isDirectory()) { for (File f : start.listFiles()) { analyze(f); } return; } if (start.getName().toLowerCase().endsWith(".png")) { analyzePNG(start); } }