New topic: 

Color Reduction

<http://forums.realsoftware.com/viewtopic.php?t=46566>

         Page 1 of 1
   [ 4 posts ]                 Previous topic | Next topic          Author  
Message        DaveS          Post subject: Color ReductionPosted: Mon Jan 14, 
2013 7:01 pm                                 
Joined: Sun Aug 05, 2007 10:46 am
Posts: 4412
Location: San Diego, CA                Doe anyone have a straight forward (pure 
RealStudio, no plugins) algorithm for color reduction?

Right now my app calls the QTGraphicsExporter
Two problems..

1) Not Cross Platform (plus it does things I don't want/need)
2) currently Deprecated

All I need to be able to do is take a PICTURE object stored as 32bit and reduce 
it to what ever the user selects

256 Color
256 Gray
16 Color
16 Gray
4 colors
4 gray
B&W


256 Gray is easy, I have a algrorithm for that.....  and perhaps all I need to 
do is take each value AND it with 0xF0 to get 16 levels? 
then AND it with 0xC0 to get 4 gray?? but that doesn't seem right...


HELP?      
_________________
Dave Sisemore
MacPro, OSX Lion 10.7.4 RB2012r1
Note : I am not  interested in any solutions that involve custom Plug-ins of 
any kind  
                             Top                kermit          Post subject: 
Re: Color ReductionPosted: Tue Jan 15, 2013 10:49 am                         
Joined: Mon May 30, 2011 12:56 am
Posts: 590                I struggled with this for years and ended up biting 
the bullet and using the dreaded plugin.

There are some algorithms knocking about which use binary trees and progressive 
levels of averaging. Mostly expressed in C terminology.
There are a few PD libraries about: notably for Windows: the imagemagik set has 
a function or two for quantisation.
But you'll struggle to find anything easy for Mac, making a cross platform 
solution really messy.
Plugin wasnt expensive, and boy did it make my life easier.

Other than that, my previous efforts were 'map to closest of a fixed set of 
colors'
such as the 147 Interent colors:
http://www.w3schools.com/html/html_colornames.asp

and the Netscape bunch:
http://www.techbomb.com/websafe   
                             Top                DaveS          Post subject: 
Re: Color ReductionPosted: Tue Jan 15, 2013 11:02 am                            
     
Joined: Sun Aug 05, 2007 10:46 am
Posts: 4412
Location: San Diego, CA                Thanks... I am seeing the same types of 
things.... you would think it would be easy.

I have a valid way to do the GrayScale ones....
and can "cheat" for 256 colors, by saving image as a GIF and reloading it (OSX 
forces it to 256 colors then)

so now all I need is colors 256->16 and then 16->4      
_________________
Dave Sisemore
MacPro, OSX Lion 10.7.4 RB2012r1
Note : I am not  interested in any solutions that involve custom Plug-ins of 
any kind  
                             Top                charonn0          Post subject: 
Re: Color ReductionPosted: Tue Jan 15, 2013 1:58 pm                             
    
Joined: Mon Apr 02, 2007 2:08 am
Posts: 1066
Location: San Francisco, CA, USA                I believe the FreeImage library 
(open source, cross platform though you must build from source for non-Win32) 
can do this. There's a RB wrapper here.      
_________________
Boredom Software  
                             Top             Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 4 posts ]      
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to