NASA666

不以物喜,不以己悲.
Posted on , viewed 763 times

ruby使用MiniMagick裁剪图片

image = MiniMagick::Image.open('/sun/tmp/lisiwei_shenzhou.jpg')
image.crop "414x408+144+271"
image.write '/sun/tmp/cut_test.jpg'
四个参数代表宽度,高度,坐标原点
new_file=File.new("/sun/tmp/test-sun-cut-5.jpg", 'wb')
new_file.write(z)