Beyka / Android-TiffBitmapFactory

MIT License
131 stars 46 forks source link

when I used the "int dirCount = options.outDirectoryCount;",the dirCount of result is -1 #13

Closed 1049884729 closed 7 years ago

1049884729 commented 7 years ago

I hava a question when I used the "int dirCount = options.outDirectoryCount;"but this dirCount is -1,please help me !thank you very much!

Beyka commented 7 years ago

Hello. It's because inDirCount and outDirCount works like List.size() or array.lenght() functions. It means that, if you image has outDirCount == 3, you should use inDirCount ==0, 1, 2, but not 3

1049884729 commented 7 years ago

thank you reply my question,I kown your said,when I read the functions of mark ,mean that " /**

Beyka commented 7 years ago

if outDirectoryCount after decoding with or without inJustDecodeBounds is -1, then there is an error decoding image. Try to set inThrowException to true before decoding and if there is some error - library will throw exception.

Also

outDirectoryCount will be set to 0 if {@link #inJustDecodeBounds} is set to false and image decoded successful.

This is wrong. I will change it in nearest release, but if image decoded successful, then in outDirectoryCount option will be number of directory in image file

1049884729 commented 7 years ago

the log error is " Caused by: org.beyka.tiffbitmapfactory.exceptions.NotEnoughtMemoryException: Available memory is not enought to decode image. Available 20000000 bytes. Need 32012288 bytes. at org.beyka.tiffbitmapfactory.TiffBitmapFactory.nativeDecodePath(Native Method) at org.beyka.tiffbitmapfactory.TiffBitmapFactory.decodeFile(TiffBitmapFactory.java:96) "

Beyka commented 7 years ago

Did you try other files? maybe you forgot add <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> to your manifest file?

1049884729 commented 7 years ago

ah,yes, I forgot add the permission。and now the log error is “Caused by: org.beyka.tiffbitmapfactory.exceptions.NotEnoughtMemoryException: Available memory is not enought to decode image. Available 20000000 bytes. Need 32012288 bytes. at org.beyka.tiffbitmapfactory.TiffBitmapFactory.nativeDecodePath(Native Method) at org.beyka.tiffbitmapfactory.TiffBitmapFactory.decodeFile(TiffBitmapFactory.java:96)” thanks very much

1049884729 commented 7 years ago

@Beyka Thank you very much ! I have resolve my question

Beyka commented 7 years ago

NotEnoughtMemoryException For decoding you can use almost all memory of device. And yeah, 20Mb is to less to decode big images. Default value for this field is 244Mb