[fpc-pascal]How to process pictures?

Vinzent Hoefler JeLlyFish.software at gmx.net
Wed Jan 8 14:28:10 CET 2003

On Wednesday 08 January 2003 01:54, Rainer Hantsch wrote:

> What I want to do is writing FreePascal Programs for LINUX which can
> work with pictures (reading/writing JPG files to/from memory in a
> usable form). With 'usable', I mean that the picture should be easily
> accessible, so an array [x,y,color] would be a good choice, I think.
> (Color = 0..2 for R/G/B)

type color = (red, green, blue);

The array would force you to use a fixed resolution. A solution with an 
array of pointers to lines could probably be better, because it is more 
dynamic. Normally I'd use a simple linear buffer and calculate the 
index myself. And probably it is better to use 4-bytes for the colors 
instead of three, some formats even store transparency values and it is 
generally faster in access. Just some thoughts.

> How can I read a jpg file into such an array and decode/uncompress it
> hereby?

Please take a look at http://www.freepascal.org, I think under 
contributed units you will find at least one JPEG-library.

> Again: I never did that before. I also do not know which libraries
> are the best for easy coding. Some say OpenGL, others say Qt, ...

What about Gtk? :-)


When in doubt, use brute force.
		-- Ken Thompson

More information about the fpc-pascal mailing list