Author: David.PatersonDavid.Paterson Date: Apr 23, 2007 19:32
> How can I read a bitmap file into Fortran?
The following Fortran code fragment will read a 24 bit .bmp file. On
my compiler I also need the switch "/assume:byterecl"
integer Maxwidth,Maxheight,irec,iwidth,iheight,i,j,ipad
parameter(Maxwidth=3220,Maxheight=2415)
character header(54),ch
integer image(Maxheight,Maxwidth,3)
open(1,file='..\..
\cow_small.bmp',form='unformatted',access='direct',recl=1)
do irec=1,54
read(1,rec=irec) header(irec)
end do
if(ichar(header(11)).ne.54.or.ichar(header(29)).ne.
24.or.ichar(header(31)).ne.0) then
print*,'sorry, can not handle this file'
end if
|