Show Tiff format image in Android - android

I am using ImageView to showing the .tiff formatted image, but I am getting error of NullPointerException.
I am converting the image file into byte array and then setting it in ImageView.
How can I show this tiff file?

You cannot set the tiff image on a ImageView in android directly. http://code.google.com/p/tiffonandroid/source/browse/ this is a sample tiffviewer. This might help you

Tiff has images stored as rows of bytes starting at defined offsets. So you can easily retrieve single rows to build the full image.
If you open any tif file in hex editor you will see that first 4 bytes mark tiff by code. And next 4 bytes give offset for metadata about tif image.
Use random access file to open image tif file, then seek the offset and you land into metadata space.From here you can pick offset of required image rows. Then go and get it..
If we needed full load of image like jpeg or BMP, then collect and combine all these rows after decompression, if any. Then you will get the full image

Related

Android ImageSize Increases after downloading | Picasso

I have an image stored on my server whose size is 89kb.
https://s3-ap-southeast-1.amazonaws.com/images.crownit.in/emailer/push_banner_tambola_01072017_v2.jpg
However, after I download the bitmap using Picasso, The byteCount comes out to be 2 MB.
double lengthbmp = bitmap.getByteCount(); //1920000 Bytes
Is this anything to do with the resolution of the image?
The reason for the size change is due to a change in file format. The file is hosted as a JPEG, however you are converting it to a bitmap in your application. I converted the file using photoshop to give an example of the difference in file size based on format:
In terms of network load you will still only move the 89kb, as the file only increases in size when converted to bitmap in your application.
If you really want to maintain the JPG format follow the answer given in the following post: How to display image from URL on Android

how to extract frames of an animated .gif file in android

I want to extract all frames(images) of an animated .gif file as bitmap or Drawable or any common type of image and store all images in an array in android. How i do it?
please help me.

Add custom text to image and save android

I am trying to write text on an image and then save it to images.
I have tried
first answer of
Add text to image in android programmatically
and
first answer of
Generate a image with custom text in Android
I also tried adding text to relative layout, but I could not get it working.
using first two answer I was able to save image to gallery, but the saved images are blurred(no clear).
is there any other technique to save image? or can I improve anything?
Quality of bitmap(image) is maintained specially with this:
public boolean compress (Bitmap.CompressFormat format, int quality, OutputStream stream)
here :
quality Hint to the compressor, 0-100. 0 meaning compress for small size, 100 meaning compress for max quality. Some formats, like PNG which is lossless, will ignore the quality setting

how to construct image from hex values/strings

I have a text file in sd card named file.txt which contains a hex values of a JPG image.
These values is received from a hardware camera. Now i have to read this text file from sd card and then need to construct a JPG image from these hex values.
I tried over 1 week but couldn't able to construct the JPG image.
Can anyone help me???
N:B: My camera is "LinkSprite JPEG Color Camera"

Access to separate pixel of JPEG image in Android

In my android project I need to get access for each separate pixel of JPEG image. Image created by built-in photo application. I try to convert JPEG into Bitmap class instance, but OutOfMemoryException was thrown. After searching info about this problem I have found the following solution: resize image! But quality of image is important in my project, and i can't resize it. Is there any way to get each-pixel access?
if your image is too big and the quality is important i suppose the best way is to use or create your own class to cut the image in zone (eg : 50*50 px) , there is several jpeg info class in the internet to help you understand how work jpeg files.
Have you tried BufferedImage ? (it's not in the sdk but maybe usable)
The nature of jpeg makes it very hard to get the value of a single pixel. The main reason is that the data is not byte aligned, another is that everything is encoded in blocks that can be of sizes 8x16, 16x8 and 8x8. Also, you need to handle subsampling of chroma values.
If the image contains restart markers, maybe you can skip into the image so you don't have to decode the whole image before getting the pixel value.

Categories

Resources