nguyencobap
nguyencobap

Reputation: 49

How can I save ImageFormat.PRIVATE to JPEG file in Camera2?

When I use YUV_420_888 to convert to JPEG, it does'nt allow to save max resolution, just limit at 3840x2160, so I want to try ImageFormat.PRIVATE If not, what is ImageFormat.PRIVATE used for ?

Upvotes: 2

Views: 834

Answers (2)

Eddy Talvala
Eddy Talvala

Reputation: 18117

PRIVATE is not even a single format, necessarily. It's used on Android to communicate between device-specific components (for example, the camera HAL and the GPU driver, or the camera HAL and the video encoders) so that the components can pick a specific, efficient format for communication.

So PRIVATE from camera to GPU may be a different format under the hood than PRIVATE from camera to encoders, and also very different between two Android devices.

Unless you know exactly what your device and use case is, you can't meaningfully read PRIVATE buffers. You need to use the public formats like YUV_420_888 or JPEG, or have vendor-specific information, unfortunately.

Upvotes: 1

Alex Cohn
Alex Cohn

Reputation: 57163

PRIVATE may be used for recording or to generate texture for OpenCV to display. Usually, the camera can capture the maximum resolution as JPEG without going through YUV or PRIVATE formats.

Upvotes: 0

Related Questions