Home   Archive   Permalink



bpp (colour depth)

Hello,
    
Is there a simple way to know the 'bpp' of an image (colour depth) ?
I have tested several stuff with the rgb refinement but cannot achieve any good result.    
    
Thanks in advance.

posted by:   Malko     15-Jan-2014/17:49:52-8:00



Probably best to use ImageMagick. There's an old Imagemagick-helper script from 2006(I haven't used it):
    
http://www.rebol.org/view-script.r?script=imagemagick-helper.r
    
There was also an R3 project in 2010 (also haven't tried it, but may help put in the right direction):
    
http://www.colineau.fr/rebol/R3_extensions.html#section-4

posted by:   Nick     15-Jan-2014/20:46:04-8:00



Actually, I expect there's also a Windows API function for that...

posted by:   Nick     15-Jan-2014/22:39:14-8:00



Thank you Nick.
    
I already use ImageMagic for that purpose.
    
As far as I can see, the proposals require the use external library. I was expecting something 'rebol only' that does not require use of external application, library, etc. :)
    
Anyway, I will read more in-deep the proposed links to see if something helpful can be taken.
    
Could you please confirm me that the image datatype refinement only allow : size, rgb and alpha. It's already good for but isn't there any other available refinement ?


posted by:   Malko     16-Jan-2014/5:33:41-8:00



I haven't had to do this before. Can't you determine this just by evaluating the list of colors in the image?:
    
R E B O L []
colors: copy []
img: logo.gif
repeat i length? img [append colors pick img i]
colors: unique colors
editor colors
foreach c colors [probe c/1 probe c/2 probe c/3]
ask "Continue..."
    
Cyphre is the guy to talk with about graphics in Rebol. He's available on AltME (that's really the best place to talk with the rest of the community).

posted by:   Nick     16-Jan-2014/6:01:03-8:00



Yeah, bad idea, out of memory...

posted by:   Nick     16-Jan-2014/9:26:08-8:00