Image Handling

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

Contents

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

CameraImage

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

CameraDevice

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

CameraStorage

  • The CameraStorage protocol represents a storage of camera device.

List Images

Use the images property of the CameraDevice protocol to obtain a list of images stored in the connected camera device.

for image in cameraDevice.images {
    print("Image Name: \(image.name)")
}

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 images property of the CameraStorage protocol to obtain a list of images stored in camera storage. The listImagesState property of the CameraStorage protocol 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.

guard let outputStream = OutputStream(toFileAtPath: path, append: false) else {
    return
}
outputStream.open()
defer {
    outputStream.close()
}
do {
    let response = try image.getData(outputStream: outputStream)
} catch {
    print("Error is occurred while getting data.")
}

Obtain Image Thumbnails

Use the getThumbnail method to obtain image thumbnails.

guard let outputStream = OutputStream(toFileAtPath: path, append: false) else {
    return
}
outputStream.open()
defer {
    outputStream.close()
}
do {
    let response = try image.getThumbnail(outputStream: outputStream)
} catch {
    print("Error is occured while getting data.")
}

Delete Images

Deleting images is not supported on The SDK.