Skip to content

Converting Tiff to Jpeg #28

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
vkmulloly opened this issue Feb 12, 2018 · 3 comments
Open

Converting Tiff to Jpeg #28

vkmulloly opened this issue Feb 12, 2018 · 3 comments

Comments

@vkmulloly
Copy link

TiffConverter.convertTiffJpg("/sdcard/in.tif", "/sdcard/out.jpg", options, progressListener);

Hi i am trying to convert tiff to jpeg format but my output is showing last captured image only,how i get both files converted,
and also please help me to convert tiff to base64 format

@Beyka
Copy link
Owner

Beyka commented Feb 12, 2018

"Hi i am trying to convert tiff to jpeg format but my output is showing last captured image "
What you mean?
If you trying convert few images, you should do it in cycle and use new output name, because jpeg not support multi page.

As for base 64 - you should open till work TiffBitmapFacrory and then convert obtained Bitmap object to base 64

@vkmulloly
Copy link
Author

vkmulloly commented Feb 13, 2018

I have one Tiff file which contain 2 jpeg image, i want to extract to 2 individual jpeg files from that tiff file
please help with sample code

@Beyka
Copy link
Owner

Beyka commented Feb 13, 2018

if your tiff contains few directories, you could use code like this:

TiffConverter.ConverterOptions options = new TiffConverter.ConverterOptions();
options.throwExceptions = false; //Set to true if you want use java exception mechanism;
options.availableMemory = 128 * 1024 * 1024; //Available 128Mb for work;

for (int i = 0; i < 2; i++) {
    options.readTiffDirectory = i; //Number of tiff directory to convert;
        
    //Convert to JPEG
    TiffConverter.convertTiffJpg("/sdcard/in.tif", "/sdcard/out" + i + ".jpg", options, progressListener);
}

You just use options.readTiffDirectory to specify which directory you want to convert

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants