---
Product: Aspose.PDF
Platform: net
Page Type: reference
Canonical URL: https://reference.aspose.org/pdf/net/ImageCollection
---

# ImageCollection

## Overview

`ImageCollection` is a class in Aspose.PDF FOSS for .NET.
Inherits from: `IReadOnlyList`.

Collection of image XObjects on a page.

This class provides 5 methods for working with ImageCollection objects in .NET programs.
Available methods include: `GetByName`, `GetEnumerator`, `Replace`.
All public members are accessible to any .NET application after installing the Aspose.PDF FOSS for .NET package.
Properties: `Count`.

## Properties

| Name | Type | Access | Description |
|------|------|--------|-------------|
| `Count` | `int` | Read | Gets the count. |

## Methods

| Signature | Description |
|-----------|-------------|
| `GetByName(name: string)` | Get an image by its resource name (e.g., "Im0", "JI1a"). |
| `Replace(index: int, stream: Stream)` | Replace the image data at the given 1-based index with the provided stream. |
| `Replace(name: string, stream: Stream)` | Replace the image with the given resource name. |
| `Replace(index: int, stream: Stream, quality: int, optimize: bool)` | Replace the image at the given 1-based index with the provided stream, re-encoding to JPEG at quality (0–100). |
| `GetEnumerator()` | Calls GetEnumerator on this ImageCollection instance. |

## See Also

- [Aspose.PDF for .NET — Enterprise API Reference](https://reference.aspose.com/pdf/net/)