Skip to content

Instantly share code, notes, and snippets.

@jim60105
Last active February 25, 2024 16:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jim60105/b05beaee124d494afb499fb2c0f45490 to your computer and use it in GitHub Desktop.
Save jim60105/b05beaee124d494afb499fb2c0f45490 to your computer and use it in GitHub Desktop.
Convert images between png, jpg, webp and "Perserve PNG Info used by stable-diffusion-webui"
Get-ChildItem "./" -Filter *.jpg |
Foreach-Object {
$outputWebp = "$([System.IO.Path]::GetFileNameWithoutExtension($_)).webp"
magick "$($_.FullName)" $outputWebp
exiftool -TagsFromFile "$($_.FullName)" "-UserComment<UserComment" -comment= -overwrite_original $outputWebp
}
Get-ChildItem "./" -Filter *.png |
Foreach-Object {
$outputJpg = "$([System.IO.Path]::GetFileNameWithoutExtension($_)).jpg"
magick "$($_.FullName)" $outputJpg
exiftool -TagsFromFile "$($_.FullName)" "-UserComment<Parameters" -comment= -overwrite_original $outputJpg
}
Get-ChildItem "./" -Filter *.png |
Foreach-Object {
$outputWebp = "$([System.IO.Path]::GetFileNameWithoutExtension($_)).webp"
magick "$($_.FullName)" $outputWebp
exiftool -TagsFromFile "$($_.FullName)" "-UserComment<Parameters" -comment= -overwrite_original $outputWebp
}
Get-ChildItem "./" -Filter *.webp |
Foreach-Object {
$outputJpg = "$([System.IO.Path]::GetFileNameWithoutExtension($_)).jpg"
magick "$($_.FullName)" $outputJpg
exiftool -TagsFromFile "$($_.FullName)" "-UserComment<UserComment" -comment= -overwrite_original $outputJpg
}
@jim60105
Copy link
Author

jim60105 commented Feb 24, 2024

Convert images between png, jpg, webp and "Perserve PNG Info used by stable-diffusion-webui"

Requirement

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment