Class: ImageSqueeze::PNGToNonProgressiveJPEGProcessor
- Defined in:
- lib/image_squeeze/processors/png_to_non_progressive_jpeg_processor.rb
Instance Attribute Summary
Attributes inherited from Processor
Class Method Summary collapse
Methods inherited from Processor
Class Method Details
.input_type ⇒ Object
3 4 5 |
# File 'lib/image_squeeze/processors/png_to_non_progressive_jpeg_processor.rb', line 3 def self.input_type PNG end |
.output_extension ⇒ Object
7 8 9 |
# File 'lib/image_squeeze/processors/png_to_non_progressive_jpeg_processor.rb', line 7 def self.output_extension '.jpg' end |
.squeeze(filename, output_filename) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/image_squeeze/processors/png_to_non_progressive_jpeg_processor.rb', line 11 def self.squeeze(filename, output_filename) if ImageSqueeze.transparent?(filename) FileUtils.cp(filename, output_filename) return end intermediate_tmp_filename = "%s-%s" % [output_filename, '.tmp'] system("convert #{filename} JPG:#{intermediate_tmp_filename} 2> /dev/null") response = JPEGTranNonProgressiveProcessor.squeeze(intermediate_tmp_filename, output_filename) # run it through PNGCrush afterwards FileUtils.rm(intermediate_tmp_filename) # clean up after ourselves response end |