[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.1 Simple image handling

Module: gl.simple.image

OpenGL doesn't provide any means of reading/writing image data, and it should be covered by other Gauche extensions. However, it is sometimes handy to have simple means to handle external image data, so that you can do some experiment with Gauche-gl alone.

This module provides a minimal support to handle external image data, so that one can do some experiment in Gauche-gl alone.

The functionality might be extended over time, but this is never intended to be a full featured image library. A separate Gauche extension should be a better place to have it.

Currently, only reading from 8bit SGI image file is supported. It is written in pure Scheme, so don't expect the performance.

Function: read-sgi-image filename
Function: read-sgi-image-from-port port

Reads an image data in SGI format from the named file or the input port, respectively.

Only 8bit-per-channel, direct color mode is supported.

Returns four values: the image's width in pixels, its height in pixels, number of channels (e.g. 1 for grayscale, 3 for RGB, 4 for RGBA), and the image data in u8vector. The pixel data is packed, i.e. there's no padding between each pixel nor each scanline.

Warning: be careful to call this function interactively. The image data vector is usually huge, and you have to wait long for the REPL to display the entire result.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]

This document was generated by Shiro Kawai on June, 7 2008 using texi2html 1.78.