This function loads an image from file and convert it to a numpy array.
Examples
p <- ggplot2::ggplot(cars) + ggplot2::geom_point(ggplot2::aes(dist, speed))
path <- save_plot(p)
result <- try(KERAS_WRAPPER$image_to_array(path, 32L, 32L))
if (!inherits(result, "try-error")) {
result
}
#> array([[[[255., 255., 255.],
#> [255., 255., 255.],
#> [255., 255., 255.],
#> ...,
#> [255., 255., 255.],
#> [255., 255., 255.],
#> [255., 255., 255.]],
#>
#> [[255., 255., 255.],
#> [255., 255., 255.],
#> [255., 255., 255.],
#> ...,
#> [250., 250., 250.],
#> [255., 255., 255.],
#> [255., 255., 255.]],
#>
#> [[255., 255., 255.],
#> [255., 255., 255.],
#> [255., 255., 255.],
#> ...,
#> [200., 200., 200.],
#> [252., 252., 252.],
#> [255., 255., 255.]],
#>
#> ...,
#>
#> [[255., 255., 255.],
#> [255., 255., 255.],
#> [255., 255., 255.],
#> ...,
#> [255., 255., 255.],
#> [255., 255., 255.],
#> [255., 255., 255.]],
#>
#> [[255., 255., 255.],
#> [255., 255., 255.],
#> [255., 255., 255.],
#> ...,
#> [255., 255., 255.],
#> [255., 255., 255.],
#> [255., 255., 255.]],
#>
#> [[255., 255., 255.],
#> [255., 255., 255.],
#> [255., 255., 255.],
#> ...,
#> [255., 255., 255.],
#> [255., 255., 255.],
#> [255., 255., 255.]]]])