Note that there are some explanatory texts on larger screens.

plurals
  1. POonPictureTaken method - getting data as a tiff?
    primarykey
    data
    text
    <p>So I was reading many tutorials on how to get an image preview and then save it. The usual tutorial involves using <code>SurfaceHolder</code> and <code>SurfaceView</code> with a <code>PictureCallback</code>.</p> <p>As it appears on the <a href="http://developer.android.com/reference/android/hardware/Camera.PictureCallback.html#onPictureTaken%28byte%5B%5D,%20android.hardware.Camera%29" rel="nofollow">documentation</a> this is the signature for </p> <p><code>public abstract void onPictureTaken (byte[] data, Camera camera)</code> </p> <p>Usually to save the image you can do something like</p> <pre><code>/** Handles data for jpeg picture */ PictureCallback jpegCallback = new PictureCallback() { public void onPictureTaken(byte[] data, Camera camera) { FileOutputStream outStream = null; try { // write to local sandbox file system // outStream = // CameraDemo.this.openFileOutput(String.format("%d.jpg", // System.currentTimeMillis()), 0); // Or write to sdcard outStream = new FileOutputStream(String.format( "/sdcard/%d.jpg", System.currentTimeMillis())); outStream.write(data); outStream.close(); Log.d(TAG, "onPictureTaken - wrote bytes: " + data.length); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { } Log.d(TAG, "onPictureTaken - jpeg"); } }; </code></pre> <p>but I'm not interested in saving a jpeg. I want to save a tiff image. Reading the documentation I've found a really general comment on <code>data</code> format:</p> <blockquote> <p>Called when image data is available after a picture is taken. The format of the data depends on the context of the callback and Camera.Parameters settings.</p> </blockquote> <p>So I clicked on <a href="http://developer.android.com/reference/android/hardware/Camera.Parameters.html" rel="nofollow">Camera.Parameters</a> but I didn't find anything useful.</p> <p>Is there a way to save the bytes as tiff? Am I doing something wrong?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload