Accessing Last Processed Image

This page describes how to access the last processed camera frame using the Anyline Mobile SDK for iOS, even when no scan result is produced.

Overview

The lastProcessedImage property on ALScanPlugin provides access to the most recently processed camera frame, regardless of whether it produced a scan result. This feature enables advanced use cases such as manual image capture, debugging workflows, and custom image processing.

Usage

Basic Access

Access the most recent processed image from your scan plugin:

// Get the most recent processed image
ALImage *lastImage = scanPlugin.lastProcessedImage;
if (lastImage != nil) {
    // Convert to UIImage for further processing
    UIImage *uiImage = lastImage.uiImage;

    // Your custom logic here
    [self processImage:uiImage];
}

Manual Image Capture

Create a manual capture feature for users:

- (IBAction)captureButtonPressed:(UIButton *)sender {
    ALImage *currentFrame = self.scanPlugin.lastProcessedImage;
    if (currentFrame != nil) {
        // Save to photo library
        UIImageWriteToSavedPhotosAlbum(currentFrame.uiImage, self,
            @selector(image:didFinishSavingWithError:contextInfo:), nil);

        // Show feedback to user
        [self showCaptureSuccessMessage];
    } else {
        [self showNoCameraFrameMessage];
    }
}

Best Practices

  • Always check for nil: The property returns nil if no frame has been processed yet

  • Convert once: If you need the UIImage multiple times, call alImage.uiImage once and reuse the result

  • Access efficiently: Avoid accessing the property repeatedly in tight loops

Limitations

  • Only the most recent processed frame is available (no frame history)

  • Only processed frames are available, not raw camera data