how to read image file in ruby suppose i open a jpg file like this
path="c:/image/aj.jpg" File.open(path) do end
now how do i see this image file
how to read image file in ruby suppose i open a jpg file like this
path="c:/image/aj.jpg" File.open(path) do end
now how do i see this image file
You can read arbitrary binary content
path = "/foo/bar/baz.jpg"
File.open(path, 'rb') {|file| file.read }
If you want to write this image to another..
File.open(path, 'rb') do |in|
File.open("foo/bar/bob.jpg", 'wb') {|out| out.write(in.read) }
end
The binary flags are only required in Windows/DOS.
See the IO class