LoginSignup
0

More than 5 years have passed since last update.

bitmapリサイズ

Last updated at Posted at 2016-08-02

存在するbitmapから新たなbitmapに大きさを変えたデータを入れる処理です

        //前提としてoriginal_imgに何かデータが入っているとします

        Bitmap img;

        //元の画像用の縦横の大きさを取得するための変数
        int width;
        int height;

        //元のbitmapから横幅と縦幅を取得
        width = original_img.getWidth();
        height = original_img.getHeight();

        //この辺で取得した横幅と縦幅を変えてリサイズします
        //例として今回は元データの1/4の画素数に変換します
        width=width/4;
        height=height/4;

        //imgにリサイズしたデータを入れます
        img= Bitmap.createScaledBitmap(original_img,width,height,false);

img= Bitmap.createScaledBitmap(original_img,100,100,false);
とかにすると100×100で精製されます

物忘れはよくないね

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0