Code example for Bitmap

Methods: createBitmapgetHeightgetWidthrecycle

    public boolean fromFile() { 
        return mFromFile;
    private static Bitmap rotateImage(Bitmap bitmap, int orientation) {
        if (orientation != 0) {
            // We only rotate the thumbnail once even if we get OOM. 
            Matrix m = new Matrix();
            m.setRotate(orientation, bitmap.getWidth() * 0.5f,
                    bitmap.getHeight() * 0.5f);
            try { 
                Bitmap rotated = Bitmap.createBitmap(bitmap, 0, 0,
                        bitmap.getWidth(), bitmap.getHeight(), m, true);
                // If the rotated bitmap is the original bitmap, then it 
                // should not be recycled. 
                if (rotated != bitmap) bitmap.recycle();
                return rotated;
            } catch (Throwable t) {
Experience pair programming with AI  Get Codota for Java