<commit_before>module ZooniverseData
  module Projects
    class Serengeti
      include Helpers

      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

      def large_converter(path)
        convert_image(path)
          .write_to(prefix: 'large')
          .path
      end

      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
    end
  end
end<commit_msg>Revert "Don't crop serengeti images"<commit_after>module ZooniverseData
  module Projects
    class Serengeti
      include Helpers
      
      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
      
      def large_converter(path)
        convert_image(path)
          .command('-gravity South -chop 0x100')
          .write_to(prefix: 'large')
          .path
      end
      
      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
    end
  end
end
{'fraction_non_alphanumeric': 0.1, 'fraction_numerical': 0.009009009009009009, 'mean_word_length': 2.0761772853185594, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7379369', 'n_tokens_mistral': 680, 'n_tokens_neox': 641, 'n_words': 143}