Skip to contents

Read an image as specified in ALGORITHMS.md

Usage

ri_read(path)

Arguments

path

Path to a PNG, TIFF or JPEG file.

Value

A list with rgb (an H x W x 3 array on a 0-255 scale), width, height, format and bit_depth. 16-bit samples are scaled by 1/257.

Examples

img <- ri_read(file.path(ri_example_dir(), "cells_a_16bit.tif"))
img[c("width", "height", "format", "bit_depth")]
#> $width
#> [1] 128
#> 
#> $height
#> [1] 128
#> 
#> $format
#> [1] "TIFF"
#> 
#> $bit_depth
#> [1] 16
#> 
range(img$rgb)
#> [1]   1 255