# Image Reader mojo-native library with benchmarks (JPEG, PNG, GIF, BMP)

**URL:** <https://forum.modular.com/t/image-reader-mojo-native-library-with-benchmarks-jpeg-png-gif-bmp/3527>\
**Category:** Community Showcase\
**Created:** [September 26, 2026, 12:17am UTC](https://forum.modular.com/t/image-reader-mojo-native-library-with-benchmarks-jpeg-png-gif-bmp/3527 "2026-09-26T00:17:14Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![AlexALX](https://sea1.discourse-cdn.com/flex001/user_avatar/forum.modular.com/alexalx/32/1299_2.png) [@AlexALX](https://forum.modular.com/u/AlexALX)\
**Post date:** [September 26, 2026, 12:17am UTC](https://forum.modular.com/t/image-reader-mojo-native-library-with-benchmarks-jpeg-png-gif-bmp/3527/1 "2026-09-26T00:17:14Z")

</div>

Hello everyone!

I wanted to share my open-source project called mojo-image-reader. It is a lightweight and dependency-free JPEG decoder written entirely in the **Mojo v1.1**.

Purpose: Built as a portfolio showcase and a useful tool for the Mojo ecosystem.

Features:

- JPEG Support: Baseline (8-bit and 12-bit precision SOF1), Progressive JPEG decoding, and full Chroma Subsampling support (4:4:4, 4:2:2, 4:2:0, and 4:2:0v).

- Performance & Memory Optimizations: Built with raw pointer arithmetic to bypass bounds-checking.

- Flexible Export & Interoperability: PPM Exporter (8-bit and 12/16-bit integer color depths), PFM Exporter (32-bit Float HDR), and a NumPy Bridge for zero-copy data exchange.

Project link: [https://github.com/AlexALX/mojo-image-reader](https://github.com/AlexALX/mojo-image-reader?utm_source=gemini)

* * *

Want to know your opinion and does it have any sense to continue and write things listed in the roadmap (BMP, PNG, GIF support)? I would appreciate any feedback or suggestions!

Thanks!

---

<div class="post-metadata">

**Author:** ![AlexALX](https://sea1.discourse-cdn.com/flex001/user_avatar/forum.modular.com/alexalx/32/1299_2.png) [@AlexALX](https://forum.modular.com/u/AlexALX)\
**Post date:** [September 27, 2026, 5:24am UTC](https://forum.modular.com/t/image-reader-mojo-native-library-with-benchmarks-jpeg-png-gif-bmp/3527/2 "2026-09-27T05:24:52Z")

</div>

Pushed new updated, so now it supports 1-component jpeg (grayscale), proper restart markers support and optimized with SIMD instructions, made it work in x5 times faster.

---

<div class="post-metadata">

**Author:** ![AlexALX](https://sea1.discourse-cdn.com/flex001/user_avatar/forum.modular.com/alexalx/32/1299_2.png) [@AlexALX](https://forum.modular.com/u/AlexALX)\
**Post date:** [October 1, 2026, 6:15am UTC](https://forum.modular.com/t/image-reader-mojo-native-library-with-benchmarks-jpeg-png-gif-bmp/3527/3 "2026-10-01T06:15:09Z")

</div>

Did major updates and finished the roadmap!

The library now supports parsing **JPG, PNG, GIF, and BMP** , with export capabilities to **PPM, PGM, PFM, and PAM** formats.

Key highlights:

- **GIF** : Frame sequence extraction with proper disposal handling.

- **Precision** : Export to 8, 12, or 16-bit files.

- **Performance** : Hardware-adaptive SIMD acceleration where applicable + zero-alloc memory optimizations.

---

<div class="post-metadata">

**Author:** ![AlexALX](https://sea1.discourse-cdn.com/flex001/user_avatar/forum.modular.com/alexalx/32/1299_2.png) [@AlexALX](https://forum.modular.com/u/AlexALX)\
**Post date:** [October 3, 2026, 5:12am UTC](https://forum.modular.com/t/image-reader-mojo-native-library-with-benchmarks-jpeg-png-gif-bmp/3527/4 "2026-10-03T05:12:48Z")

</div>

Also created a benchmark and sample repository: **[mojo-image-reader-bench](https://github.com/AlexALX/mojo-image-reader-bench)**, complete with performance charts comparing it against Python’s Pillow.

 ![benchmark_comparison](https://us1.discourse-cdn.com/flex001/uploads/modular/original/2X/3/3ffd1e341c3741f5881baa3a6b44bb8804fc539d.png)  
Of course, there’s still room to optimize, and I might improve it more later, but the results so far are already very good!

---

<div class="post-metadata">

**Author:** ![AlexALX](https://sea1.discourse-cdn.com/flex001/user_avatar/forum.modular.com/alexalx/32/1299_2.png) [@AlexALX](https://forum.modular.com/u/AlexALX)\
**Post date:** [October 13, 2026, 7:16pm UTC](https://forum.modular.com/t/image-reader-mojo-native-library-with-benchmarks-jpeg-png-gif-bmp/3527/5 "2026-10-13T19:16:12Z")

</div>

Did more optimizations and new bench graph looks like this:

 ![benchmark_comparison](https://us1.discourse-cdn.com/flex001/uploads/modular/original/2X/a/a9a9e47ebe57427066ae8137e7b9d33fac15174f.png)  
ps png performance stay same, not sure why it different between first run and latest
