Sha256: 60d49c3a3e542084a80c410525d701f0729261dd24332f63f474e9baf49df44a
Contents?: true
Size: 849 Bytes
Versions: 16
Compression:
Stored size: 849 Bytes
Contents
require 'image_optim/worker' class ImageOptim class Worker class Jpegtran < Worker option(:copy_chunks, false, 'Copy all chunks'){ |v| !!v } option(:progressive, true, 'Create progressive JPEG file'){ |v| !!v } option(:jpegrescan, false, 'Use jpegtran through jpegrescan, ignore progressive option'){ |v| !!v } def optimize(src, dst) if jpegrescan args = %W[#{src} #{dst}] args.unshift '-s' unless copy_chunks resolve_bin!(:jpegtran) execute(:jpegrescan, *args) && optimized?(src, dst) else args = %W[-optimize -outfile #{dst} #{src}] args.unshift '-copy', copy_chunks ? 'all' : 'none' args.unshift '-progressive' if progressive execute(:jpegtran, *args) && optimized?(src, dst) end end end end end
Version data entries
16 entries across 16 versions & 1 rubygems