Module: ImageCrush::Jpegtran

Defined in:
lib/image_crush/jpegtran.rb

Class Method Summary collapse

Class Method Details

.available?Boolean

Returns:

  • (Boolean)


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

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

.crush(inpath, outpath) ⇒ Object



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

def self.crush(inpath, outpath)
  raise ImageCrush::CrushToolNotAvailable unless available?
  %x{jpegtran -copy none -optimize #{inpath} > #{outpath}}
end