Re: Output of physical resolution of bitmap images

Uli Schlachter <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <[email protected]>
On 18.02.2017 06:37, Henner Zeller wrote:
> Anyway - it looks like there is no way to set the resolution on a
> cairo_surface_t which then would be written out in a png-header when
> calling cairo_surface_write_to_png().
> 
> Cairo never sets the resolution when writing the PNG (which would be a
> call to png_set_pHYs()).
> 
> This is a real limitation, because it means you can't create a
> high-resolution image of something and have the receiver of the image
> know exactly the size of the artwork.

You are not meant to create "real" PNGs with cairo. To quote the
documentation:

> It is a toy API. It only offers very simple support for reading and
> writing PNG files, which is sufficient for testing and demonstration
> purposes. Applications which need more control over the generated PNG
> file should access the pixel data directly, using
> cairo_image_surface_get_data() or a backend-specific access function,
> and process it with another library, e.g. gdk-pixbuf or libpng.
https://www.cairographics.org/manual/cairo-PNG-Support.html

Sorry,
Uli
-- 
- Captain, I think I should tell you I've never
  actually landed a starship before.
- That's all right, Lieutenant, neither have I.
-- 
cairo mailing list
[email protected]
https://lists.cairographics.org/mailman/listinfo/cairo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.