开发者

RMagick filesize giving strange output for different sized images

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 any开发者_Go百科one please point the problem?

Thanks


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜