We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpOther Libraries › Can you load PNGs as 8 bit grayscale
Page Index Toggle Pages: 1
Can you load PNGs as 8 bit grayscale? (Read 348 times)
Can you load PNGs as 8 bit grayscale?
Mar 6th, 2008, 4:31am
 
I'm working on a project which involves loading a ton of little black and white PNGs into memory.  The default imageLoad() method in Processing loads them as RGBs, which I think is using 3 times as much memory as is necessary.  Does anyone know a way to load images as a single channel?

   Thank you --

           -- Todd
Re: Can you load PNGs as 8 bit grayscale?
Reply #1 - Mar 6th, 2008, 9:24am
 
Unfortunately everything is stored as ARGB within processing no matter what format. They're also stored de-compressed so even if you've managed to crunch the png file down to a small file size, when i's loaded into processing it uses 4*number of pixels bytes.
Re: Can you load PNGs as 8 bit grayscale?
Reply #2 - Mar 6th, 2008, 11:47pm
 
I was thinking a possible work-around for this might be to load a grayscale image into each channel of a PImage, and then convert the proper channel to a RGB with equal R/B/G values at display time.  This might be really processor-intensive.  I haven't tried it yet, as I haven't hit the memory wall, but I'll post back if I do give it a shot.
Page Index Toggle Pages: 1