Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2003-01

How to process pictures?

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Rainer Hantsch

Hello!

Because I received not one answer to my earlier question, I want to repeat it. Please, be so kind and give me some help. I am an absolute novice with working with images, so any help is welcome. -- THANKS!

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)

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

If there are some ready made libraries available which produce a different (but known) output format, this will probably be a good start and possibly save a lot of work. - Which libraries do you recommend? HOW can they be used from FPC?

.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.

Another step (coming much later) will be to make the textmode program displaying the image on my X-Desktop (KDE). Is this very complicated? Does somebody have an example program for me which shows a simple way of opening a graphical window and show a picture inside, or, maybe, white a complete GUI application with an OOP (Non Delphi) model?

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, ... I don't know any of them and I also don't know their advantages and disadvantages. Because I do not want to do many exotic things (only standard programs looking like YAST2, i.e.), I will prefer the easier to code solution. Maybe, somebody has written a wrapper unit, offering handy procedures which are translated to the more or less complicated library calls in the background?

Please, leave me some information.

Thanks in advance

mfg

Ing. Rainer Hantsch

.---------------------------------------------------------------------. | \\|// Ing. Rainer HANTSCH - Hardware + Software | | (o o) Forget Windoze! -- We focus on L-I-N-U-X... | |--oOOo-(_)-oOOo------------------------------------------------------| | Ing. Rainer HANTSCH | mail: | | Khunngasse 21/20 | www: http://www.hantsch.co.at | | A-1030 Vienna | tel: +43-1-79885380 fax: +43-1-798853818 | | ** A u s t r i a ** | handy: +43-664-9194382 UID-Nr: ATU 11134002 | '---------------------------------------------------------------------'

Vinzent Hoefler
to Rainer Hantsch
Rainer Hantsch wrote 5 lines
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? :-)

Vinzent.

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