Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Bitmap bottomImage = BitmapFactory.decodeResource(getResources(),R.drawable.blink);
- Bitmap topImage = (Bitmap) data.getExtras().get("data");
- // As described by Steve Pomeroy in a previous comment,
- // use the canvas to combine them.
- // Start with the first in the constructor..
- Canvas comboImage = new Canvas(bottomImage);
- // Then draw the second on top of that
- comboImage.drawBitmap(topImage, 0f, 0f, null);
- // bottomImage is now a composite of the two.
- // To write the file out to the SDCard:
- OutputStream os = null;
- try {
- os = new FileOutputStream("/sdcard/DCIM/Camera/" + "myNewFileName.png");
- bottomImage.compress(CompressFormat.PNG, 50, os);
- //Bitmap image.compress(CompressFormat.PNG, 50, os);
- } catch(IOException e) {
- Log.v("error saving","error saving");
- e.printStackTrace();
- }
- int w = bottomImage.getWidth();
- int h = bottomImage.getHeight();
- Bitmap new_image = Bitmap.createBitmap(w, h ,bottomImage.getConfig());
Add Comment
Please, Sign In to add comment