Image processing in Google App Engine - android

I am trying to create an application server that does the following.
Get images from a user phone (once every 10 minutes).
Compare the new image with a reference image (pixel by pixel)
I managed to store an image using the Blobstore APIs. But I am only allowed to retrieve and display this image in a webpage(using the Blobkey). I wish to get the pixel data and implement an image difference algorithm on the server.
Is there a way this can be accomplished ? And is there a way to accomplish this without the use of blobs or database storage ? I can basically discard the new image once the comparison is done. I just need to store the reference image.

You can load any file from the Blobstore if you know its key, and manipulate it anyway you want. For images it is as simple as:
Image referenceImage = ImagesServiceFactory.makeImageFromBlob(blobKey);
Take a look at Images API, which is an App Engine service.

Related

How to upload multiple files to Firebase from Android?

I have a simple phototaking android app that allows the user to take a photo and save it. I allow the user to create multiple versions of the photo in the app - adding captions, filters, etc. After the user is finished, I upload the photo to Firebase storage. Here I upload a few files
The original raw bitmap that was taken using the camera
The finished bitmap with all edited captions and filters applied
The thumbnail of the the raw bitmap, and finally
The thumbnail of the finished image
The thumbnails and the full size images allow users to undertake future interactions with the app.
What would be the most efficient way to upload the images? Options that I know of are
Using 4 different upload tasks from the Android app. But this is taking a few seconds to finish all 4 uploads.
Using 2 upload tasks for the fullsize images and then using Firebase 'functions' to create the the thumbnails in the server. However, I would need to create the thumbnails locally in the app for display purposes before uploading, so it would mean creating the thumbnail in 2 places - app and the server. Also it would mean doing double error handling - one at the server side and the other on the app end.
Is there any other option?
Looking forward to whatever help I can get. As usual, feel free to ask for clarifications, via comments.
That depends on your scenario. If you are on "Spark" plan then using firebase functions too much might exceed your free quota of:
Invocation (125K/month)
GB-seconds (40K/month)
CPU-seconds (40K/month)
But if you can upgrade to "Flame" or "Blaze" then it won't be an issue and its the preferable way.
On the other hand, thumbnail file aren't too big that takes much time for uploading, unless you are on extremely slow connection, then uploading thumb files from app won't be an issue. You might not even notice the uploading time. It will be quick.

Android : How the images can be saved and retrieved efficiently from server side?

I'm creating a native android application which loads images of users. (An image of the user that is shown as in WhatsApp, messenger, etc). I need to update the image once a user changes it.
One approach I'm aware of is saving images on a separate server and saving the link to the image in the database. While loading, fetch the image from the specified url and cache it.
Another is saving the image as blob (don't think it's efficient) and cache it.
What are the approaches that I have to save images and retrieve them efficiently?
I'm using spring boot and couchbase as backend
If you save a link:
Often you can store the image on a cloud server that's less expensive
You have to retrieve the link, then build the code to retrieve the image
Checking for updates is at least slightly more complicated
If you use Couchbase Lite:
New images can propagate easily to the client
Storage is efficient
Blobs are stored as separate files
The associated document overhead is tiny
Simple to implement

Is better optimize the image in server or in local?

So i´m creating a app in Android which stores images in a external server. I want to know where is better to make the optimization of the image file, in server, or give the non-optimize image to local and then optimize inside the app. Im using mysql for store the images, but if its better to use sqlite server i will change it. Thanks.
The best thing to do here is create an application on your server exposed through an API with query parameters to specify image sizes + caching mechanism.
For example:
www.mywebsite.com/imageloader/file-identifier?width=50&height=50&format=png
then implement a caching mechanism take a look at (https://dev.mysql.com/doc/refman/5.1/en/ha-memcached.html) for mysql on the server for this image using these parameters so the application can quickly return this file each time and not require too much work from the application. This will allow you to request multiple images at specific sizes when you need them for example only as a thumbnail... Or a full Gallery image which can be something much larger.
Additionally you will want to use an Image Library and there are certainly quite a few for Android (to name a few):
Picasso from Square http://square.github.io/picasso/
Fresco from Facebook https://github.com/facebook/fresco
Ion from this Github https://github.com/koush/ion
These can all help you format your images and cache them locally and even downsize the images as necessary.

What is the best way to save images in Parse?

What am I trying to achieve: Based on some filters by the app user, I want to return a list with text and images.
How am I doing it: I have created a table in Parse and have added a column with object type as 'file'. I have put all the jpg/gif images into that column. (double-click, browse, select image from local computer).
The trouble I am having is, the list takes considerable time (~7 seconds) before it is displayed on my android app.
Is there a better way of handling image data within Parse or should I store images somewhere else (like Amazon S3)?
I am using standard queries for Parse in order to get data, nevertheless, am also checking if there is any code latency. Wanted to confirm if I am correctly handling the image data for back-end or not.
Is there a better way of handling image data within Parse or should I
store images somewhere else (like Amazon S3)?
If your images is not too much or you are using for example(five image) its better to save the into the Assets or Drawable Folder for loading.
and if i correctly knows about this problem, you need to use ProgressBar and one image, before loading the Images in Internet.
Caching images and displaying
Hope this helps.
I am using Parse to store images too, but it's not slow as you said. Since Parse is part of Facebook, I think their infrastructure is the same. There are possible issues:
Internet connection: Slow or on 3G?
Images: files are big?
Let me know which case you are in.
If you just display thumbnail images, I suggest you to process it before saving to Parse by writing Cloud function as describe on their blog. The you just need to use generated thumbnails on your listview/gridview

Android data handling

I'm creating an app where users can upload data and pictures, which are stored in my server, and those data can be accessed by other users.
How do I send/receive data and pics to/from my server
I am planning to provide camera in the app, if so how do I manage the size of pics for easy accessing both ways
you should be more specific, about the technology you plan to use for the server side. Whatever you choose, Try with JSON for easy protocol on your data transfer from server to device, search for what frame work to use for the android part
here an example with ,
REST
Android ION library can help with sending images in both directions.
If you plan to use Camera Intent, you will have no control over the images you get back, so you will need to resize them on your side. If you use the Camera API (a.k.a. custom camera) in your app, you can choose any picture size supported by your device.

Categories

Resources