title: How to save Drawable after setColorFilter on Android
body: <p>To apply color-filter to byte array that comes from <code>takePicure()</code> method, I converted it to <code>Drawable</code>. And after calling <code>Drawable.setColorFilter()</code>, I saved it as a image file. But, color-filter doesn't apply to image file. In this case, how to save the drawable applied color-filter. Here is my code.</p>
  
  <pre><code>Camera.PictureCallback mPicture = new Camera.PictureCallback() {
          @Override
          public void onPictureTaken(byte[] bytes, Camera camera) {
              mView.mRenderer.restartPreview();
              String storageDir = Environment.getExternalStorageDirectory().getAbsolutePath()
                      + "/" + Environment.DIRECTORY_DCIM + "/Camera";
              File dir = new File(storageDir);
  
              if (!dir.exists()) dir.mkdir();
  
              String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
              String path = storageDir + "/IMG_" + timeStamp + ".jpg";
  
              File file = new File(path);
              try {
                  ColorMatrix matrix = new ColorMatrix(new float[] {
                          1, 0, 0, 0, mView.mRenderer.mTest,
                          0, 1, 0, 0, mView.mRenderer.mTest,
                          0, 0, 1, 0, mView.mRenderer.mTest,
                          0, 0, 0, 1, 0
                  });
  
                  Drawable image = new BitmapDrawable(BitmapFactory.decodeByteArray(bytes, 0, bytes.length));
                  image.setColorFilter(new ColorMatrixColorFilter(matrix));
                  Bitmap bitmap = ((BitmapDrawable)image).getBitmap();
                  ByteArrayOutputStream stream = new ByteArrayOutputStream();
                  bitmap.compress(Bitmap.CompressFormat.JPEG, 100, stream);
                  byte[] bytedata = stream.toByteArray();
  
                  FileOutputStream fos = new FileOutputStream(file);
                  fos.write(bytedata);
                  fos.flush();
                  fos.close();
  
                  Intent intent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);
                  Uri uri = Uri.parse("file://" + path);
                  intent.setData(uri);
                  sendBroadcast(intent);
              }
              catch (Exception e) {
                  Log.e("CheckLog", e.getMessage());
                  return;
              }
          }
  };
  </code></pre>
  
  <p><code>mView.mRenderer.mTest</code> is a variable controlled by <code>SeekBar</code>. Thanks in advance.</p>