---
title: "Image annotation SDK for iOS"
canonical_url: "https://www.nutrient.io/guides/ios/annotations/annotate-images/"
md_url: "https://www.nutrient.io/guides/ios/annotations/annotate-images.md"
last_updated: "2026-05-15T19:10:05.012Z"
description: "Discover how to easily annotate images on iOS with our low-code image annotation SDK and powerful features for PDF-like functionality."
---

# Image annotation on iOS

With [`ImageDocument`](https://www.nutrient.io/api/ios/documentation/pspdfkit/imagedocument), you can view and annotate images using Nutrient iOS SDK. All you need to do is pass your image to [`ImageDocument`](https://www.nutrient.io/api/ios/documentation/pspdfkit/imagedocument), and we handle the rest. We use a prebuilt configuration that adjusts the UI to only show relevant options. Changes made to an image document remain editable even after saving. Take a look at `AnnotateImagesExample` in the Catalog app or read our [announcement blog post](https://www.nutrient.io/blog/image-documents/) to learn how you can annotate PNG, JPEG, and TIFF images just like a PDF with Image Documents.

This feature requires the [Image Documents](https://www.nutrient.io/guides/ios/annotations/annotate-images.md) component to be enabled in your license.

If you need to use an image as an annotation in another document, see our guide on [image annotations](https://www.nutrient.io/../../annotations/image-annotations/).

[`ImageDocument`](https://www.nutrient.io/api/ios/documentation/pspdfkit/imagedocument) is a subclass of [`Document`](https://www.nutrient.io/api/ios/documentation/pspdfkit/document) that can be initialized with an image file. Although it has capabilities similar to its parent class, you should keep the following conditions in mind.

## Image formats and size

You can initialize an [`ImageDocument`](https://www.nutrient.io/api/ios/documentation/pspdfkit/imagedocument) using a local image file URL. [`ImageDocument`](https://www.nutrient.io/api/ios/documentation/pspdfkit/imagedocument) supports the JPEG, PNG, and TIFF file formats. The compression quality when encoding to JPEG can be controlled using [`ImageDocument.compressionQuality`](https://www.nutrient.io/api/ios/documentation/pspdfkit/imagedocument/compressionquality).

We also enforce a maximum size of image that can be opened by [`ImageDocument`](https://www.nutrient.io/api/ios/documentation/pspdfkit/imagedocument). If an image’s area is larger than the area defined by [`PSPDFRenderSizeLimit`](https://www.nutrient.io/api/ios/documentation/pspdfkit/pspdfrendersizelimit), the image is not opened, as converting it to a bitmap would consume too much RAM.

## Annotation types

Although you can technically use any annotation type with [`ImageDocument`](https://www.nutrient.io/api/ios/documentation/pspdfkit/imagedocument), we recommend disabling certain annotation tools when working with image documents. For example, text selection- or text extraction-based annotations, such as highlight and underline annotations, don’t make sense for an [`ImageDocument`](https://www.nutrient.io/api/ios/documentation/pspdfkit/imagedocument) because there will be no selectable text in the document.

We recommend initializing your [`PDFViewController`](https://www.nutrient.io/api/ios/documentation/pspdfkitui/pdfviewcontroller) with the [`PDFConfiguration.imageConfiguration`] preset. This will automatically disable annotation types that aren’t relevant for image files:

### SWIFT

```swift

let controller = PDFViewController(document: imageDocument, configuration: PDFConfiguration.image)

```

### OBJECTIVE-C

```objc

PSPDFViewController *controller = [[PSPDFViewController alloc] initWithDocument:imageDocument configuration:PSPDFConfiguration.imageConfiguration];

```

## Customizing the UI

We also recommend only exposing relevant UI elements to your users. For example, you can disable the [document editing](https://www.nutrient.io/../../features/document-editor) feature to disallow adding new pages to an image document. Here’s a basic UI customization for a [`PDFViewController`](https://www.nutrient.io/api/ios/documentation/pspdfkitui/pdfviewcontroller) presenting an [`ImageDocument`]:

### SWIFT

```swift

let rightItems = [controller.annotationButtonItem, controller.activityButtonItem, controller.searchButtonItem]
let leftItems = [controller.outlineButtonItem, controller.brightnessButtonItem]
controller.navigationItem.setRightBarButtonItems(rightItems, for:.document, animated: false)
controller.navigationItem.setLeftBarButtonItems(leftItems, for:.document, animated: false)

controller.navigationItem.leftItemsSupplementBackButton = true

```

### OBJECTIVE-C

```objc

NSArray<UIBarButtonItem *> *rightItems = @[controller.annotationButtonItem, controller.activityButtonItem, controller.searchButtonItem];
NSArray<UIBarButtonItem *> *leftItems = @[controller.outlineButtonItem, controller.brightnessButtonItem];
[controller.navigationItem setLeftBarButtonItems:rightItems forViewMode:PSPDFViewModeDocument animated:NO];
[controller.navigationItem setLeftBarButtonItems:leftItems forViewMode:PSPDFViewModeDocument animated:NO];

controller.navigationItem.leftItemsSupplementBackButton = YES;

```

See `AnnotateImagesExample` from Nutrient Catalog for more details.

## Saving

To control how the backing image is saved by [`ImageDocument`](https://www.nutrient.io/api/ios/documentation/pspdfkit/imagedocument), use the [`imageSaveMode`](https://www.nutrient.io/api/ios/documentation/pspdfkit/imagedocument/imagesavemode) property. This property has two valid values: `ImageDocument.SaveMode.flatten` and `ImageDocument.SaveMode.flattenAndEmbed`.

- `ImageDocument.SaveMode.flatten` — When an [`ImageDocument`](https://www.nutrient.io/api/ios/documentation/pspdfkit/imagedocument) is saved, all the (visible) changes are saved back to the original image as is, and reopening this image will show these changes, but they will not be editable. When saving with this mode, any previously saved metadata in the document is removed as well.

- `ImageDocument.SaveMode.flattenAndEmbed` — This performs everything `ImageDocument.SaveMode.flatten` does, but it also saves all the modifications as part of the image’s metadata. When an image saved using this mode is opened with a regular image viewer, all the changes made will be displayed on the original image. However, when an image is opened with [`ImageDocument`](https://www.nutrient.io/api/ios/documentation/pspdfkit/imagedocument), the saved changes will then be editable. Be aware that using this option to save will increase the size of the images.

[`ImageDocument`](https://www.nutrient.io/api/ios/documentation/pspdfkit/imagedocument) also supports serialization and deserialization via the `NSSecureCoding` protocol. If you need to preserve editing abilities for an image document between application launches, you can simply archive and unarchive it using the standard iOS serialization APIs.

For the save mode to take effect, it must be changed before a save is performed.
---

## Related pages

- [Image annotation specification](/guides/ios/features/image-document-standard.md)

