Skip to content

Instantly share code, notes, and snippets.

View tedgrubb's full-sized avatar

Ted Grubb tedgrubb

View GitHub Profile
@tedgrubb
tedgrubb / ttransparency.rb
Last active May 4, 2017 17:33
Paperclip Processor that finds the background color and replaces it with a transparent background. Also simulates anti-aliasing using '-fuzz' to get rid of pixelated artifacts.
# lib/paperclip_processors/transparency.rb
module Paperclip
class Transparency < Thumbnail
# Find the background and replace with transparency.
# -fuzz 20% simulates antialiasing
CONVERT_OPTIONS = [
'-alpha', 'set',
'-fill', 'white',
'-draw', "'color 0,0 replace'",