|
Boost : |
Subject: Re: [boost] Review request: gil::io
From: Nicolas Lelong (rotoglup_at_[hidden])
Date: 2009-05-25 16:53:46
> 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.
Cheers,
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk