Open AndroidDeveloperLB opened 7 years ago
Please check http://stackoverflow.com/questions/27581750/android-capture-screen-to-surface-of-imagereader for a full explanation.
If you try adding the solution, this is the patch:
I am not going to apply it in the demo as it is a performance killer (check the two loops it performs) but for a use case you mentioned in another thread (capturing a single image, I think you added a new task for that) should be fine.
Basically Image.Plane
buffers have some padding for each row that you either accept it in the final product and add it to the bitmap (black margins) or you try to remove it (but removal is slow).
But it adds this padding not just in the end, but also in the beginning. The link you've provided says it's only at the end, and it's also the solution there: https://commonsware.com/Android/previews/screenshots-and-screen-recordings
Anyway, I've put a StackOverflow question about this:
Just noticed that the sample produces files with black left&right margins:
Why does it occur? What should be done to fix it? Tested on Nexus 5x with Android 7.1.2