I am using Ruby to write a codec to compress an image. Right now I am using a hardcoded image file, but I would like to retrieve an image file from the user.
What would be the proper syntax of gathering this information?
Here is what I currently have:
# Set the path for the input image
path = "#{File.dirname(__FILE__)}/../../Images/my_image.png"
image = ImageList.new(path)
Then I am manipulating the image using RMagick, but that’s irrelevant. What is the proper way to allowing the user to give me an image from his current path in the console?
Thanks!
You call your script from the commandline like this:
$ myscript.rb path_to_file.jpgand in your script, you can access the string with
ARGV, e.g.