RGBMONO(3f) - [M_color] converts RGB colors to a reasonable grayscale intensity (LICENSE:PD)
Synopsis
Description
Options
Returns
Examples
Author
License
subroutine rgbmono(rr,rg,rb,ri,status)
real, intent(in) :: RR real, intent(in) :: RG real, intent(in) :: RB real, intent(out) :: RI integer :: status
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.
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
RI grayscale intensity calculated in the range 0 to 100 status zero (0) if no error occurred, otherwise result is out of bounds
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_rgbmonoResults:
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
John S. Urban
Public Domain
Nemo Release 3.1 | rgbmono (3m_color) | November 11, 2023 |