Picture upload and download to google appengine is slow - java

I am storing pictures in the google datastore that have the size of around 450 x 450 pixels but download speed and especially the upload speed is very slow. Around 5 -15 secs.
In my android app I transform Bitmaps to byte arrays and the byte arrays to a Base64 encoded String which is stored as a Blob in the datastore. For download I do the same the other way around.
I checked the appengine latency but its quite fast about 150ms. So i guess the problem is somehow the bandwith speed...
Does anyone know if this is normal for that picture size? And is it maybe the wrong way how I transform the pictures?
What are usually the techniques to send a bitmap fast?
Thanks for any help!
Edit
I am using google cloud endpoints

Sending files as byte arrays in JSON services and storing the files in the datastore are both pretty bad practices. You should use the BlobStore to upload the images and then use the images service to get a serving URL for the image you uploaded. Store the blob ID and URL in the datastore and whenever you want to view an image in the client - load it directly from Google's CDN by fetching the URL you got. Both upload and download will be orders of magnitude faster this way and even cost you less.

Related

How to store the images and display the same on the screen using struts?

I want to store the images and display the same on the screen using struts. Is it better to store the images in database or on the file system? I have more than 10,000 images.
Storing images in the database as objects like blob or clob is generally not recommended as this will make the database size huge. You may get poor results while processing your resultsets. The better way to do this is have the images get stored in your file system and simply use its references in the databases which is efficient. Using a hash check on the uploaded images will also help in verifying the integrity of the images if they are uploaded to the server from the clients.
File system. It turns out it's quite good at storing files.

What is the standard way of compressing uploaded images on web applications?

I have an application where users can upload images.
This images are usually taken directly from cameras and in 1mb sizes or more.
May I know what is the standard way of compressing this images before saving them to database as BLOB?
The images stored in database are just for viewing, there is no requirement to edit the image.
I have read this:
Compress Image before Saving to disk in Java
But I am wondering there are more standard ways so that the system can be more maintainable.
some codes and links will be greatly appreciated +1

Which is Faster regarding Android Images IO

Which is faster, to recieve images as JPG from server, and save it, then show it in a ListView or what ever
OR
receive images in an XML (as encoded String) from server, then decode it, then show it in a ListView (or even save it then show it from memory)
what is the best way (regarding performance) in transfering images FROM a server TO an android device
thanks in advance
That depends on where the limitation is. If the bandwidth of your connection is very small try to transfer as few bytes as possible. However, high compression usually costs more CPU, so if CPU power is limiting you it may be better to use a lower compression.
I am not sure what you mean by "receive images in an XML". Is it some vector format like SVG? That would normally be much smaller than a raster image (especially for large sizes).
To sum up, you will need to do some experiments to find out what works best in your case.
The best way is to get the image URL from the server and then download the image using some image managing library like https://github.com/nostra13/Android-Universal-Image-Loader or google's volley. These kind of libraries highly configurable and taking care of all the aspects of managing a bitmap.

Storing large amount of images in android

I am in the planning stage of making a database application for android phones. One of my requirements is that I be able able to provide offline access for users. I am wondering what would be the most efficient way of storing a large amount of images (around four hundred-several thousand).
Oh, the images have been pre-compressed/optimized for mobile viewing. The 50mb limit on apk for the market won't be a issue.
You have to develop simple logic.Suppose you have connection then download all images.Now you have two way to access these images while you do not have connection-----
Store all images in data base as blob(But it not feasible to store huge amount
of data to database)
Second..
Store all images in sdcard(by making a folder in it) and now store link of these
images in data base Table.Suppose you donot have connection then first fetch
image path from DB Table then fetch file from sdcard and display
I would suggest storing the image files in sdcard and filename/path in sqlite DB. Store files in /Android/data/your.package.name/cache/ directory. When the user deletes the application, the cache folder will be deleted and also all the stored images.
Application build file(apk) size will be less as tofeeqahmad was suggesting.

Java Image resizing (3 sizes) upload each to Amazon S3

I'm using grails with jetS3t to upload an image to S3, this works fine.
But now I need to re-size the image (thumbnail, small and medium) and upload them all to S3.
So far I'm thinking about using ImageMagick, But don't know which is the best way to approach the resizing.
Should I:
Upload original to S3,
then re-size using the URL received from S3(another download), and upload the re-sized image to S3, (x3)
OR
Upload and use image bytes in memory, do all the resizing, upload the 3 re-sized photos and the original to S3
Depends on your quality requirements and memory availability.
If you want the resized images to be good quality then using ImageMagick is probably a good option but that requires the source image to be saved locally on disk. On the other hand, you won't need to store all images in memory. Im4Java worked very well for me as an interface to IM.
Using the Java Graphics package and BufferedImage class you can do an in-memory operation but this might not produce as good quality images.

Categories

Resources