Skip to content

Instantly share code, notes, and snippets.

@miabrahams
Created December 1, 2022 14:41
Show Gist options
  • Save miabrahams/d28f7cfedd6c531cd1ed4a811b307a69 to your computer and use it in GitHub Desktop.
Save miabrahams/d28f7cfedd6c531cd1ed4a811b307a69 to your computer and use it in GitHub Desktop.
Powershell script for Stable Diffusion image tags
function Out-SDTags($file) {
<#
Print out embedded Stable Diffusion prompt. Requires ImageMagick.
#>
$imagedata = magick convert $file json: | ConvertFrom-Json
# Pretty print to view in console
Out-Host -InputObject $imagedata.image.properties
# Raw strings to copy/paste.
# Tags are either found in "Comment/Description" fields or "Properties" field.
Write-Host $imagedata.image.properties.Comment
Write-Host $imagedata.image.properties.Description
Write-Host $imagedata.image.properties.parameters
}
function Get-SDTags($url) {
Invoke-WebRequest $url -Outfile temp.png
Out-SDTags temp.png
Remove-Item temp.png
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment