Created
June 3, 2016 03:07
-
-
Save dennysfredericci/43796c6f38a285998af14ed6e0993ed8 to your computer and use it in GitHub Desktop.
Mask Image example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module ApplicationHelper | |
def teste | |
#profile_url = Net::HTTP.get_response(URI.parse("http://graph.facebook.com/#{100000335750045}/picture?type=large"))['location'] | |
#second_image = Net::HTTP.get_response(URI.parse("https://taylorgraceauthor.files.wordpress.com/2015/11/6917465-french-flag-wallpaper.jpg"))['location'] | |
#Deve ter transparencia | |
first = "#{Rails.public_path}/mask.png" | |
#Imagem de fundo | |
second = "#{Rails.public_path}/firefox.png" | |
first_image = MiniMagick::Image.new(first) | |
second_image = MiniMagick::Image.new(second) | |
first_image.format 'png' | |
second_image.format 'png' | |
result = first_image.composite(second_image, 'png') do |c| | |
c.compose "DstOver" # OverCompositeOp | |
#c.geometry "+200+200" | |
#c.alpha 'on' | |
#c.channel 'a' | |
#c.evaluate 'set', '25%' | |
#c.channel "A" | |
#c.alpha 'transparent' | |
end | |
result.format 'png' | |
result.write "#{Rails.public_path}/output1.png" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment