image_load

0th

Percentile

Loads an image into PIL format.

Loads an image into PIL format.

Usage
image_load(
  path,
  grayscale = FALSE,
  target_size = NULL,
  interpolation = "nearest"
)
Arguments
path

Path to image file

grayscale

Boolean, whether to load the image as grayscale.

target_size

Either NULL (default to original size) or integer vector (img_height, img_width).

interpolation

Interpolation method used to resample the image if the target size is different from that of the loaded image. Supported methods are "nearest", "bilinear", and "bicubic". If PIL version 1.1.3 or newer is installed, "lanczos" is also supported. If PIL version 3.4.0 or newer is installed, "box" and "hamming" are also supported. By default, "nearest" is used.

Value

A PIL Image instance.

See Also

Other image preprocessing: fit_image_data_generator(), flow_images_from_dataframe(), flow_images_from_data(), flow_images_from_directory(), image_to_array()

Aliases
  • image_load
Documentation reproduced from package keras, version 2.3.0.0, License: MIT + file LICENSE

Community examples

stevedevney@me.com at Feb 17, 2019 keras v2.2.4

img = image_load(path='test1.jpg', target_size = c(249,249)) #Primary function img = image_to_array(img) img = img/255 #Rescale to range(0,1) img = array(c(1,img),dim=c(1, 249,249,3) predict(model,img) #Note use your own model for the predict function.