Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
/*
 *  Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license.
 *  See full license at the bottom of this file.
 */

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;

public class Main {
    /**
     * Converts the supplied byte[] to a Bitmap at 75% compression
     *
     * @param bytes the bitmap's bytes
     * @return the Bitmap
     */
    public static synchronized Bitmap asBitmap(byte[] bytes) {
        Bitmap bmp = BitmapFactory.decodeByteArray(bytes, 0, bytes.length);
        return Bitmap.createScaledBitmap(bmp, bmp.getWidth() / 4, bmp.getHeight() / 4, true);
    }
}