photo-editor-android icon indicating copy to clipboard operation
photo-editor-android copied to clipboard

Black Screen On Redmi 4A

Open nickghodke opened this issue 7 years ago • 5 comments

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.

nickghodke avatar Nov 18 '17 06:11 nickghodke

Same to me galaxy J5

vasiledoe avatar Apr 25 '18 07:04 vasiledoe

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 avatar Apr 26 '18 05:04 nickghodke

@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.

sreekanth100khere avatar Mar 25 '19 10:03 sreekanth100khere

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

nickghodke avatar Mar 25 '19 10:03 nickghodke

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.

sreekanth100khere avatar Mar 26 '19 11:03 sreekanth100khere