-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lossless PNGs optimization upon their appearance in "report" and its subdirectories #252
Conversation
Peter H and I could smoke test this on the Horizon box first if folks prefer that |
I suppose I could also move the three new files into an "optimizePNG" folder 🤔 |
optimizePNG.sh
Outdated
|
||
optipng -silent -fix -o2 "$FILE" | ||
|
||
exiftool -quiet -overwrite_original_in_place -Software="$OPTIMIZATION_TAG" "$FILE" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The lock file prevents this line from triggering another inotifywait create event
(exiftool is used to write "OptimizedWithOptiPNG" to the image's "Software" metadata so there’s an easy way to check if an image has already been optimized, see line 30)
An alternative approach to monitoring directories for the appearance of pngs would be to run the |
Reduces PNG file sizes by roughly 30%
Monitors "report" and its subdirectories - isn't otherwise coupled with Pixel code
Quick enough that it doesn't appear to interfere with the BackstopJS image comparison process - running it locally I haven't noticed any odd breakage
Optipng
performs the optimization, "-o2" level seems a good balance between speed and file size reductionRestarts itself if the process ever goes down
EDIT: it's closer to 20%
This calculate the average png size reduction from the
pixel-png-optimizer-1
container logs: