help-octave
[Top][All Lists]
Advanced

[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: Wed, 31 Jan 2007 21:06:09 -0500


On Jan 30, 2007, at 10:01 PM, Robert A. Macy wrote:

However, it has the same flaw that all the image functions
are doing:
r=ones(256,1)*(0:255)/255;
g=.5*ones(256,256);b=.5*ones(256,256);
[X,map]=rgb2ind(r,g,b);
bmpwrite(X,map,"Xtest.bmp");
when opened the square is not gradually changing color as
expected, but a solid green square.

bmpwrite is expecting values in 0-255.  Try the following:

  r=ones(256,1)*(0:255)/255;
  g=.5*ones(256,256);b=.5*ones(256,256);
  bmpwrite(cat(3,r,g,b)*256,'Xtest.bmp');

- Paul



reply via email to

[Prev in Thread] Current Thread [Next in Thread]