im2uint16 — Convert image data to uint16 using image scaling rules.
im2uint16(I) converts floating image values in [0,1] to uint16 [0,65535] and expands uint8 image data by 257.
How im2uint16 works
- Floating-point inputs are clamped to [0,1], multiplied by 65535, and rounded.
- uint8 inputs are expanded into the uint16 image range.
Example
Convert To uint16
J = im2uint16(I);Expected output:
% J is uint16 image dataRelated Image functions
Open-source implementation
Unlike proprietary runtimes, every RunMat function is open-source. Read exactly how im2uint16 works, line by line, in Rust.
- View im2uint16.rs on GitHub
- Learn how the 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 — 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.