I can't figure out why I'm getting corrupted images when I save them
in my app.  In fact the thumbnail seems to be fine, but the actual
image is corrupted, as if the stride value is not being set
correctly.  The following is the code I'm using the save the image,
which is taken from other version of camera apps almost directly.  In
other apps it seems to be saving images without problem.  This is
called from a Camera.PictureCallback.onPictureTaken(byte[] data,
Camera camera)


File filename = new File("Test_SnapShotK.jpg");
File exportDir = new File(Environment.getExternalStorageDirectory(),
"TestDir");

if (!exportDir.exists()) {
        exportDir.mkdirs();
        Log.i(TAG, "making directory " + exportDir.toString());
}

File file = new File(exportDir, filename.getName());

try {
        FileOutputStream fileOutputStream = new FileOutputStream(file);
        fileOutputStream.write(data);
        fileOutputStream.flush();
        fileOutputStream.close();

} catch (IOException e) {
        Log.e(TAG, e.getMessage(), e);
}

Since I can't attach the image I'm getting directly in this post, here
is a link to it.

http://www.mechnology.com/Test_SnapShotK.jpg

Has anyone else gotten this problem and have been able to resolve it.
I'm testing this on a G2 phone.  Any help is greatly appreciated.


Stephen

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to