Bahar Wadia
Posts: 0
Joined: Sat Oct 12, 2013 6:38 pm

Reduce base64 image using Javascript

Is there anyway to reduce the size (both in pixels and KB) of a base64 image that I capture using a camera. I am trying to reduce the size of the image before loading it to the database.

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Reduce base64 image using Javascript

There might be a way to do it.. you should search for a possible solution/library to do that.

bahar.wadia
Posts: 0
Joined: Wed Aug 07, 2013 2:05 am

Reduce base64 image using Javascript

I have been looking, but I have not been very successful.

I cannot be the only one on the planet facing this problem.

In my app I allow the user to take a bunch of pictures, which they can upload to the database. All this works fine.

Also in my app, I allow the user to view Thumbnails of the actual pictures, which they can select if they wish to see the picture in full size. As you can imagine, downloading all the pictures in their full size to show as thumbnails is a very slow and wasteful process.

I would ideally like to reduce the image size (in bytes) on the server side and return the reduced image to the client.

Any suggestions or brilliant ideas?

Thanks so much in advance.

bahar.wadia
Posts: 0
Joined: Wed Aug 07, 2013 2:05 am

Reduce base64 image using Javascript

Can I use canvas on the server side script, without actually having a document on the server ? OR is there some other way ?

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Reduce base64 image using Javascript

Hello! [quote:]Can I use canvas on the server side script, without actually having a document on the server ?[/quote] no, there is no way to use Canvas in ServerCode. To create thumbnail for PNG pictures you can use https://github.com/niegowski/node-pngjs library. This library is to read/save PNG files. But decreasing picture size algorithm should be coded by you.

bahar.wadia
Posts: 0
Joined: Wed Aug 07, 2013 2:05 am

Reduce base64 image using Javascript

So how can this be done on the client side before uploading the image to the server ?

bahar.wadia
Posts: 0
Joined: Wed Aug 07, 2013 2:05 am

Reduce base64 image using Javascript

That works nicely.

Thank you!

buyi wen
Posts: 0
Joined: Mon Sep 07, 2015 2:03 pm

Reduce base64 image using Javascript

you can try this free online service to convert image to base64 string online.

Return to “Issues”