Beyka / Android-TiffBitmapFactory

MIT License
131 stars 46 forks source link

Fatal signal 8 (SIGFPE), code -6, fault addr 0xee5 in tid 4032 (Worker Thread) #23

Closed onuryurtturk closed 7 years ago

onuryurtturk commented 7 years ago

Fatal signal 8 (SIGFPE), code -6, fault addr 0xee5 in tid 4032 (Worker Thread)

How can i handle this?

onuryurtturk commented 7 years ago

i tried build from source but same error throwing

onuryurtturk commented 7 years ago

also tried bitmap decoding from resources and save it as tiff. Same error revealing. How can I use this library without error? Whats wrong?....

Beyka commented 7 years ago

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

onuryurtturk commented 7 years ago
                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
onuryurtturk commented 7 years ago

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.

onuryurtturk commented 7 years ago

Is there any example bitmap file and example code for usage? (except wiki codes)

Beyka commented 7 years ago

Sorry, but no other example code. Only on wiki page. What device did you use? Have you tried same options but without orientation field?

onuryurtturk commented 7 years ago
 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

Beyka commented 7 years ago

As temporary fix for converting png to tiff you could use class TiffConverter.

onuryurtturk commented 7 years ago

Can you TiffConverter explain with some example codes ?

Beyka commented 7 years ago

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.

onuryurtturk commented 7 years ago

thanks man, it worked but how can i add more pages to this tiff? I need to add pages to tiff

Beyka commented 7 years ago

For appending page to existing tiff add to convert options:

converterOptions.appendTiff = true;
Beyka commented 7 years ago

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) {
                    }
                }
onuryurtturk commented 7 years ago

@Beyka awesome man :) thanks alot. I achieved my goal with your snippet. thanksss 👍

Beyka commented 7 years ago

Tiff saver error fixed with 5550a8644cf89958a79f86670bda3814159b8932 You could build new version from repo or wait while version 0.9.7.7 will be available