friday-scale-dct- Scale Friday images with DCT

Copyright(C) 2015 Oleg Grenrus, 2015 Alex Mason
MaintainerAlex Mason <>
Safe HaskellNone



Scale pictures using Discrete Cosine Transform.



scale Source


:: (ImagePixel i ~ pix, PixelChannel pix ~ pixChan, Integral pixChan, Pixel pix, Storable pixChan, Image i) 
=> (Int, Int)

Output width, height

-> i

Input image

-> Manifest (ImagePixel i)

Output image

scale (w,h) img scales the image img to size w * h. It is unlikely to do the right thing for "non-linear" colour spaces, such as HSV, where hue is an angle. In future versions there may be a class to restrict this function to only working on "linear" pixel types.

pix is the type of pixels in the image (see ImagePixel), pixChan is the underlying (Integral) pixel component type, ie Word8, Word16 (see PixelChannel). Future versions will support scaling floating point images with Float and Double channels.

Example types for this function:

scale :: (Int,Int) -> Manifest RGBAPixel -> Manifest RGBAPixel
scale :: (Int,Int) -> Delayed RGBPixel -> Manifest RGBPixel

Here pix is, for example, RGBAPixel, with pixChan being Word8

Some assumptions are made about the pix type, particularly that if pix is made up of channels of type pixChan, then they are stored directly next to each other by pix's Storable instance. If this is not the case, then the resulting image may produce garbage results. This should not be an issue for all of the friday pixel types.