---
Product: imaging
Platform: python
Page Type: docs
Canonical URL: https://docs.aspose.org/imaging/python/getting-started/quickstart
---

# Quick Start

Detect an image's format and read its header metadata in a few lines with Aspose.Imaging FOSS for Python, and see how it handles truncated input.

## Overview

This page walks through the smallest working example: probing a file for its format
and header properties, then seeing how the library handles a damaged file instead of
raising an exception.

---

### Probe a file

`probe()` is the main entry point. It reads just enough of the file header to
populate an `ImageInfo` result — it never decodes pixel data:

```python
from aspose_imaging_foss import probe

info = probe("photo.jpg")
print(f"{info.format}: {info.width}x{info.height}, {info.bit_depth}-bit")
```

`ImageInfo` exposes `format`, `width`, `height`, `bit_depth`, and `frame_count` —
populated only when the detected format actually carries that data.

---

### Probe a buffer or stream

`probe()` accepts a file path, a bytes buffer, or a binary stream directly, and
`detect_format()` returns just the `ImageFormat` when you don't need the full header:

```python
from aspose_imaging_foss import detect_format, probe

with open("photo.jpg", "rb") as f:
    data = f.read()

format_only = detect_format(data)

with open("photo.jpg", "rb") as stream:
    info = probe(stream)
```

---

### Handling truncated or malformed input

`probe()` never raises on malformed or truncated input. Instead of raising an
exception, it returns a partial `ImageInfo` with whatever fields it managed to read —
`format` is always set when the header's format marker was recognized, even if the
rest of the file is cut short:

```python
from aspose_imaging_foss import probe

truncated = full_gif_bytes[:-2]  # last two bytes missing

info = probe(truncated)
print(info.format)  # GIF -- detected from the header alone
```

This makes `probe()` safe to run against untrusted or partially-downloaded files
without wrapping every call in a try/except block.

---

### Next Steps

- [Installation](../installation/) — package setup and environment requirements
- [Developer Guide](../../developer-guide/) — the full format detection API
- [License](../license/) — MIT license terms

## See Also
- [Aspose.Imaging — Enterprise Documentation](https://docs.aspose.com/imaging/)