Android examples for Graphics:Image Size
get Max Size Image Reader
//package com.java2s; import android.hardware.camera2.CameraAccessException; import android.hardware.camera2.params.StreamConfigurationMap; import android.media.ImageReader; import android.util.Size; public class Main { public static ImageReader getMaxSizeImageReader( StreamConfigurationMap map, int imageFormat) throws CameraAccessException { Size[] sizes = map.getOutputSizes(imageFormat); Size maxSize = sizes[0];// w w w . j ava 2 s . c o m for (Size size : sizes) { if (size.getWidth() > maxSize.getWidth()) { maxSize = size; } } ImageReader imageReader = ImageReader.newInstance( //maxSize.getWidth(), maxSize.getHeight(), // for landscape. maxSize.getHeight(), maxSize.getWidth(), // for portrait. imageFormat, /*maxImages*/1); return imageReader; } }