Module: ImageCrush::Pngcrush

Defined in:
lib/image_crush/pngcrush.rb

Class Method Summary collapse

Class Method Details

.available?Boolean

Returns:

  • (Boolean)


4
5
6
# File 'lib/image_crush/pngcrush.rb', line 4

def self.available?
  @@available ||= ! %x{which pngcrush}.empty?
end

.crush(inpath, outpath) ⇒ Object



8
9
10
11
# File 'lib/image_crush/pngcrush.rb', line 8

def self.crush(inpath, outpath)
  raise ImageCrush::CrushToolNotAvailable unless available?
  %x{pngcrush -rem alla -brute -reduce #{inpath} #{outpath}}
end