Over a million developers have joined DZone.

Scale And Crop Without Caching Temp Image

·
def scale_crop
.......
   	
# Open the image-file
	   	img = Image.read(picture_name).first
		scale_image = img.scale(scale_width,scale_height )
		crop_image = scale_image.crop(left_x, left_y, right_x, right_y)
		@response.headers["Content-Type"] = "image/jpeg"
		render_text do |response|
            		print crop.to_blob
   		end
end
Topics:

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}