I'm resizing JPEGs that were saved via Photoshop's "Save for web" with a quality of 10. When I resize the image to one with a smaller resolution the resulting file is much larger than the original.
Code: Select all
[jkat@localhost resize-test]$ cat resize.rb
#!/usr/bin/ruby
require 'RMagick'
img = Magick::ImageList.new(ARGV.shift).first
img.change_geometry("1000x") do |cols, rows, i|
i.resize!(cols, rows)
i.write('A.jpg')
end
[jkat@localhost resize-test]$ !.
./resize.rb product-10.jpg
[jkat@localhost resize-test]$ !iden
identify product-10.jpg A.jpg
product-10.jpg JPEG 1486x2000 1486x2000+0+0 8-bit DirectClass 220kb
A.jpg[1] JPEG 1000x1346 1000x1346+0+0 8-bit DirectClass 443kb
Code: Select all
img.distort(Magick::ScaleRotateTranslateDistortion, ...)
How can I reduce the resized image's size. I'd hope it could be smaller the than original.
Also
Code: Select all
identify -verbose product-10.jpg A.jpg