RunMat
GitHub

im2double — Convert image data to double precision, scaling integer images into [0,1].

im2double(I) returns double image data. uint8 images are divided by 255 and uint16 images by 65535.

How im2double works

  • uint8 and uint16 tensors are scaled into [0,1].
  • Floating-point tensors keep their numeric values and become double host tensors.
  • Logical images convert to 0 and 1.

Example

Convert Read Image

I = im2double(imread("photo.png"));

Expected output:

% I is double image data in [0,1] for integer inputs

Open-source implementation

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

About RunMat

RunMat is an open-source runtime that executes MATLAB-syntax code — faster, on any GPU, with no license required.

  • Simulations that took hours now take minutes. RunMat automatically optimizes your math for GPU execution on Apple, Nvidia, and AMD hardware. No code changes needed.
  • Start running code in seconds. Open the browser sandbox or download a single binary. No license server, no IT ticket, no setup.
  • A full development environment. GPU-accelerated 2D and 3D plotting, automatic versioning on every save, and a browser IDE you can share with a link.

Getting started · Benchmarks · Pricing

Try RunMat for free

Open the sandbox and start running MATLAB code in seconds. No account required.