Image Handling

This page shows how to handle images in a connected camera storage using RICOH Camera Wireless SDK.

Contents

The following interfaces and classes are used when you manage images:

CameraImage

  • The CameraImage interface represents image information and image data.
  • This interface includes methods for obtaining image information and image data.

CameraDevice

  • The CameraDevice interface represents a camera device.
  • This interface includes methods for obtaining camera information and operating camera device.

CameraStorage

  • The CameraStorage interface represents a storage of camera device.

List Images

Use the getImages method of the CameraDevice interface to obtain a list of images stored in the connected camera device.

for (CameraImage image: cameraDevice.getImages()) {
    System.out.printf("Image Name: %s%n", image.getName());
}

The image list in camera storage is synchronized automatically in background process when the camera is connected and when the image list is updated. The image list is sorted in descending order of date and time.

Similarly, use the getImages method of the CameraStorage interface to obtain a list of images stored in camera storage. The getListImagesState method of the CameraStorage interface represents acquisition status of the image list for each storage.

Such as after manipulating the main body to delete an image, there are cases when the image list is not latest. In this case, use updateImages method to update the image list.

Obtain an Image

Use the getData method to obtain a single image.

FileOutputStream outputStream = null;
Response response = null;
try {
    outputStream = new FileOutputStream(new File(fileName));
    response = image.getData(outputStream);
} catch (IOException e) {
    e.printStackTrace();
} finally {
    if (outputStream != null) {
        try {
            outputStream.close();
        } catch (IOException e) {
            //do nothing
        }
    }
}

Obtain Image Thumbnails

Use the getThumbnail method to obtain image thumbnails.

FileOutputStream outputStream = null;
Response response = null;
try {
    outputStream = new FileOutputStream(new File(fileName));
    response = image.getThumbnail(outputStream);
} catch (IOException e) {
    e.printStackTrace();
} finally {
    if (outputStream != null) {
        try {
            outputStream.close();
        } catch (IOException e) {
            //do nothing
        }
    }
}

Delete Images

Deleting images is not supported on The SDK.