REDIMENSIONAR IMAGENES


public static Bitmap redimensionarImagenMaximo(Bitmap mBitmap, String usuario, String imei){

try{
//Redimensionamos
int width = mBitmap.getWidth();
int height = mBitmap.getHeight();
float scaleWidth = ((float) Constantes.RESOLUCION_VGA_WIDTH) / width;
float scaleHeight = ((float) Constantes.RESOLUCION_VGA_HEIGHT) / height;
// create a matrix for the manipulation
Matrix matrix = new Matrix();
// resize the bit map
matrix.postScale(scaleWidth, scaleHeight);
// recreate the new Bitmap
return Bitmap.createBitmap(mBitmap, 0, 0, width, height, matrix, false);
}catch(Exception e){

LogCustom.error(Util.class.getClass().getName(), usuario, imei, e);
return null;
}

}

public static final int RESOLUCION_VGA_WIDTH = 640;
public static final int RESOLUCION_VGA_HEIGHT = 480;

Comentarios

Entradas populares de este blog

Subir proyecto al repositorio existente en Bitbucket

Sonarqube : The component parameter is missing