# Class CapturedPhoto

java.lang.Object
com.codename1.camera.CapturedPhoto

public final class CapturedPhoto extends Object

Result of a still-photo capture via `CameraSession#takePhoto()`.

Both an in-memory JPEG byte array and a file path are returned; the framework always saves to the app-private storage so that the bytes survive the callback scope.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `CapturedPhoto(byte[] jpegBytes, String filePath, int width, int height)`
  Used by platform implementations.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `getFilePath()`
  FileSystemStorage path the JPEG was saved to.
  `int`
  `getHeight()`
  Pixel height of the captured photo.
  `byte[]`
  `getJpegBytes()`
  JPEG-encoded bytes of the captured photo.
  `int`
  `getWidth()`
  Pixel width of the captured photo.
  `Image`
  `toImage()`
  Convenience: decode the JPEG bytes into a Codename One `Image`.

  ### Methods inherited from class Object

  `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### CapturedPhoto

    public CapturedPhoto(byte[] jpegBytes, String filePath, int width, int height)
    Used by platform implementations.

- ## Method Details

  - ### getJpegBytes

    public byte[] getJpegBytes()
    JPEG-encoded bytes of the captured photo. Hand directly to the `com.codename1.ai.*` modules without re-reading from disk.

  - ### getFilePath

    public String getFilePath()
    FileSystemStorage path the JPEG was saved to. The file is in the application's private storage and persists until the app deletes it.

  - ### getWidth

    public int getWidth()
    Pixel width of the captured photo.

  - ### getHeight

    public int getHeight()
    Pixel height of the captured photo.

  - ### toImage

    public Image toImage() throws java.io.IOException
    Convenience: decode the JPEG bytes into a Codename One `Image`.
    Throws:
      `java.io.IOException`