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:

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

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

{{ parent.tldr }}

{{ parent.urlSource.name }}