I have used Picasso in my Android Application which has many images. Its working and looking good. I am trying to make UI more of simple and user friendly. I have placeholder for my imageviews before actual image loads. But its white color. I want to placeholder image depending on main color of image like pinterest.
Pinterest placeholder images before main image loads. Following screenshot:
And after image loads it shows proper image based on main background color shown for placeholder:
Is it possible to achieve in Picasso library provided by Square or whats the way to achieve.
Please help.
Bit late but for other readers that want to accomplish a similar thing, I'll just leave this here. I don't know how Pinterest did/does it, probably developed their own implementation. But Google updated the v7 support library with 'Palette' which is a new API which allows you to extract prominent colours from images when provided with an Image Bitmap.
Edit: Something I just realised that this probably doesn't help for placeholders since you need an image to actually get colours from! So my best guess is that Pinterest does the colour extraction from the server and includes the colour in the (presumably) JSON response that is sent to the client.
I haven't used it much myself but it works quite well from what I've seen/read. You can read up more about it at these two places:
Developer Docs
Tutorial/Explanation (Willow Tree Apps)
You can only do that by saving the prominent color from the image while saving it in your database & then retrieving it for later use.
https://pypi.org/project/extcolors/ is a very easy to use python library that extracts the colors for you given an image.
Or you could you https://github.com/woltapp/blurhash a library that'll give you this.
Both ways, you'll have to first save the BlurHash or The color as a metadata in your database, and then when the user requests the data, you'll send either of those and display them till the data is fully downloaded.
Related
I have a list of image URLs and have to show them and change them automatically in ImageView and need to count how many times every image appears to the user.
What could be the best approach to do this? can we avoid handlers here?
Android provides views which can be used to display images from various sources and provide transitions between them. Some of these views are the ImageView and the ImageSwitcher. These views provide a high level of functionality to display images in a user interface so that we can concentrate on the images we want to display rather than taking care of rendering.
You can get complete guide setup in links description.
In description there is a complete explaination for changing image using ImageSwitcher
by pressing a button, But by updating the code to change after certain can be done easily.
Link to tutorial:
https://www.sitepoint.com/handling-displaying-images-android/
A github link for application used with image switching button:## Heading ##
https://github.com/Adarshgkp04/Android_Image_transitions.git
Feel free to ask queries.
I need the code to add invisible watermark to another image in Android
As the comments mentioned, Stackoverflow isn't a free coding service. I will provide you with a high level design advice from which you can implement your own code.
Invisible watermark could just be metadata. The point is to make your particular photo unique and identifiable, right? I would recommend you looking into image metadata manipulation for a simple solution.
That being said, if you are looking for some high tech stealthy watermarking, then you might be looking for pixel manipulation. You can change a few of the pixel colors so if it's compared with the original image with the naked eye, it looks identical but if compared with their base64 encoding you can see a difference. Simply create your own pattern as some sort of signature to attach to images to identify them.
Both method allows you to determine if an image is yours due to the "watermark" you leave on it.
There is an activity with ImageView inside.
I want to get the first image of google image search and place it as image source.
i think it is possible, i found something similar on a translation application.
Is there any api available for this ?
You should check Google Custom Search API, that alows filter by type
https://developers.google.com/custom-search/json-api/v1/reference/cse/list
The request will be something like
https://www.googleapis.com/customsearch/v1?googlehost=google.co.uk&safe=medium&searchType=image&key={apikey}&cx={cseId}&q={search}
See more here
https://lornajane.net/posts/2013/doing-google-custom-search-via-api
To use the images as a source, you can use Picasso Lib
I am trying to create an application which has a map image in it.
I want to add some areas (or buttons) to it so that when you click them the bubbles with information will appear.
I am new in android programming so asking to explain a bit how to implement it?
Also i need an image to be re-sizable just like a real map.
So should i attach the buttons to specific places on image and how to do so that the buttons will be connected to it when i re-size an image?
Which image type is better to use for this purpose? I heard that SVG would be better but i couldn't even add svg image to an application.
I appreciate any helpful advice.
For your problem you can use this:
http://catchthecows.com/?p=113
I need something similar, but the click on the image should change the content of that part as well.
When I find or implement the final solution I can post it here.
I am new to android.I want to insert a pictue (which is in c: drive) using image view control. pls give some idea related to it.
this covers that in detail. let us know if you have specific questions.
http://developer.android.com/guide/topics/graphics/2d-graphics.html#drawables-from-images
Displaying an image in an ImageView is quite simple. Check out this family of files from API Demos:
ImageView1.java
image_view_1.xml
ImageView1.java is quite simple: it just loads the xml layout file. You can change the #drawable/... references in image_view_1.xml to point to your own resources and see the effects you get with different styles of ImageView.
I recommend exploring the API Demos code, as it covers a large portion of the Android framework and will give you an idea about what is possible.