# ImageCollection Class

> An image collection can hold multiple images, created from an image file.

- Product: Adobe PDF Library 21
- Language: Modern C++
- Version: 21.4.0
- HTML page: https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/ImageCollection
- Version index: https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/llms.txt

```cpp
class ImageCollection
```

**Namespace:** `datalogics_interface`

## Description

An image collection can hold multiple images, created from an image file.

The full set of images in the collection can be saved to a single image file, but only as a .tif image file. For any other file type (JPG, PNG, and so on), the collection can only be saved as one image object per file.

**Referenced by:** [`Page`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Page.md)

**Uses types:** [`Image`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Image.md), [`ImageType`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/enum/ImageType.md)

## Constructors

### ImageCollection

```cpp
datalogics_interface::ImageCollection::ImageCollection()
```

*constructor*

Create an empty image collection, which can have Image objects added to it.

### ImageCollection

```cpp
datalogics_interface::ImageCollection::ImageCollection(const std::string &file_name)
```

*constructor*

**Parameters**

- `file_name` (`const std::string &`)

Create an empty image collection, which can have Image objects added to it.

### ImageCollection

```cpp
datalogics_interface::ImageCollection::ImageCollection(ImageCollection &&) noexcept
```

*constructor*

**Parameters**

- (unnamed) ([`ImageCollection &&`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/ImageCollection.md))

### ~ImageCollection

```cpp
datalogics_interface::ImageCollection::~ImageCollection()
```

*destructor*

## Methods

### append

```cpp
void datalogics_interface::ImageCollection::append(Image image)
```

**Parameters**

- `image` ([`Image`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Image.md)): the Image object to be inserted.

**Returns:** `void`

Insert the given Image object at the end of the ImageCollection.

### get_count

```cpp
int datalogics_interface::ImageCollection::get_count() const
```

**Returns:** `int`

The count of Image objects in the collection.

Gets the number of Image objects in this collection.

### get_image

```cpp
Image datalogics_interface::ImageCollection::get_image(int index) const
```

**Parameters**

- `index` (`int`): the index of the Image to be retrieved.

**Returns:** [`Image`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Image.md)

the Image object at the specified index.

Retrieve the Image object at the specified index. Note that an exception will be generated if an index is given which is out of range.

### operator=

```cpp
ImageCollection & datalogics_interface::ImageCollection::operator=(ImageCollection &&) noexcept
```

**Parameters**

- (unnamed) ([`ImageCollection &&`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/ImageCollection.md))

**Returns:** [`ImageCollection &`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/ImageCollection.md)

### save

```cpp
void datalogics_interface::ImageCollection::save(const std::string &filename, ImageType type)
```

**Parameters**

- `filename` (`const std::string &`): the file which to save the image.
- `type` ([`ImageType`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/enum/ImageType.md)): the image type to which to be saved. NOTE: The resolution of the first Image in the collection is used as the target Resolution for saving. (Support for saving multiple, different resolutions isn't available)

**Returns:** `void`

Save the images in the collection to the specified file and image type. Multiple images can only be save to an image type of TIFF, otherwise an exception will be thrown.

### save

```cpp
void datalogics_interface::ImageCollection::save(const std::string &filename, ImageType type, const ImageSaveParams &params)
```

**Parameters**

- `filename` (`const std::string &`): the file which to save the image.
- `type` ([`ImageType`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/enum/ImageType.md)): the image type to which to be saved. NOTE: The resolution of the first Image in the collection is used as the target Resolution for saving. (Support for saving multiple, different resolutions isn't available)
- `params` ([`const ImageSaveParams &`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/ImageSaveParams.md))

**Returns:** `void`

Save the images in the collection to the specified file and image type. Multiple images can only be save to an image type of TIFF, otherwise an exception will be thrown.
