[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Anybody have a prgram to write a .bmp file?
From: |
Geordie McBain |
Subject: |
Re: Anybody have a prgram to write a .bmp file? |
Date: |
Thu, 01 Feb 2007 15:12:02 +1100 |
On Wed, 2007-01-31 at 19:44 -0800, Robert A. Macy wrote:
> Is there another way?
>
> cat comes back as undefined.
Yes, you can use reshape ([r, g, b], [(size (r)), 3]); e.g.
---
octave:25> n=3; m=5; r = rand (n, m); g = rand (n, m); b = rand (n, m);
octave:26> all ((reshape ([r, g, b], [(size (r)), 3]) == cat (3, r, g,
b)) (:))
ans = 1
---
>
> On Wed, 31 Jan 2007 21:06:09 -0500
> Paul Kienzle <address@hidden> wrote:
> >
> > 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
> >
>
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://www.cae.wisc.edu/mailman/listinfo/help-octave
--
Geordie McBain
www.aeromech.usyd.edu.au/~mcbain