M_pixel__writegif Module

NAME

writegif(3f) - [M_pixel__writegif] Codes pixel-map with palette into GIF
               format. Optional transparent color
(LICENSE:PD)

SYNOPSIS

subroutine writegif (FileName, Pixel, ColorMap, Transparent)

character(len=*), intent(in)         :: FileName
integer, intent(in), dimension(:,:)  :: Pixel
integer, intent(in), dimension(:,0:) :: ColorMap
integer, intent(in), optional        :: Transparent

DESCRIPTION

Write GIF file from pixel array and color map.

OPTIONS

FileName       file to create or replace
Pixel          Pixel values 0 to ncol
ColorMap       Color map (RGB 0:255 for colours 0:ncol)
Transparent    Optional

EXAMPLE

Sample call:

program demo_writegif
use M_pixel__writegif, only : writegif
integer  :: Pixel(100,100)
integer  :: Transparent = 0
integer  :: ColorMap (3,0:7)
colormap(:,0)=[255,255,255]
colormap(:,1)=[255,  0,  0]
colormap(:,2)=[  0,255,  0]
colormap(:,3)=[  0,  0,255]
colormap(:,4)=[255,255,  0]
colormap(:,5)=[255,  0,255]
colormap(:,6)=[  0,255,255]
colormap(:,7)=[  0,  0,  0]

! put some colored boxes into pixmap
pixel(:,:)=0
pixel(1:80,1:80)=1
pixel(11:20,11:20)=2
pixel(21:40,21:40)=3

! write gif with a transparent background
call writegif('boxes_t.gif',pixel,ColorMap,Transparent)

! change background color and write standard gif file
where (pixel.eq.0) pixel=4
call writegif('boxes.gif',pixel,ColorMap)

end program demo_writegif

AUTHOR

o Version 1.01, 1999 August: Written by Jos Bergervoet
o Version 2, 2008 Jan 28: Modified by Clive Page to use stream I/O,
  array as colourmap.
o Version 3, 2017 July 6: Modified by John Urban to make it easier
  to use with M_PIXEL(3f) module.

LICENSE

Public Domain.

PRODUCT: CLI library utilities and examples PROGRAM: M_pixel__writegif(3f) DESCRIPTION: This module can write a GIF file in GIF89 format from raster data

VERSION: 1.01, 19990808

AUTHOR: Jos Bergervoet

VERSION: 2.00, 20080128

AUTHOR: version by [[Clive Page]] makes use of Fortran stream I/O, array as colourmap

VERSION: 3.00, 20170706

AUTHOR: Modified by John Urban to make it easier to use with M_PIXEL(3f) module. LICENSE: Public Domain. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.


Contents


Subroutines

public subroutine writegif(FileName, Pixel, ColorMap, Transparent)

print *,’image size’, nx, ny, ‘ colours’, maxincol

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: FileName
integer, intent(in), dimension(:,:) :: Pixel
integer, intent(in), dimension(:,0:) :: ColorMap
integer, intent(in), optional :: Transparent