Closed onuryurtturk closed 7 years ago
i tried build from source but same error throwing
also tried bitmap decoding from resources and save it as tiff. Same error revealing. How can I use this library without error? Whats wrong?....
I think that this is error in some of algorithms in native code. It's difficult to found. Could you attach file that you trying to open and write decode options. Thank you
TiffSaver.SaveOptions options= new TiffSaver.SaveOptions();
options.compressionScheme = CompressionScheme.LZW;
options.orientation = Orientation.LEFT_TOP;
boolean saved = TiffSaver.saveBitmap(tiffFileName, bitmap, options);
Log.e("TIFF ", " Saved " + saved);
also tried appendBitmap instead of saveBitmap
bitmap is decoded from small png resource 24x24 px, not a big file.
My goal : Take photo from camera, save it external storage as a png. Decode file from file and save as a tiff file. First part is okay. I saved as png and decode from storage but cant convert to tiff.
Is there any example bitmap file and example code for usage? (except wiki codes)
Sorry, but no other example code. Only on wiki page. What device did you use? Have you tried same options but without orientation field?
wrote: /storage/emulated/0/xyz/TestMandantAktuell2015/Kasse/DOC-20170904-234155.jpg
nativeTiffOpenForSave /storage/emulated/0/xyz/TestMandantAktuell2015/Kasse/DOC-20170904-234157.tif
Software Name: TiffBitmapFactory-0.9.7.6
Release: 5.0.1
Full Release: Android 5.0.1
ANDROID_BITMAP_FORMAT_RGBA_8888
A/libc: Fatal signal 8 (SIGFPE), code -6, fault addr 0x10b7 in tid 4279 (.digitasticplus)
removed options lines
boolean saved = TiffSaver.saveBitmap(tiffFileName, bitmap);
not working
Device : Samsung Galaxy S4 I9500 Android 5.0.1
As temporary fix for converting png to tiff you could use class TiffConverter.
Can you TiffConverter explain with some example codes ?
Yes, of course.
TiffConverter.ConverterOptions converterOptions = new TiffConverter.ConverterOptions();
converterOptions.compressionScheme = CompressionScheme.LZW;
converterOptions.imageDescription = "Some text description";
converterOptions.resUnit = ResolutionUnit.INCH;
converterOptions.xResolution = 72;
converterOptions.yResolution = 72;
boolean isSaved = TiffConverter.convertPngTiff("/sdcard/source.png", "/sdcard/out.tif", converterOptions, listener);
This class is in alpha, but I using it in my application.
thanks man, it worked but how can i add more pages to this tiff? I need to add pages to tiff
For appending page to existing tiff add to convert options:
converterOptions.appendTiff = true;
Here is my part of code:
if (!created) {
try {
boolean isSaved = false;
if (imageFormat == ImageFormat.JPEG) {
isSaved = TiffConverter.convertJpgTiff(model.getFilePath(), file.getAbsolutePath(), converterOptions, listener);
} else if (imageFormat == ImageFormat.PNG) {
isSaved = TiffConverter.convertPngTiff(model.getFilePath(), file.getAbsolutePath(), converterOptions, listener);
}
if (isSaved) {
created = true;
}
} catch (OutOfMemoryError e) {
} catch (RuntimeException e) {
}
} else {
converterOptions.appendTiff = true;
try {
if (imageFormat == ImageFormat.JPEG) {
TiffConverter.convertJpgTiff(model.getFilePath(), file.getAbsolutePath(), converterOptions, listener);
} else if (imageFormat == ImageFormat.PNG) {
TiffConverter.convertPngTiff(model.getFilePath(), file.getAbsolutePath(), converterOptions, listener);
}
} catch (OutOfMemoryError e) {
} catch (RuntimeException e) {
}
}
@Beyka awesome man :) thanks alot. I achieved my goal with your snippet. thanksss 👍
Tiff saver error fixed with 5550a8644cf89958a79f86670bda3814159b8932 You could build new version from repo or wait while version 0.9.7.7 will be available
Fatal signal 8 (SIGFPE), code -6, fault addr 0xee5 in tid 4032 (Worker Thread)
How can i handle this?