Boost logo

Boost Users :

Subject: Re: [Boost-users] [GIL] Saving DPI in PNG files
From: Mateusz Łoskot (mateusz_at_[hidden])
Date: 2011-12-02 07:15:20


On 2 December 2011 11:59, PB <newbarker_at_[hidden]> wrote:
> Hello,
>
> Is it possible to state a DPI setting when saving a PNG file using
> Boost' Generic Image Library?

I assume you will use the next generation IO, it is GIL io_new
recently accepted [1]

Calculate the following image info details:
info._res_x = (your_dpi * 10000 + 127) / 254;
info._res_y = info._res_x;
info._phy_unit_type = PNG_RESOLUTION_METER;

then set info._valid_resolution to true and the writer will store it.

I have never had to write it myself, so it's a sort of pseudo-code
based on reading GIL source code.

[1] http://lists.boost.org/boost-announce/2011/01/0281.php

Best regards,

-- 
Mateusz Loskot, http://mateusz.loskot.net
Charter Member of OSGeo, http://osgeo.org
Member of ACCU, http://accu.org

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net