From: Alan W. I. <ir...@be...> - 2001-11-27 20:29:35
|
On Tue, 27 Nov 2001, [iso-8859-1] Jo=E3o Cardoso wrote: > On Tuesday 27 November 2001 07:35, Alan W. Irwin wrote: > > | Thus, Andrew, I like your suggestion for using png format for our > | standard input format > > Do we have a standard [image] input format? That is another issue. As > Andrew said, there are two issues here: x20c.c and libplplot. Indeed there are two issues. But I think you are misunderstanding me here. My whole e-mail including the sentence you quoted was focussed on improving the x20c.c demo by using png images as the input and had nothing to do with libplplot. > If we are willing to have image reading/convertion in libplplot, than > we must start thinking on what we want, why, implement it, and than > recode x20c.c to use and *demonstrate* the new libplplot capabilities. That's one possibility. Another possibility is to leave plplot strictly al= one and simply enhance x20c.c to make a nice looking demo that the majority of our users can relate to and immediately adapt for their own needs. > > But I don't think that plplot should have such image capabilities, as > there are enought good quality libraries for that purpose. Instead, > the user will write his program, read the image in whatever format he > desires, using the method or library he desires, transformate it in > whatever way he desires, and then call plimage() to draw it. I think I agree with you on the libplplot issue. There are all sorts of excellent arguments for keeping it narrowly focussed on a plotting API without adding extra features that aren't directly related to plotting. So let us forget libplot and concentrate on the x20c.c issue from now on. > > x20c.c uses a fast and crude way of reading an image, with the > purpose of demonstrate a libplplot API. "lena" is generaly available > as jpeg. As I *didn't* want to use libgd to read jpeg, I converted it > to ppm, which is simple to read. I acknowledge your approach seems to work now (from your subsequent e-mail although you haven't checked it in so I cannot see for myself, yet), and also it does have the great advantage of simplicity. Nevertheless, in my view it is too limited an approach. IMHO, part of the point of demos is to allow our users to relate plplot with other work. Thus, I would profoundly disagree with the notion that no special libraries are allowed to be used b= y our examples other than libplplot and friends. Here with x20c we have an outstanding chance to do something really interesting so let us take advantage of the opportunity rather than limiting ourselves. To be specific, right now you limit the x20c demonstration to false colour (using default cmap1) and gray-scale images. With the png approach we can have the demonstration of actual colour images (i.e., scanned photographs o= r whatever). Now in order to work with colour images in plplot you do need the appropriate colour pallette defined for cmap1, but the png format, for example, does allow for up to 256 different colours in a pallette. (png format also has the truecolour alternative, but we must avoid that because plplot would not be able to work with it.) I have just found that the combination of pnmquant and pnmtopng does produce the colour-pallete style png format. Now I have done little coding yet, but from the documentation it looks like the colour pallette is accessible using the libgd library so that for the cost of ~15 extra lines of code in x20c we can demonstrate processing a colour image. With a few lines of commentary in x20c.c we can also advise all our Linux users how to use the netpbm utilities to transfor= m *any* of their favorite colour images into a png image with colour palette that the ~15 lines of libgd-related code in x20c.c could understand. Joao, instead of more discussion about this *before the fact*, let me try t= o implement colour images for x20c in the way I have outlined as a basis for further discussion. If I am successful with the code, and there are no othe= r nasty issues that arise, I hope to convince you that a colour picture of Lena will look better....;-) I have already found a colour version of this test image at http://www.dcs.gla.ac.uk/~wpc/gmm3/web/lena.jpg. Andrew, I assume you haven't yet had a chance to implement a libgd-based image reading routine for x20c so I am just going to go ahead on my own. Alan |