views:

216

answers:

1

hi,

i am able to save the source image but not able save the image with colorfilter paint.setColorFilter(new ColorMatrixColorFilter(cm));

if this image is converted into bitmap it can be saved easily. but dunno how to do this. Is there anyone to give solution

thanks in advance

A: 
  1. Have your original bitmap.
  2. Create a new clean Bitmap that has the same width/height as your original bitmap.
  3. Create a new Canvas using this clean Bitmap.
  4. Set your paint object, etc for this new Canvas.
  5. Draw your original bitmap into this new Canvas.

Since this new Canvas is backed by a Bitmap (point 3.), any drawing you do in this Canvas will become part of the new Bitmap (point 2.). Now just call 'compress' on this Bitmap from point 2. and the bitmap will be saved as a jpg/png.

Streets Of Boston
canvas1 = new Canvas(cBitmap); canvas1.drawBitmap(cBitmap, x, y , paint); MediaStore.Images.Media.insertImage(getContentResolver(), cBitmap, null, null); i created the above as u said but still i m not bale to save the image as bitmap... Please help
starter
// You already have originalBitmap and its 'width' and 'height'.Bitmap newBitmap = Bitmap.create(width, height, config);Canvas canvas1 = new Canvas(newBitmap);canvas1.drawBitmap(originalBitmap, 0, 0, paint);(you may want to set a proper clipRect on the canvas1)After this code, newBitmap contains the originalBitmap modified by 'paint'.Either call insertImage with newBitmap or call newBitmap.compress(...)
Streets Of Boston
now its working fine but i m not able to save to sdcard... images are getting saved in camera pictures only
starter