|
From: Ethan M. <merritt@u.washington.edu> - 2008-12-11 19:06:20
|
On Thursday 11 December 2008 10:26:24 Mojca Miklavec wrote: > On Thu, Dec 11, 2008 at 6:56 PM, Ethan Merritt wrote: > > On Wednesday 10 December 2008 08:42:21 Petr Mikulik wrote: > >> > > >> > One question: is "with image" already able to read png images? I had > >> > an impression that it was only able to read some > >> > unusual binary formats (3 bytes per pixel). > >> > >> Ethan has shown it works this way: > >> > >> plot '<convert table.png avs:-' binary filetype=avs with rgbimage > >> > >> Nowadays gnuplot is typically compiled with the gd library. Therefore it > >> should be pretty easy to use the gd-library to load png/gif/jpg images > >> directly. I think it may not be too much code in breaders.c. Could somebody > >> contribute this feature? > > > > I honestly don't see quite how that would work. > > Using libgd, or libpng for that matter, will result in an in-memory copy > > of the bitmap image. But that's not exactly what the binary file input code > > wants; it expects to read a stream of binary data on the input fd, so that it > > can filter, re-map, combine fields, etc. It seems to me that one would > > have to write a new input layer that dummies up access to an in-memory > > bitmap as successive reads to a fake pipe. > > > > What would we gain by adding all this extra code? Isn't it much better to let > > an external utility do this for us, as in the example you quote? > > One would gain readability. I would never have come to idea to use so > complicated code to be able to read PNG images. Well, it is documented. And it is quite general. The same command works for any image type that ImageMagick knows about. There is nothing special about *.png in this regard. > It's perfectly OK if external tools are being used, but it would help > a lot if calling external tools would happen automatically for > specific types of images. Do you mean that a command like plot 'imagefile' binary filetype=auto with rgbimage should always be expanded to the equivalent plot '<convert imagefile avs:-' binary filetype=avs with rgbimage if there is no special rule for the filetype extension? That would work OK on any unix-ish system that has ImageMagick installed, but would fail for other configurations. Or are you suggesting that gnuplot should have a plugin mechanism of some sort, that would be locally configured to invoke an appropriate external converter? I have no objection to that, but I don't have the expertise to write one. -- Ethan A Merritt Biomolecular Structure Center University of Washington, Seattle 98195-7742 |