Class: Pageflow::LinkmapPage::PaperclipProcessors::ColorMask

Inherits:
Paperclip::Processor
  • Object
show all
Defined in:
lib/pageflow/linkmap_page/paperclip_processors/color_mask.rb

Constant Summary collapse

CONVERT_COMMAND =
[
  # Create mask by making all non-matching colors in color map
  # image transparent
  ':color_map',
  '+transparent :color',
  # Make all areas transparent in source that are transparent in mask
  ':source',
  '-compose src-in -composite',
  # Write result to output file
  ':dest'
].join(' ').freeze

Instance Method Summary collapse

Instance Method Details

#makeObject



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/pageflow/linkmap_page/paperclip_processors/color_mask.rb', line 17

def make
  with_destination_tempfile do |dest|
    with_color_map do |color_map_path|
      convert(CONVERT_COMMAND,
              color: "##{options[:style]}",
              color_map: color_map_path,
              source: File.expand_path(file.path),
              dest: File.expand_path(dest.path))
    end
  end
end