Removes one or more RGB channels from the image. Only supported for PPM images.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(format_pnm), | intent(inout) | :: | this | |||
logical, | intent(in), | optional | :: | remove_r | ||
logical, | intent(in), | optional | :: | remove_g | ||
logical, | intent(in), | optional | :: | remove_b |
elemental pure subroutine remove_channels(this, remove_r, remove_g, remove_b) class(format_pnm), intent(inout) :: this logical, optional, intent(in) :: remove_r, remove_g, remove_b ! Check if the file is ppm if (this%file_format /= 'ppm') error stop 'remove_channels: This function is only for ppm files.' ! Remove R channel if (present(remove_r)) then if (remove_r) then this%pixels(:,1:size(this%pixels,2):3) = 0_ik end if end if ! Remove G channel if (present(remove_g)) then if (remove_g) then this%pixels(:,2:size(this%pixels,2):3) = 0_ik end if end if ! Remove B channel if (present(remove_b)) then if (remove_b) then this%pixels(:,3:size(this%pixels,2):3) = 0_ik end if end if call this%check_pixel_range(this%pixels) end subroutine remove_channels