image = MiniMagick::Image.open('source.jpg') | |
image.colorspace 'gray' | |
pixels = image.get_pixels | |
0.upto(image.height - 1) do |y| | |
image.combine_options do |c| | |
0.upto(image.width - 1) do |x| | |
color = pixels[y][x][0] | |
c.draw "fill #{black_color} color #{x},#{y} point" if color < 250 | |
end | |
end | |
end | |
image.write('destination.jpg') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment