Class: SiteFuel::Processor::PNGProcessor

Inherits:
AbstractExternalProgramProcessor show all
Defined in:
lib/sitefuel/processors/PNGProcessor.rb

Overview

processor for handling Portable Network Graphics images currently operates as a lightweight wrapper around 'pngcrush'

Instance Attribute Summary

Attributes inherited from AbstractProcessor

#execution_list, #original_size, #processed_size, #resource_name

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from AbstractExternalProgramProcessor

#generate, #initialize, #output_filename, process_file, #processor_symbol, processor_type, #save, #set_file

Methods inherited from AbstractProcessor

#add_filter, #add_filterset, #clear_filters, #create_file, #drop_filter, #execute, file_pattern_match?, #filter?, filter?, filters, filters_in_filterset, filterset?, filterset_ignore, filtersets, find_processors, #finish_filters, #initialize, processes_file?, processor_name, #processor_symbol, processor_type, #run_filter, #run_filterset, #save, #setup_filters

Methods included from ClassLogging

#debug, #error, #fatal, #info, #warn

Methods included from Configurable

#configuration_options, #configure, #ensure_configurable_option, #post_configuration, #pre_configuration, #set_configuration

Methods included from Logging

#debug, #error, #fatal, #info, #logger=, #warn

Constructor Details

This class inherits a constructor from SiteFuel::Processor::AbstractExternalProgramProcessor

Class Method Details

.appropriate_program_versionsObject

we've only tested 1.5.10; but we're not using pngcrush in any special way



40
41
42
# File 'lib/sitefuel/processors/PNGProcessor.rb', line 40

def self.appropriate_program_versions
  "> 1.5.0"
end

.default_filtersetObject

FILTERS AND FILTERSETS



49
50
51
# File 'lib/sitefuel/processors/PNGProcessor.rb', line 49

def self.default_filterset
  :max
end

.file_patternsObject



21
22
23
# File 'lib/sitefuel/processors/PNGProcessor.rb', line 21

def self.file_patterns
  ['.png']
end

.filterset_maxObject



57
58
59
# File 'lib/sitefuel/processors/PNGProcessor.rb', line 57

def self.filterset_max
  [:brute_chainsaw]
end

.filterset_quickObject



53
54
55
# File 'lib/sitefuel/processors/PNGProcessor.rb', line 53

def self.filterset_quick
  [:quick]
end

.program_binaryObject

gives the name of the pngcrush binary



30
31
32
# File 'lib/sitefuel/processors/PNGProcessor.rb', line 30

def self.program_binary
  'pngcrush'
end

.program_version_optionObject



34
35
36
# File 'lib/sitefuel/processors/PNGProcessor.rb', line 34

def self.program_version_option
  '-version'
end

Instance Method Details

#filter_bruteObject

FILTERS



66
67
68
# File 'lib/sitefuel/processors/PNGProcessor.rb', line 66

def filter_brute
  SiteFuel::External::PNGCrush.brute(resource_name, output_filename)
end

#filter_brute_chainsawObject



74
75
76
# File 'lib/sitefuel/processors/PNGProcessor.rb', line 74

def filter_brute_chainsaw
  SiteFuel::External::PNGCrush.chainsaw(resource_name, output_filename)
end

#filter_quickObject



70
71
72
# File 'lib/sitefuel/processors/PNGProcessor.rb', line 70

def filter_quick
  SiteFuel::External::PNGCrush.quick(resource_name, output_filename)
end