|
Boost : |
Subject: Re: [boost] Review request: gil::io
From: Zach Laine (whatwasthataddress_at_[hidden])
Date: 2009-05-25 22:34:02
On Mon, May 25, 2009 at 3:53 PM, Nicolas Lelong <rotoglup_at_[hidden]> wrote:
>> But what do to with non-square pixels? Gil doesn't support this
>> > kind of thing yet.
>>
>> For the nonsquare pixels, you need to use the values in the pHYs chunk
>> to determine the aspect ratio, and then scale the image. This is
>> probably best done as a post-loading step -- after you load the image
>> into for instance a 4x32 image, scale it up to 32x32 before returning
>> it.
>>
>
> I frequently have to process batches of video frames that often have non sq.
> pixels ; I'd be frustated to have a lossy PNG loader in GIL.
>
> I don't think that silently rescaling an image with nonsquare pixels is good
> practice. A nonsquare pixel is still a pixel. Imagine that you want to apply
> a filter to a non sq. pix. PNG file, if GIL silently changes the image size,
> there's no way for you to get back the original image size and pixels. Not
> to mention that depending on the image type you may want to use different
> filter kernels to do the resize.
>
> IMHO the best solution would be to simply provide a way to know the pixel
> aspect ratio, and let users of the lib handle it the way they want, i.e.
> rescale or not or whatever.
Perhaps I'm using the wrong terminology? I'm referring to PNGs witha
pHYs chunk. According to the creator of PngSuite, the aspect ratio in
images with pHYs chunks should be used to scale the resulting image.
Look at cdfn2c08.png, which is is actually an 8x32 image:
http://www.schaik.com/pngsuite/pngsuite_cnk_png.html
Zach
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk