Calculates imgae size in KB and MB. Required for print_info
method.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(format_pnm), | intent(in) | :: | this | |||
real(kind=rk), | intent(out) | :: | pixel_size_kb | |||
real(kind=rk), | intent(out) | :: | pixel_size_mb |
elemental pure subroutine pixel_size(this, pixel_size_kb, pixel_size_mb) class(format_pnm), intent(in) :: this real(rk), intent(out) :: pixel_size_kb, pixel_size_mb integer :: bits_per_channel, bytes_per_pixel bits_per_channel = 8 select case (this%file_format) case ('pbm', 'pgm') bytes_per_pixel = bits_per_channel case ('ppm') bytes_per_pixel = bits_per_channel*3 end select pixel_size_kb = real(this%width*this%height * bytes_per_pixel, kind=rk) / 1024.0_rk pixel_size_mb = pixel_size_kb / 1024.0_rk end subroutine pixel_size