Last active
March 23, 2021 04:35
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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> |
Nice, thanks for this!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The cool thing about this is that you can basically hit the button a million times without quality loss because the script will do nothing if the PNG has already been compressed by pngquant 😎