What is Alibaba Cloud OSS Image Processing and how you can benefit from it with no extra cost and hassle?

Fernando Hönig
nubego
Published in
4 min readMar 5, 2019

Let’s start from the very beginning, what is Alibaba Cloud?

Alibaba Cloud is the #1 public cloud vendor in China, it has 19 regions worldwide, 56 availability zones and more than 1500 CDN nodes.

So, rest assured, they have the right infrastructure in place.

What about the Alibaba Cloud Services?

Alibaba Cloud is catching up very quickly with the rest of the Cloud Services Providers. Currently providing 100+ services and more coming soon.

One of these services is Object Storage Service or OSS. Alibaba Cloud Object Storage Service (OSS) is an encrypted, secure, cost-effective, and easy-to-use object storage service that enables you to store, back up, and archive large amounts of data in the cloud, with a guaranteed reliability of 99.999999999%. RESTful APIs allow storage and access to OSS anywhere on the Internet. You can elastically scale the capacity and processing capability, and choose from a variety of storage types to optimise the storage cost.

Ok, until here, nothing much different from the other Cloud Providers, right?. Well, now is the time to start to differentiate from the rest.

Image Processing History

So, let me recap a little bit. Back in my early IT days, I remember building backends and using software like imagemagick to resize or adding a watermark. It was good at that time, but we were having a server (or multiple ones) running all the time just to resize images when required, or even worst, storing multiple sizes of the image.

Then we started using serverless computing where we were able to pay just for what we used in terms of compute and memory. Great addition, but still we needed a storage to be paid multiple times (every resize is using storage capacity).

So Fernando, we are good then, right?. Actually, we can even pay less!. What if you just pay for the original image size storage and the cloud service has some functions written internally that enables you to do the resizing and other image functions out of the box. What? Is that even possible?

OSS and Image Processing

Alibaba Cloud OSS Image Processing (IMG) is an image processing service that features massive capacity, high security, low costs, and high reliability. By uploading and storing original images in OSS, you can process images anytime, anywhere, on any Internet device through a simple RESTful API. IMG offers image processing APIs.

IMG provides the following features:

  • Retrieving image information
  • Converting image formats
  • Scaling, cropping, and rotating images
  • Adding images, texts, and text-and-image watermarks to images
  • Customising image processing styles
  • Calling multiple image processing features in a set sequence through pipelines

Let’s try it!

So the first thing to do is to upload the original image size to OSS. If you don’t have an Alibaba Cloud Account, you can have a Free Trial with at least $300USD worth of credit, by registering here: https://account.alibabacloud.com/register/intl_register.htm

Once you are in the main console, go to your left menu and find Object Storage Service as shown below.

You can access some statistics once you’ve created a bucket and uploaded some objects there.

Next to this statistics, you will find on the right top corner a “Create Bucket” blue button. Click there and you’ll be presented with a form like below.

At this stage, and for this demo purposes, I will suggest to move to ACL Public Read, but remember if you’re using this in production and you need your images only available via some form of authentication, it has to be Private.

Nice, now, let’s upload the image and see the power of IMG.

The first image we uploaded was the original one. A 6000px by 4000px and 2.9MB on disk.

https://nubego.oss-eu-west-1.aliyuncs.com/keith-wong-761290-unsplash.jpg

But because that’s too big for this post, I wanted to resize it to 500px. So I ran this:

https://nubego.oss-eu-west-1.aliyuncs.com/keith-wong-761290-unsplash.jpg?x-oss-process=image/resize,w_500,limit_0

WOW! Just by adding ?x-oss-process=image/resize,w_500,limit_0 I got my image resized!

Ok, don’t get emotional too fast, what else I can do?. Can I just add some effects? Like blurring? What about resizing and blurring at the same time?

https://nubego.oss-eu-west-1.aliyuncs.com/keith-wong-761290-unsplash.jpg?x-oss-process=image/resize,w_500/blur,r_3,s_2

Now we are talking! Amazing, right?.

Let’s do something else, make another image effect like adding a circle.

https://nubego.oss-eu-west-1.aliyuncs.com/keith-wong-761290-unsplash.jpg?x-oss-process=image/circle,r_500

The first time I’ve heard about this I was quite interested in trial it and now I had the time to actually do it and write something for somebody else to try it as well.

Say goodbye to running this in a compute instance. Do it on demand and most importantly, for free!.

I hope this helps you to get rid of unnecessary costs. If you have any questions, please feel free to reach out!

--

--