(WIP) Attempt at adding metadata to PNG output
An attempt at the PNG part for #6.
Brought over relevant code from cairo's cairo-png.c and added png_set_pHYs call.
At the moment it compiles but I've probably done something silly as only an empty file is generated. Opening WIP (Work in progress) PR now in case someone has time to look over the code in the meantime.
P.S. What tool should I be using to format the files in order to honour the styling of this project? e.g. line length, braces, etc
Example libpng code, if that helps: https://github.com/swaywm/wlroots/blob/master/examples/screencopy.c#L171
Cheers, I rewrote based on that and can at least get a file written to disk now, and have confirmed the scale metadata is there too.
Resolution reported in "Image properties" in GIMP:
- Before this PR: 72 × 72 ppi
- After after this PR: 11.811 × 11.811 pixels/mm
Now I just have to figure out how to get libpng to write to a buffer instead of to a file and this PR should be done.
General style note: we don't align, we use tabs
https://github.com/emersion/grim/pull/102 adds manual libpng calls.
Nice, that solves the issue I was having tryng to get cairo to output to stdout (probably something silly on my part).
That just leaves the discussion about what to do with screenshots spanning multiple monitors.