RunMat
  • Pricing
RunMat
GitHub
GitHub
DownloadSign InTry in Browser
DesktopRuntimeServer
RunMat

Run math blazing fast

GitHubX (Twitter)LinkedIn

Company

  • About
  • Pricing
  • Contact

Explore

  • RunMat for academia
  • RunMat vs MATLAB Online
  • Benchmarks

Get product updates and release notes from the RunMat team.

© 2026 Dystr · Made withfor the scientific community.

RunMat™ is a registered trademark of Dystr, Inc. MATLAB® is a registered trademark of The MathWorks, Inc. RunMat is not affiliated with, endorsed by, or sponsored by The MathWorks, Inc.

LicensePrivacy
/
See all docs
Builtin Reference
    • gray2rgb
    • hsv2rgb
    • im2double
    • im2uint16
    • im2uint8
    • ind2rgb
    • lab2rgb
    • rgb2gray
    • rgb2hsv
    • rgb2lab

im2uint8 — Convert images to uint8 in MATLAB and RunMat.

im2uint8(I) converts image data to uint8 using MATLAB image-scaling rules. Floating data in [0, 1] maps to [0, 255].

Syntax

J = im2uint8(I)
J = im2uint8(I, "indexed")

Inputs

NameTypeRequiredDefaultDescription
IAnyYes—Image data to convert.
IAnyYes—Indexed image data to convert.
indexedStringScalarYes—The literal "indexed", selecting indexed-image offset semantics.

Returns

NameTypeDescription
JNumericArrayConverted image data in uint8 class.

Errors

IdentifierWhenMessage
RunMat:im2uint8:TooManyInputsMore than two input arguments are supplied.im2uint8: too many input arguments
RunMat:im2uint8:InvalidInputInput cannot be gathered or interpreted for image conversion.im2uint8: invalid input
RunMat:im2uint8:UnsupportedInputTypeInput type is outside supported numeric/logical image classes.im2uint8: unsupported input type
RunMat:im2uint8:InternalInternal conversion step fails while building output tensor.im2uint8: internal conversion failure

How im2uint8 works

  • Floating-point inputs are clamped to [0,1], multiplied by 255, and rounded.
  • uint16 inputs are rescaled from [0,65535] to [0,255].

Example

Convert Double Image

J = im2uint8(I);

Expected output:

% J is uint8 image data

Using im2uint8 with coding agents

Open a RunMat example with live inputs, then ask the agent to explain how im2uint8 changes the result.

Run a small im2uint8 example, explain the result, then change one input and compare the output.

Related Image functions

Color

gray2rgb · hsv2rgb · im2double · im2uint16 · ind2rgb · lab2rgb · rgb2gray · rgb2hsv · rgb2lab

Filters

filter2 · fspecial · imfilter

Image

imfinfo · imhist

Io

imread · imwrite

Open-source implementation

Unlike proprietary runtimes, every RunMat function is open-source. Read exactly how im2uint8 is executed, line by line, in Rust.

  • View the source for im2uint8 in Rust on GitHub
  • Learn how the RunMat runtime works
  • Found a bug? Open an issue with a minimal reproduction.

About RunMat

RunMat is an open-source runtime that executes MATLAB-syntax code blazing on any GPU. It is licensed under the Apache 2.0 license.

  • RunMat automatically optimizes your math for GPU execution on Apple, Nvidia, and AMD hardware. No code changes needed. Simulations that took hours now take minutes.
  • Start running code in seconds. RunMat runs in the browser, on the desktop, or from the CLI. No license server, no IT ticket.

Getting started · Benchmarks · Pricing

Download RunMat

Download RunMat for full performance, or use RunMat in your browser for zero setup.

Download RunMatOpen Sandbox
On this page
  • Syntax
  • Inputs
  • Returns
  • Errors
  • How im2uint8 works
  • Example
  • Convert Double Image
  • Using im2uint8 with coding agents
  • Related Image functions
  • Color
  • Filters
  • Image
  • Io
  • Open-source implementation
  • About RunMat