[UP]


Manual Reference Pages  - rgbmono (3)

NAME

RGBMONO(3f) - [M_color] converts RGB colors to a reasonable grayscale intensity. (LICENSE:PD)

CONTENTS

Synopsis
Description
Options
Returns
Examples
Author
License

SYNOPSIS

subroutine rgbmono</a>(rr,rg,rb,ri,status)

real, intent(in) :: RR real, intent(in) :: RG real, intent(in) :: RB real, intent(out) :: RI integer :: status

DESCRIPTION

RGBMONO(3f) converts RGB colors to a reasonable grayscale intensity. This can be used to produce monochrome images from color images. Intensity is calculated from the specified Red, Green, Blue intensities as 0.30*R + 0.59*G + 0.11*B, as in U.S. color television systems, NTSC encoding. Note that most devices do not have an infinite range of monochrome intensities available.

OPTIONS

RR red component of the input color in the range 0 to 100
RG green component of the input color in the range 0 to 100
RB blue component of the input color in the range 0 to 100

RETURNS

RI grayscale intensity calculated in the range 0 to 100
status zero (0) if no error occurred, otherwise result is out of bounds

EXAMPLES

Sample:

   program demo_rgbmono
   use M_color, only : rgbmono
   implicit none
   real    :: gray
   integer :: ierr
   call rgbmono(100.0,  0.0,  0.0,gray,ierr); write(*,*)’red     ’,gray
   call rgbmono(  0.0,100.0,  0.0,gray,ierr); write(*,*)’green   ’,gray
   call rgbmono(  0.0,  0.0,100.0,gray,ierr); write(*,*)’blue    ’,gray
   call rgbmono(100.0,100.0,  0.0,gray,ierr); write(*,*)’Yellow  ’,gray
   call rgbmono(  0.0,100.0,100.0,gray,ierr); write(*,*)’Cyan    ’,gray
   call rgbmono(100.0,  0.0,100.0,gray,ierr); write(*,*)’Magenta ’,gray
   call rgbmono(100.0,100.0,100.0,gray,ierr); write(*,*)’White   ’,gray
   call rgbmono( 00.0,  0.0,  0.0,gray,ierr); write(*,*)’Black   ’,gray
   call rgbmono( 50.0,  0.0,  0.0,gray,ierr); write(*,*)’Maroon  ’,gray
   call rgbmono(100.0, 50.0, 50.0,gray,ierr); write(*,*)’Pink    ’,gray
   end program demo_rgbmono
Results:

    red        30.0000019
    green      58.9999962
    blue       11.0000000
    Yellow     89.0000000
    Cyan       70.0000000
    Magenta    41.0000000
    White      100.000000
    Black      0.00000000
    Maroon     15.0000010
    Pink       65.0000000

AUTHOR

John S. Urban

LICENSE

Public Domain


rgbmono (3) August 24, 2020
Generated by manServer 1.08 from 51293e5b-2f23-4332-bfd8-fddc36ee7a99 using man macros.