Android Torn Images - android

I am a newbie in android dev...
I more or less copied the camera implementation from http://marakana.com/forums/android/examples/39.html. However, it returns totally torn images like in the image link below. A notable thing is that the icon of that image in windows shows a correct image, therefore, there must be something wrong with the jpeg compression...
Does somebody had the same problem before?
thanks in advance!
lol cannot post images =.= how stupid

Related

Find out related images

I am looking for the way to get related images like Pinterest search. I have searched a lot. Most of the solution is to compare image pixel by pixel something like this. What I want is to compare the image if comparing result is more than 75% I want to show the images.
Is there any algorithm or image processing library available for Android to achieve this?
Please help to solve this. Any help would be appreciated.
thanks,

Android - Encode info in image pixels

I have an image processing app, and I have to remember which photos have already been processed. In order to do so, I store an EXIF metadata in the image file, but if the user decides to send the image over WhatsApp, etc, the metadata is lost, so I can't rely on this.
So I though a solution would be to use some pixels in the image to remember if the photo was processed or not, something like if that pixel has that color and that other that other color, then it was processed.
I have tried to do so, but if the image gets scaled down, then my approach won't work.
Any ideas on how to do it?
Thank you.
This is a quite complicated topic and there's no silver bullet that'll help you. One pitfall is the fact that most image compression algorithms try to throw away data our eyes cannot see, and your watermarking algorithm would then have to make modifications that are visible to the human eye, which is probably not what you want.
Another thing to note is whatever you do, if you go with the route of storing data using pixels, you're going to have false positives.
What you could do, since your app already does image processing, is to embed your application's logo as a watermark into the image somewhere. Then you can attempt to find distinct features of your logo in the image, which is admittedly not very easy, but neither is the problem.
Again, this problem is already quite complicated so I'm sorry if this answer isn't adequate.

Rendering large images in WebView

I'm a newcomer in development of android apps. But, I'm undertaking what feels like a large project and I'm looking for information on whether it will work or not, before I get to far in.
As I've read, when trying to display very large images in android, it is most useful to use the "webview".
So, I took that advice, split my image into 1024 smaller images, and laid them out in an html table (not quite finished yet). Now, I'm noticing as the table gets larger my phone begins to lag upon scrolling.
My question is, is webview trying to render every single picture at once upon loading? If so, is there a way to make webview only render a set of images at one time? Let's say I'm at 14,000X x 24,000Y on the image, can I set webview to render the next 5,000px in each direction only, or is this necessary at all?
I can't seem to find the information I'm looking for, but will continue to search. Otherwise, any and all help is appreciated. Thanks!
i have exactly same problem and i found use full this library:
https://github.com/nostra13/Android-Universal-Image-Loader
you can configure a lot of parameters and using cache..

Are there any other GIF creation libraries for Android?

I'd really love to know if there are better GIF file creation libraries for Android development. I've already tried this one as well an NDK based one called gifflen (it's really old apparently). Both I've found are slow and produce low colour amount GIFs with incredibly big inflated file sizes with quality settings that don't seem to do anything. Worst comes to worst I could just write the thing myself but it would save a lot of trouble if anyone knows of an existing one, thanks in advance.

Memory efficient way to scale an image

I've got an app where the main viewing area is a WebView.
It's a service where a user can also upload a photo. However, with the WebView, and photo uploads, I'm getting some OutOfMemoryErrors.
Usually all it takes is a page loaded in the WebView, and then simply trying to open an image with something like this:
Bitmap bmp = BitmapFactory.decodeFile(path);
The only reason I need to open the file at all is so that I can scale it down so that it fits in a max width/max height dimensions before uploading it.
I've even tried opening it in a sampled fashion, similar to what's mentioned here:
Strange out of memory issue while loading an image to a Bitmap object
However, with a complex webpage loaded in the WebView, I still get OutOfMemoryError when trying to open the image.
Is there a way to scale it, maybe using another process or something, that's more memory efficient?
I'm glad you asked, I was about to investigate this for my own project.
It looks like BitmapFactory.Options is your friend here, specifically BitmapFactory.Options.inSampleSize enter link description here. You can use BitmapFactory.decodeStream to get the image dimensions without creating a Bitmap.
Googling revealed the com.bristle.javalib.awt ImgUtil classes; these appear to be open source (don't know the license), and are AWT based, so may work on Android. The interesting method is ImgUtil.scalueImageToOutputStreamAsJPEG, which works with InputSteam/OutputStream, so may be memory efficient.
UPDATE
An alternative is to write a JNI wrapper around /system/lib/libjpeg.so, which appears to be standard on Android devices. This library works with scanlines, so can be memory friendly. Another plus is that using JNI should be faster than pure java.
Hope this helps,
Phil Lello
I had a similar problem and found a workable solution using BitmapFactory.Option.inScale. You can find details here: How do I scale a streaming bitmap in-place without reading the whole image first?

Categories

Resources