class ImageOptim::Worker::Jhead
www.sentex.net/~mwandel/jhead/
Jhead
internally uses jpegtran which should be on path
Public Instance Methods
image_formats()
click to toggle source
Works on jpegs
# File lib/image_optim/worker/jhead.rb, line 11 def image_formats [:jpeg] end
optimize(src, dst)
click to toggle source
# File lib/image_optim/worker/jhead.rb, line 24 def optimize(src, dst) return false unless oriented?(src) src.copy(dst) args = %W[ -autorot #{dst} ] resolve_bin!(:jpegtran) execute(:jhead, *args) && dst.size? end
run_order()
click to toggle source
Run first, while exif is still present
# File lib/image_optim/worker/jhead.rb, line 16 def run_order -10 end
used_bins()
click to toggle source
# File lib/image_optim/worker/jhead.rb, line 20 def used_bins [:jhead, :jpegtran] end
Private Instance Methods
oriented?(image)
click to toggle source
# File lib/image_optim/worker/jhead.rb, line 37 def oriented?(image) exif = EXIFR::JPEG.new(image.to_s) (2..8).include?(exif.orientation.to_i) end