Skip to content

Instantly share code, notes, and snippets.

View jgclark's full-sized avatar

Jonathan Clark jgclark

View GitHub Profile
@jgclark
jgclark / autooptim.rb
Last active September 11, 2020 23:33 — forked from ttscoff/autooptim.rb
Script intended for use with Hazel to resize/optimize web images based on directives in image filenames. Extended from ttscoff's original.
#!/usr/bin/ruby
# From Brett Terpstra <https://gist.github.com/ttscoff/d11fd063d0047bb0d4d235d2279e2085>
# extended by Jonathan Clark 2.4.2018 to allow original to be kept
# extended further, 11.9.2020 to allow borders to be added (currently white and/or black)
# and published at https://gist.github.com/jgclark/2f82e4a27a6157d5608cfc122b26891f
#
# Example:
# > file1@2x%%ohc.png
# => Converts png to jpeg, creates 1x and 2x versions, optimizes both with jpegoptim
#