Crop your photos with App Cloud image transcoding

app cloud dev
 
Adam Mark's picture
Adam Mark on February 8, 2012

I can't say enough good things about image transcoding in App Cloud: It's a snap to use, it saves bandwidth, it speeds up your apps, and it makes users happy. We just added two new features to make it even better:

Cropping

You can now crop images on the fly! To crop an image, just add crop=x,y,w,h to the transcode URL, where x,y is the top left coordinate. Take the following image (originally 425x282):

http://coffee.brightcove.com/wp-content/uploads/2011/10/female.jpg

Now make it 275x275, a perfect square:

http://transcode.appcloud.brightcove.com/?image=coffee.brightcove.com/wp-content/uploads/2011/10/female.jpg&crop=0,0,275,275

Now reduce it to 100x100:

http://transcode.appcloud.brightcove.com/?image=coffee.brightcove.com/wp-content/uploads/2011/10/female.jpg&crop=0,0,275,275&width=100&height=100

As you can see, cropping is applied before resizing. Important: Your image must be large enough to cover the cropped area or else the request will fail.

JPEG Quality Settings

You can now specify a quality setting for JPEG images on a scale of 0-100. (The default value is 70.) Take the following image:

http://coffee.brightcove.com/wp-content/uploads/2011/10/m-i-tea.jpg

It's 140KB. Now run it through the transcoding service, maintaining the original size:

http://transcode.appcloud.brightcove.com/?image=http://coffee.brightcove.com/wp-content/uploads/2011/10/m-i-tea.jpg

Now it's 17KB—whoa!—but you'll notice the quality degrades in some solid-tone areas. Try setting the quality to 90:

http://transcode.appcloud.brightcove.com/?image=http://coffee.brightcove.com/wp-content/uploads/2011/10/m-i-tea.jpg&quality=90

Now it's 25KB—still a huge savings!

The results will vary depending on the type of photograph. But for most pictures, the default quality (70) will do. Here's the above image at the default quality—see if you can tell the difference:

http://transcode.appcloud.brightcove.com/?image=coffee.brightcove.com/wp-content/uploads/2011/10/female.jpg

Performance Boost

Finally, it takes a lot of of hamsters to spin the wheels of our image transcoding service. We just added 1,000 hamsters to speed up requests to the image cache by 70%! Try it and you'll see!

Post new comment

The content of this field is kept private and will not be shown publicly.
0

Comments