Base64 string compression
I have an ActiveX control that receives an image from a fingerprint device as a base64 string. The asset works fine and I can feed the returned base64 string to the server, which will be converted to binary data and then stored in the database. I am using ASP.NET as a server side technology and JavaScript as a client side technology. The problem is that base64 string is a tool large and it will take 30 to 40 seconds to transfer the string to the server. My question is, is there a way to compress this base64 string on the client (Browser) and collapse it back on the server.
source to share
If the base64 image is indeed jpeg or some other compressed image format, I would not expect you to be able to get a lot of extra compression out of it. You will also need to develop a way to send the binary compressed data subsequently in a portable manner, which can be tricky. (You can pretend to be a file or something.)
How big is this image? 30 seconds is a very long time ...
source to share
on my Linux system, using the bzip2 utility (which uses a burrow-wheel conversion and then compresses), I reduce the Base64 encoded jpg from 259.6KB to 194.5KB.
Using gzip (which uses some variety's LZ algorithm) I reduce it to 194.4KB.
So, yes, you can compress it. the question is why do you want? It seems that your problems really lie elsewhere.
source to share
Base64 is a format that is usually only used to define the technical limitations of sending binary data. For example, a base64 string can be used in a GET request, for example, "website.com/page?q=BASE64ENCODED".
You have two options:
Figure out how to send / receive binary data in a POST request and then send the data in a different form and convert it to the server accordingly. -OR- Since it is a fingerprint device, I am assuming you are using it as a password, so you do not need to send raw fingerprint data every time. Just make a SHA-1 hash and compare it to the stored hash on the server. It's just as safe and takes a split second from you.
Hope I helped!
source to share