views:

59

answers:

1

When the snippet below surprisingly giving the same output for the original and the resized image. Executed with rmagick (2.12.2) and ruby 1.8.7 (2008-08-11 patchlevel 72) [i486-linux] on Ubuntu Jaunty.

img = nil
File.open("~/rmagick/test/original.JPG", "r") { |f| img = f.read }
img = Magick::Image::from_blob(img).first
p img.filesize #=> 2875242, i.e 2.7 mb, similar when checked from file system
small = img.resize_to_fit(75, 75)
small.strip!
p small.filesize #=> 2875242 (again!), file system shows it's 2.7 kb
small.write("~/rmagick/test/s.jpg")

can anyone please point the problem?

Thanks

A: 

It would appear that the Magick::Image filesize property is only updated when the image is read from a file, or the file is saved.

tadman