Skip to content

Instantly share code, notes, and snippets.

@ScribbleGhost
Last active March 23, 2021 04:35
Show Gist options
  • Save ScribbleGhost/e86f121072ce34f34fce84587d088cce to your computer and use it in GitHub Desktop.
Save ScribbleGhost/e86f121072ce34f34fce84587d088cce to your computer and use it in GitHub Desktop.
Button for Directory Opus that will compress a PNG if compression is possible and replace the PNG. Rexuires pngquant in PATH.
<?xml version="1.0"?>
<button backcol="none" display="label" textcol="none">
<label>Compress PNG images with pngquant</label>
<tip>Will overwrite your file if compression is possible make a backup please</tip>
<icon1>#newcommand</icon1>
<function type="batch">
<instruction>@echo off</instruction>
<instruction>:start</instruction>
<instruction>pngquant.exe 256 --force --ext .png --quality=50-90 --ordered --speed=1 --strip --skip-if-larger {file}</instruction>
<instruction>shift</instruction>
<instruction>if NOT x%1==x goto start</instruction>
</function>
</button>
@LoadingArtist
Copy link

Nice, thanks for this!

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