Class: ZooniverseData::Projects::Serengeti

Inherits:
Object
  • Object
show all
Includes:
Helpers
Defined in:
lib/zooniverse_data/projects/serengeti.rb

Instance Method Summary collapse

Instance Method Details

#converter_for(path, type: nil, max_size: nil) ⇒ Object



30
31
32
33
34
35
36
# File 'lib/zooniverse_data/projects/serengeti.rb', line 30

def converter_for(path, type: nil, max_size: nil)
  convert_image(path, remove_original: false)
    .resize(width: max_size, height: max_size, force: false)
    .quality(80)
    .write_to(prefix: type)
    .path
end

#customize_subjectObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/zooniverse_data/projects/serengeti.rb', line 6

def customize_subject
  new_locations = {
    'standard' => [],
    'thumbnail' => [],
    'large' => []
  }
  
  entry.location['standard'].each do |path|
    large_image = large_converter path
    new_locations['large'] << large_image
    new_locations['standard'] << converter_for(large_image, type: 'standard', max_size: 600)
    new_locations['thumbnail'] << converter_for(large_image, type: 'thumbnail', max_size: 300)
  end
  
  set_location new_locations
end

#large_converter(path) ⇒ Object



23
24
25
26
27
28
# File 'lib/zooniverse_data/projects/serengeti.rb', line 23

def large_converter(path)
  convert_image(path)
    .command('-gravity South -chop 0x100')
    .write_to(prefix: 'large')
    .path
end