Conversation
|
This isn't the way we want to implement this. The camera stack should be configured to take the pictures in a lower resolution instead of doing a conversion from JPEG to JPEG which makes it more lossy and will be much slower. |
|
Fair enough, I'll see if I can write an improved version tomorrow. |
|
CameraX may have an API for doing this, but it's possible that it's currently missing. CameraX has made a huge number of improvements we haven't caught up with yet. |
|
It seems to be possible via https://developer.android.com/reference/androidx/camera/core/resolutionselector/ResolutionStrategy, which Camera already uses for QR codes. However, CameraX is unable to guarantee the requested resolution. We need to specify a fallback strategy towards a higher/lower resolution, both of which would be undesirable. To truly deliver on the promise of the feature, I think I would need to fall back to the higher resolution, and then again resort to a lossy JPG-to-JPG conversion to size to the correct limit if needed. An alternative might be to find a CameraX API that exposes the "native" resolutions of the camera, assuming it's a relatively limited set of options. |
de58a76 to
c6afab0
Compare
c6afab0 to
7478bf0
Compare
|
Fixed, didn't realize that |

Often I don't need a photo at maximum resolution. To efficiently use disk space, it's helpful to be able to limit the pixel size of the longest edge.