android - Combine two images into one orientation issue -
I want to create an app where the user can take a picture with the back camera, and then with the front camera.
Then, after that I get two bitmaps and I want to add them to an image.
I use this code for front camera parameters:
// Set up photo orientation for saving ... camera. Parameter parameter = theCamera.getParameters (); Parameters.setRotation (90); FrontCamera.setParameters (parameter); // Set Camera Preview and Portrait Front Camera. Stop Preview (); FrontCamera.setDisplayOrientation (90); FrontCamera.setPreviewDisplay (holder); FrontCamera.startPreview ();
I use this code to take pictures with the front camera
cameraObject.takePicture (shuttercollback, rawcollback, jpgcodeback);
Callback to take a picture with the camera back
ImagecrawlbackJPGCallack = New ImageCallback () {@OverWide Public Wide On PictureText (byte [] data, Camera camera) {BackBitmap = decodeBitampFromByte (data, 0, 800, 800); FrontCameraObject.release (); InitFrontCamera (); }};
Note: A similar code is to take a picture with the front camera, I get two bitmaps, and then I want to combine them with the code below I try, but bitmap is saved with wrong standardization.
I use this code for the combination of two bitmaps: frontBitmap, backBitmap
Public Bitmap Alliance Images (bitmap c, bitmap s, string local) {bitmap cs = null; Int w = c.getWidth () + s.getWidth (); Int h; If (c.getHeight ()> = s.getHeight ()) {h = c.getHyight (); } Else {h = s.getHyight (); } Cs = bitmap.creditbetaMap (w, h, bitmap config.argb_8888); Canvas combo image = new canvas (CS); ComboImage.drawBitmap (c, 0f, 0f, null); ComboImage.drawBitmap (s, c.getWidth, 0f, null); String tmpImg = String.valueOf (System.currentTimeMillis ()) + ".png"; OutputStream OS = Faucet; {OS = Try New FileOutputStream (loc + tmpImg); Cs.compress (compressed form PNG, 100, OS); } Grip (IOException E) {Log.e ("Alliance Images", "Problems in the Combination of Images", e); } Return CS; } Note The image with the water bottle is taken back with the camera, and the other front camera is with
ComboImage.drawBitmap (s, c.getWidth, 0f, null); to
comboImage.drawBitmap (S, 0f, C.Het, tap);
Comments
Post a Comment