Android:save captured image format from JPEG to PNG in internal storage directory

rwcnbmcbds

New Member
In Eclipse,i have Captured Image from emulator and it save the format as JPEG.But i want to save the image format as PNG. How can i convert image format from JPEG to PNG.Here I am using this code to save the image in directory.\[code\] SimpleDateFormat dateFormat = new SimpleDateFormat("yyyymmddhhmmss"); String date = dateFormat.format(new Date()); String photoFile = "Picture_" + date + ".PNG";// String photoFile = "Picture_" + date + ".JPEG"; String filename = pictureFileDir.getPath() + File.separator + photoFile; File pictureFile = new File(filename); try { FileOutputStream fos = new FileOutputStream(pictureFile); fos.write(data); fos.close(); Toast.makeText(context, "New Image saved:" + photoFile, Toast.LENGTH_LONG).show(); } catch (Exception error) { //Log.d(IntersaActivity.DEBUG_TAG, "File" + filename + "not saved: "+ error.getMessage()); Toast.makeText(context, "Image could not be saved.", Toast.LENGTH_LONG).show(); } \[/code\]Thanks in Advance.
 
Back
Top