Created
November 15, 2014 15:35
-
-
Save TheAnonymous/a03b2d9baf1260aa1364 to your computer and use it in GitHub Desktop.
This is a small snippet to change the size of an input image to iconsize of Firefoxphone
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
require 'opencv' | |
include OpenCV | |
if ARGV.size == 0 | |
puts "Usage: ruby #{__FILE__} ImageToLoadAndDisplay" | |
exit | |
end | |
image = nil | |
begin | |
image = CvMat.load(ARGV[0], CV_LOAD_IMAGE_UNCHANGED ) # Read the file. | |
rescue | |
puts 'Could not open or find the image.' | |
exit | |
end | |
sizes = [512,128,58,48,16] | |
sizes.each do |s| | |
size = CvSize.new(s,s) | |
tmp_image = image.resize(size) | |
tmp_image.save("Icon_#{s}.png") | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment