Add Filename Character Limit

Very long prompts cause this error:

Error: saving("Failed to create destination for file:///path/prompt.seed.final.png"
pull/19/head
dec2-anon 3 years ago committed by GitHub
parent 583cc04ece
commit 2c41969942
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -145,7 +145,8 @@ struct StableDiffusionSample: ParsableCommand {
}
func imageName(_ sample: Int, step: Int? = nil) -> String {
var name = prompt.replacingOccurrences(of: " ", with: "_")
var fileCharLimit: Int = 75
var name = prompt.prefix(fileCharLimit).replacingOccurrences(of: " ", with: "_")
if imageCount != 1 {
name += ".\(sample)"
}

Loading…
Cancel
Save