[UP]


Manual Reference Pages  - readgif (3)

NAME

readgif(3f) - [M_readgif] read a GIF file (LICENSE:PD)

CONTENTS

Synopsis
Description
Options
Example
Authors
License

SYNOPSIS

subroutine readgif(filename, num_image, image, iostat, color_map, verbose)

   character(len=*), intent(in) :: filename
   integer, intent(in)          :: num_image
   integer, intent(out), allocatable :: image(:,:)
   integer, intent(out)         :: iostat
   real   , allocatable, intent(out) :: color_map(:,:)
   logical, intent(in), optional :: verbose

DESCRIPTION

read the num_image’th gif image from filename into arrays image and color_map

OPTIONS

filename
  input file
num_image
  number of image required
image Image data returned
iostat I/O error number, =0 if ok
color_map
  RGB for each level, range 0.0 to 1.0
verbose
 

EXAMPLE

Sample program:

      program demo_readgif
      use M_readgif, only : readgif
      use M_writegif, only : writegif
      implicit none
      character(len=*),parameter :: filename=’boxes.gif’
      integer                    :: num_image=1
      integer,allocatable        :: image(:,:)
      integer                    :: iostat=0
      real,allocatable           :: color_map(:,:)
      integer,allocatable        :: color_map2(:,:)
      logical                    :: verbose=.true.
      integer                    :: i,ii,jj
      call readgif(filename,num_image,image,iostat,color_map,verbose)
      if(iostat.ne.0)then
         write(*,*)’*demo_readgif* could not read GIF file ’,trim(filename)
         stop
      endif

write(*,*)’SIZE OF IMAGE =’,size(image) do i=1,rank(image) write(*,*)’RANK OF IMAGE=’,i,size(image,dim=i) enddo

write(*,*)’SIZE OF COLORMAP=’,size(color_map) do i=1,rank(color_map) write(*,*)’RANK OF COLORMAP=’,i,size(color_map,dim=i) enddo

! convert between colormap types ! writegif uses an integer colormap, values 0 to 255 ! readgif uses real values 0.0 to 1.0 ii=size(color_map,dim=1) jj=size(color_map,dim=2) allocate(color_map2(ii,0:jj-1)) color_map2=255*color_map

! change color and write standard gif file where (image.eq.1) image=4 call writegif(’boxes_new.gif’,image,color_map2)

end program demo_readgif

AUTHORS

Jos Bergervoet, Van Snyder, Maurizio Cremonesi, Clive Page, and others

LICENSE

This module contains a subroutine readgif(3f) which can read GIF files of types Gif87a and Gif89 (and maybe others). The code comes from various authors, see comments below. This version was put together by Clive Page who has put it into the public domain.


readgif (3) March 11, 2021
Generated by manServer 1.08 from 6507c33a-f082-4100-98ae-d77036522573 using man macros.