preprocess_image

Preprocess image for Stable Diffusion

Description

Preprocess image for Stable Diffusion

Usage

preprocess_image(input, device = "cpu", width = 512, height = 512)

Arguments

  • input: File path to .jpg or .png, or a 3D array
  • device: Target device for torch (“cpu” or “cuda”)
  • width: Desired width of the output image
  • height: Desired height of the output image

Value

Torch tensor of shape c(1, 3, 512, 512), scaled to c(-1, 1)