Rotating and changing the size of image in Android Camera -


i'm new android development , recently, i've made simple camera app android have problems cannot solve. first, i've rotated preview screen 90 degree surfaceview in portrait mode. 've used code below .

public void surfacechanged(surfaceholder holder, int format, int w, int h) {     if(mcamera != null) {         camera.parameters parameters = mcamera.getparameters();         parameters.setpreviewsize(mpreviewsize.width, mpreviewsize.height);         requestlayout();         mcamera.setdisplayorientation(90);         mcamera.setparameters(parameters);         mcamera.startpreview();     } 

but problem isn't solved. after take shot , check image in folder jpg image took app saved horizontally bad resolution.

i'm not sure how explain want alter image size , save in portrait mode. code save image sample below, i'm not how , can change size , rotation before saving. sorry bad english. great if can have clear tips noobs.

private class saveimagetask extends asynctask<byte[], void, void> {      @override             protected void doinbackground(byte[]... data) {                 fileoutputstream outstream = null;                  // write sd card                 try {                     file sdcard = environment.getexternalstoragedirectory();                     file dir = new file (sdcard.getabsolutepath() + "/camtest");                     dir.mkdirs();                                     string filename = string.format("%d.jpg", system.currenttimemillis());                     file outfile = new file(dir, filename);                      outstream = new fileoutputstream(outfile);                     outstream.write(data[0]);                     outstream.flush();                     outstream.close(); 

is possible rotate data in picturecallback?

picturecallback jpegcallback = new picturecallback() {         public void onpicturetaken(byte[] data, camera camera) {             //change rotarion               new saveimagetask().execute(data);             resetcam();             log.d(tag, "onpicturetaken - jpeg");         }     }; 


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -