# Allow specifying image PPI when writing PNG/JPEG files

**URL:** <https://forum.juce.com/t/allow-specifying-image-ppi-when-writing-png-jpeg-files/69653>\
**Category:** Feature Requests\
**Created:** [October 6, 2026, 9:49am UTC](https://forum.juce.com/t/allow-specifying-image-ppi-when-writing-png-jpeg-files/69653 "2026-10-06T09:49:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![PierreGuillot](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/pierreguillot/32/11653_2.png) [@PierreGuillot](https://forum.juce.com/u/PierreGuillot)\
**Post date:** [October 6, 2026, 9:49am UTC](https://forum.juce.com/t/allow-specifying-image-ppi-when-writing-png-jpeg-files/69653/1 "2026-10-06T09:49:16Z")

</div>

It would be useful to be able to specify the pixel density when writing images with `PNGImageFormat` and `JPEGImageFormat`.

Currently, as far as I can tell, there is no public API to control this metadata without modifying JUCE’s source code.

My proposed API is simply:

```cpp
void PNGImageFormat::setDensity (const juce::uint32 x, const juce::uint32 y);
void JPEGImageFormat::setDensity (const juce::uint16 x, const juce::uint16 y);

```

This is particularly useful when JUCE is used to generate image files, where the physical resolution (DPI) can be just as important as the pixel dimensions.

I have implemented and tested this approach in production on macOS, Windows, and Linux. The required changes are relatively small.

I’m happy to submit a PR if this feature would be considered appropriate for JUCE.

---

<div class="post-metadata">

**Author:** ![PierreGuillot](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/pierreguillot/32/11653_2.png) [@PierreGuillot](https://forum.juce.com/u/PierreGuillot)\
**Post date:** [October 8, 2026, 2:07pm UTC](https://forum.juce.com/t/allow-specifying-image-ppi-when-writing-png-jpeg-files/69653/2 "2026-10-08T14:07:51Z")

</div>

here is the PR: [Allow specifying image PPI when writing PNG/JPEG files by pierreguillot · Pull Request #1766 · juce-framework/JUCE · GitHub](https://github.com/juce-framework/JUCE/pull/1766)
