Re: Matrix of pixels from/to an image file



On Sun, Mar 24, 2002 at 09:01:58AM -0500, Havoc Pennington wrote:

José Romildo Malaquias <romildo uber com br> writes:

Please, point me to an easy way of obtaining the matrix of pixels
from an image file (in any common format, like jpeg, png or xpm)
and the reverse, given the matrix of pixels, write it as an
image file.

I am programming in C/C++ for Linux with Gtk+.


Most people would use the gdk-pixbuf library, which comes separately
for GTK 1.2 and is included in GTK 2.0.

Yes, gdk-pixbuf can solve the problem. But I am looking for something
simple. I just need to have the matrix of pixels from my (grayscale)
image, which is saved in a common file format. Once I have the pixels
of the image, I want to manipulate them somehow (like applying some
digital filters for image enhancement) and get a new matrix of pixels
(the processed image). For rendering the image from its matrix of
pixels I am already using the plain Gtk+ drawing area widget toghether
with its expose event. Also I want to save the pocessed image in
a common file format.

After some searching, I have found that the PPM image file format
is extremely simple and understood by lots of image viewers. So I
have written two C functions to read/write an image from/to a PPM
file with easy.

Regards.
-- 
Prof. José Romildo Malaquias               Departamento de Computação
http://iceb.ufop.br/~romildo       Universidade Federal de Ouro Preto
romildo iceb ufop br                                           Brasil
romildo uber com br



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]