photo-editor-android
photo-editor-android copied to clipboard
Black Screen On Redmi 4A
Device: Redmi Model number: Redmi 4A Using this lib's app in the above mentioned device, I get a black screen whether I import image (which was clicked by camera) from gallery or take a photo using the camera in the app.
Same to me galaxy J5
i resolved it by changing the value of options.inSampleSize to 6 instead of 1 BitmapFactory.Options options = new BitmapFactory.Options(); options.inSampleSize = 6; in PhotoEditorActivity.
Previously it was BitmapFactory.Options options = new BitmapFactory.Options(); options.inSampleSize = 1;
@nickghodke Any clue why it worked? And where did you come up with this "magic number" 6 from. If you have more information regarding the bug & fix please let me know.
Did it worked for you i actually dont remember it right now but i was getting an issue on that sampleInSize while debugging so i changed it to randomly 6 other than 1 and it worked for me
The documentation says so:-
/**
* If set to a value > 1, requests the decoder to subsample the original
* image, returning a smaller image to save memory. The sample size is
* the number of pixels in either dimension that correspond to a single
* pixel in the decoded bitmap. For example, inSampleSize == 4 returns
* an image that is 1/4 the width/height of the original, and 1/16 the
* number of pixels. Any value <= 1 is treated the same as 1. Note: the
* decoder uses a final value based on powers of 2, any other value will
* be rounded down to the nearest power of 2.
*/
So regardless of you use 4 or 6 the value that is taken is 4, if you want to make a difference, you should use the value 8.