[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Anybody have a prgram to write a .bmp file?
From: |
Paul Kienzle |
Subject: |
Re: Anybody have a prgram to write a .bmp file? |
Date: |
Tue, 6 Feb 2007 22:06:40 -0500 |
On Feb 6, 2007, at 11:19 AM, Robert A. Macy wrote:
Paul,
I don't understand what you said.
The X index matrix is square, the same siaxe as the r,g,b
matrices, and consists of integers going from one up to the
total size of the matrix: rows*columns
The map is the similar size of
rows*columns by 3
and the values in the matrix are between 0 and 1
yes
colourmap appears to be 64 by 3 no matter what I do, even
if I clear the thing, it comes back after
[X,map]=rgb2ind(r,g,b);
yes
It sounds like you're trying to limit the color from 24 bit
down to 256 color, but how do I do that using these
functions?
When you do bmpwrite(X,map,'file') it is trying to
use a map of length 65536, but bmpwrite only
supports a map of length 256.
You can:
(a) detect if the map is of length greater than 256
and write a truecolor image instead,
(b) backport the bmpwrite from octave-forge CVS so
that you can writing truecolor rgb maps directly, or
(c) fix rgb2ind so that it finds the best map of
length 256 with which to represent the colors. I
suggested using a perceptual quantization rather than
an rgb quantization to make better use of the map.
I've implemented option (a) in the attached file.
- Paul
bmpwrite.m
Description: Binary data