---
title: "loadImage"
sidebar_label: "loadImage"
description: "Kotlin binding reference: loadImage."
---

<!-- Generated by tools/api_reference/generate_api_docs.py. Do not edit. -->

//[clika-runtime](../../../index.md)/[io.clika.runtime](../index.md)/[Io](index.md)/[loadImage](loadImage.md)

# loadImage

[common]\
fun [loadImage](loadImage.md)(path: [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html), channels: [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) = 0): [Tensor](../Tensor/index.md)

Decode an image file to a host `[H, W, C]` UInt8 tensor. [channels](loadImage.md) of 0 keeps the file's own channel count; 1, 3 or 4 forces gray, RGB or RGBA. An EXIF orientation tag is applied, so the tensor is the image as displayed. Move it to a device with [Tensor.to](../Tensor/to.md).

[common]\
fun [loadImage](loadImage.md)(bytes: [ByteArray](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html), channels: [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) = 0): [Tensor](../Tensor/index.md)

Decode an encoded image payload in memory; the same contract as the file form.