title: Bitmap.compress takes too much time ( ~2 seconds )
body: <p>Bitmap compressing proccess takes too much time. How can I solve that problem ?</p>
  
  <p>in Activity:</p>
  
  <pre><code>icon= BitmapFactory.decodeResource(getResources(),R.mipmap.image);
  </code></pre>
  
  <p>in CallBackClass:</p>
  
  <pre><code>        synchronized (holder) {
              stream = new ByteArrayOutputStream();
              Log.d("LIFE_CYCLE", "settingImage 1=" + System.currentTimeMillis());
              icon.compress(Bitmap.CompressFormat.PNG, 100, stream);
              Log.d("LIFE_CYCLE", "settingImage 2=" + System.currentTimeMillis());
              byteArray = stream.toByteArray();
              b = BitmapFactory.decodeByteArray(byteArray, 0, byteArray.length);
              if(mWidth&lt;mHeight){
                  icon= Bitmap.createScaledBitmap(b, (int)(mWidth*0.75), (int)(mWidth*0.75), false);
              }
              else{
                  icon= Bitmap.createScaledBitmap(b, (int)(mHeight*0.75), (int)(mHeight*0.75), false);
              }
  
              canvas.drawColor(Color.TRANSPARENT, PorterDuff.Mode.CLEAR);
              canvas.drawBitmap(icon, ((mWidth)-icon.getWidth())/2, (mHeight-icon.getHeight())/2, new Paint());
              draw_target(canvas);
          }
  </code></pre>
  
  <p>This line takes ~2 seconds:</p>
  
  <pre><code>icon.compress(Bitmap.CompressFormat.PNG, 100, stream);
  </code></pre>
  
  <p>P.S. my image is partly transparent, so I need to use .PNG instead of .JPG</p>