Skip to content

Instantly share code, notes, and snippets.

@aarongough
Created March 8, 2013 21:54
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 aarongough/5120208 to your computer and use it in GitHub Desktop.
Save aarongough/5120208 to your computer and use it in GitHub Desktop.
class TooCheapForInstagram
def process(item)
return unless item.is_a?(Potion::StaticFile)
extensions = [".jpg", ".jpeg", ".gif", ".png"]
return unless extensions.include?(File.extname(item.output_path).downcase)
image = MiniMagick::Image.read(item.content)
image.sepia_tone("80%")
image.vignette("10")
item.content = image.to_blob
end
end
Potion::Site.register_extension(TooCheapForInstagram)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment