6

I am developing an app in which I need the image in TIFF format. But in android you can convert your bitmap/image to only JPEG/PNG image.

Is there a good way to convert JPEG/PNG file to TIFF format on android?

Fylke
  • 1,753
  • 3
  • 19
  • 30
mudit
  • 25,306
  • 32
  • 90
  • 132

5 Answers5

0

I'm not sure that Android SDK supports Java Image I/O, but check out following question: Java API to convert JPEG to TIFF

Community
  • 1
  • 1
Harri Siirak
  • 1,182
  • 12
  • 15
  • Android SDK does not support Java Image I/O. Since the answer has been accepted, I would like to know is there any 3rd party port available somewhere? – Viktor Brešan Feb 15 '11 at 17:06
0

Android does not support TIFF files. You can get the Bitmap's raw pixel data array and convert it to TIFF manually using any of the links from the previous comment.

reflog
  • 7,587
  • 1
  • 42
  • 47
0

I've recently found this great library on Github by Beyka (which uses libtiff and others natively) that provides many utilities for handling, opening, and writing .tiff files.

An example of converting JPEG to TIFF:

TiffConverter.ConverterOptions options = new TiffConverter.ConverterOptions();
//Set to true if you want use java exception mechanism
options.throwExceptions = false; 
//Available 128Mb for work
options.availableMemory = 128 * 1024 * 1024; 
//compression scheme for tiff
options.compressionScheme = CompressionScheme.LZW; 
//If true will create one more tiff directory, else file will be overwritten
options.appendTiff = false;
TiffConverter.convertToTiff("in.jpg", "out.tif", options, progressListener);
DarkCygnus
  • 7,420
  • 4
  • 36
  • 59
0

Android Do Not Support java.awt.image.*

check this.

http://developer.android.com/reference/packages.html

Edward Falk
  • 9,991
  • 11
  • 77
  • 112
Awais Tariq
  • 7,724
  • 5
  • 31
  • 54
0

If you are willing to add some C++ to your project via the Android NDK, then libtiff should do what you want.

Miguel Grinberg
  • 65,299
  • 14
  • 133
  • 152