bevy / photo-editor-android

Photo Editor SDK contains a lot of features like edit, scale, rotate and draw on images like Instagram stories.
MIT License
548 stars 189 forks source link

Black Screen On Redmi 4A #10

Open nickghodke opened 6 years ago

nickghodke commented 6 years ago

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.

vasiledoe commented 6 years ago

Same to me galaxy J5

nickghodke commented 6 years ago

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;

sreekanth100khere commented 5 years ago

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

nickghodke commented 5 years ago

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

sreekanth100khere commented 5 years ago

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.