RGB (0-255) image format?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

RGB (0-255) image format?

Schwab,Wilhelm K
Is there a clever and fast way to turn an array of RGB triads (each slot taking on uint8 values from 0-255) into a Form, or better yet treat it directly as a Form?  If I understand ColorForm correctly, it uses a map and the image "pixels" are indexes into same.  In this case, I would allocate a block of memory, hand it to a library, and it would blast the RGB values all over it.  Do we have a ready way to use the result w/o having to loop over the individual values?

I am working on an interface to PLplot (http://plplot.sourceforge.net/).  It is working, but so far only if I save files to disk, which I would like to not *have* to do.  Sometimes (batches in particular), it makes sense to let the code that creates a graph save it, but I also like to do a lot of interactive plotting that should not have to hit the disk.

Bill



_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: RGB (0-255) image format?

Schwab,Wilhelm K
Some searching did not turn up an answer, but I might be able to let the library "think" in 24 bbp, and then use a C function to expand the result into 32 bbp for Pharo.  Would the alpha value be 255??

Bill

________________________________________
From: [hidden email] [[hidden email]] On Behalf Of Schwab,Wilhelm K [[hidden email]]
Sent: Sunday, September 19, 2010 10:55 AM
To: [hidden email]; [hidden email]
Subject: [Pharo-project] RGB (0-255) image format?

Is there a clever and fast way to turn an array of RGB triads (each slot taking on uint8 values from 0-255) into a Form, or better yet treat it directly as a Form?  If I understand ColorForm correctly, it uses a map and the image "pixels" are indexes into same.  In this case, I would allocate a block of memory, hand it to a library, and it would blast the RGB values all over it.  Do we have a ready way to use the result w/o having to loop over the individual values?

I am working on an interface to PLplot (http://plplot.sourceforge.net/).  It is working, but so far only if I save files to disk, which I would like to not *have* to do.  Sometimes (batches in particular), it makes sense to let the code that creates a graph save it, but I also like to do a lot of interactive plotting that should not have to hit the disk.

Bill



_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: RGB (0-255) image format?

Schwab,Wilhelm K
The library assumes a 24 bit layout; unless I want to edit/recompile it, I have no say in that.  The best I have been able to find is to let it do its thing and then expand the result into what Pharo uses for a 32 bit layout; I take that to be adding an alpha bit to each pixel??



-------------------------------------------

Javier Díaz Reinoso javier_diaz_r at mac.com
Sun Sep 19 18:16:23 UTC 2010

You need to browse the Graphics-File category, there you can found how the different formats are read/write from files to memory.

A better name for ColorForm should be IndexedColorForm: 8 bit index into a palette of colors, used also for 8 bit gray images. If you have RBG you need to use 32 (or 16) bit Forms.



________________________________________
From: [hidden email] [[hidden email]] On Behalf Of Schwab,Wilhelm K [[hidden email]]
Sent: Sunday, September 19, 2010 1:49 PM
To: [hidden email]; [hidden email]
Subject: Re: [Pharo-project] RGB (0-255) image format?

Some searching did not turn up an answer, but I might be able to let the library "think" in 24 bbp, and then use a C function to expand the result into 32 bbp for Pharo.  Would the alpha value be 255??

Bill

________________________________________
From: [hidden email] [[hidden email]] On Behalf Of Schwab,Wilhelm K [[hidden email]]
Sent: Sunday, September 19, 2010 10:55 AM
To: [hidden email]; [hidden email]
Subject: [Pharo-project] RGB (0-255) image format?

Is there a clever and fast way to turn an array of RGB triads (each slot taking on uint8 values from 0-255) into a Form, or better yet treat it directly as a Form?  If I understand ColorForm correctly, it uses a map and the image "pixels" are indexes into same.  In this case, I would allocate a block of memory, hand it to a library, and it would blast the RGB values all over it.  Do we have a ready way to use the result w/o having to loop over the individual values?

I am working on an interface to PLplot (http://plplot.sourceforge.net/).  It is working, but so far only if I save files to disk, which I would like to not *have* to do.  Sometimes (batches in particular), it makes sense to let the code that creates a graph save it, but I also like to do a lot of interactive plotting that should not have to hit the disk.

Bill



_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project