<commit_before>require 'rubygems'
require 'RMagick'
require 'json'
include Magick


=begin
Dir.entries(dir_name).each do |filename|
  next if filename == "."
  next if filename == ".."

  img = ImageList.new(dir_name+ "/" + filename)
  img = img.transparent("#000000", Magick::TransparentOpacity)
  puts filename
  img.write(output_dir_name + "/" + filename)
end
=end
begin
  il = ImageList.new
  base = ImageList.new("test_source/thumbs_up.JPG")
  base.fuzz = 12500
  #light 46f75f
  light_green = '#46f75f'
  #mid 249523
  mid_green = '#249523'
  #dark 1d6c1d
  dark_green = '#1d6c1d'
  il << base.scale(0.25).opaque_channel(mid_green, "#000000").opaque_channel(light_green, "#000000")
  #test.resize_to_fill(800, 800)
  #final = other.transparent("#249523", Magick::TransparentOpacity)
  #final.write("test_out/thumbs_up.png")
  il.display
rescue
  puts "Caught exception: #{$!}"
end

exit
<commit_msg>Pass all files in directory Added second pass to removing green<commit_after>require 'rubygems'
require 'RMagick'
require 'json'
include Magick

def remove_green(dir, filename)
  begin
    il = ImageList.new
    temp = ImageList.new
    base = ImageList.new(dir + "/" + filename)
    #light 46f75f
    light_green = '#46f75f'
    #mid 249523
    mid_green = '#249523'
    #dark 1d6c1d
    #dark_green = '#102d0f'
    dark_green = '#184117'
    
    #first pass
    base.fuzz = 1700
    temp << base.scale(0.25).opaque_channel(dark_green, mid_green)
    #second pass
    second_pass = temp.flatten_images
    second_pass.fuzz = 12500
    il << second_pass.opaque_channel(mid_green, light_green).opaque_channel(light_green, light_green).transparent(light_green, Magick::TransparentOpacity)
    #final.write("test_out/thumbs_up.png")
    #puts il.inspect
    il.display
  rescue
    puts "Caught exception: #{$!}"
    exit
  end
end

dir_name = "test_source"
output_dir_name = "test_out"
Dir.entries(dir_name).each do |filename|
  next if filename == "."
  next if filename == ".."
  remove_green(dir_name, filename)
end

#remove_green(dir_name, "thumbs_up.JPG")
exit



    #test.resize_to_fill(800, 800)
{'fraction_non_alphanumeric': 0.12861888941623162, 'fraction_numerical': 0.054579971523493115, 'mean_word_length': 4.116504854368932, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 3, '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': '5250795', 'n_tokens_mistral': 862, 'n_tokens_neox': 782, 'n_words': 159}