MHD to PNG Converter: Slices via MHA or NRRD | MiConvert

MHD to PNG Converter

MetaImage volumes saved as .mhd plus .raw can't be read here, because only one file can be selected per conversion, so that direct route fails today. Resave the volume as a single .mha or .nrrd file and you can export any slice as a lossless 8-bit grayscale PNG.

🔒 Zero-Upload — Your files never leave your device
🏥

Drop your file here

DICOM (.dcm, single files or a whole series), NIfTI (.nii, .nii.gz), NRRD (.nrrd), MHA (.mha), MHD (.mhd + .raw)

Select File

Up to 1 GB per file • Processed locally

Zero Upload 100% Browser Processing No Sign Up 100% Free
MHD → PNG

MHD, MHA and what a PNG can hold

Researchers run into .mhd files in ITK and SimpleITK scripts, registration tools and shared CT collections. The format splits a scan in two: a plain-text header listing size, spacing, origin and element type, and a binary file holding the actual numbers. That split makes the data easy to script against, but you can't double-click it into a picture, and any web tool needs both parts before it can show anything.

That last requirement is where this page falls short today. Our medical converter works on one selected file inside the browser, so a header that refers to an external .raw arrives without its data, and you get the error "Invalid MHA file: could not find data section" instead of an image. A header that says ElementDataFile = LOCAL has the data embedded, and such a file can be read.

Once the volume is a single .mha with uncompressed data, or a .nrrd in raw or gzip encoding, the tool parses it with its own MetaImage and NRRD readers, displays the middle slice and lets you move to any other. Each slice is mapped onto 256 gray levels through a window that starts automatic and can be changed by slider, then written to PNG with no lossy compression.

PNG keeps every pixel of that 8-bit slice exactly, so crisp boundaries survive in figures for papers, posters or theses. This tool's export cannot keep 16-bit or floating-point values, spacing or orientation. Segmentation label maps lose their label numbers, because values are stretched across the gray range. If you are building a training dataset or need exact 16-bit slices, export them with a script instead.

Steps for a PNG slice from MetaImage data

  1. Open the .mhd in a text editor and read the ElementDataFile line. If it names a .raw or .zraw file, you need to repack. If it says LOCAL, also check that CompressedData is not True and ElementByteOrderMSB is not True. If both are fine, skip to step 3. Otherwise repack as in step 2.
  2. Repack with software that reads the pair, such as SimpleITK, ITK or 3D Slicer, and write either an uncompressed .mha or a .nrrd. While the header is open, also check ElementByteOrderMSB. If it says True, the data is big-endian and needs converting as well.
  3. Drop the single file onto the tool. Files up to 200 MB are accepted, one per conversion.
  4. Move the slice slider to the image you want, and fine-tune window and level so the structures of interest separate clearly.
  5. Pick PNG as the target and save the download. For other slices, shift the slider and export again.

PNG export details

  • Lossless PNG of the displayed slice at the volume's native in-plane pixel size
  • Begins on the central slice, with a slider covering every other slice in the volume
  • Auto contrast based on the 1st and 99th percentiles, with manual width and level control on top
  • Built-in readers for single-file MetaImage and for NRRD in raw or gzip encoding, the practical substitutes for a split .mhd
  • The current slice can also be exported as JPG or as a one-page A4 PDF
  • Runs in the browser, so voxel data is not transferred to MiConvert

Video Tutorial

An A-Z video guide on how to use MiConvert to change MHD format to PNG. This is the safest method to convert data without needing to download any applications to your device. 🔗 Format conversion too

MHD to PNG questions

Why can't I just upload my .mhd file?

In nearly every case the .mhd holds only the header, and the image data sits in another file that the tool never receives, because only one file can be selected. The tool then reports that it could not find the data section. Merging the pair into a .mha or .nrrd fixes this.

How do I repack MHD and RAW into one file without coding?

Install 3D Slicer, which is free, and drag the .mhd into it with the .raw in the same folder. Open the save dialog and set the volume's file format to .nrrd, or to .mha with the Compress box unticked. Upload the file Slicer writes.

I searched for MHD and got tuning and license results. Is this related?

It isn't. Those results concern MHD, the car-tuning product. This converter handles .mhd as in MetaImage, the ITK medical image format, and has nothing to do with tuning maps or licenses.

Can I get a 16-bit PNG or keep the exact voxel values?

Not here. Every export is 8-bit grayscale after windowing. If you need the original values, extract the slice with SimpleITK and write it to PNG from there. SimpleITK can save 16-bit grayscale PNGs directly. Signed data such as CT in Hounsfield units, or floating-point data, needs an offset or rescale first, because a plain cast to unsigned 16-bit clips or rounds those values.

Can I convert every slice of the volume to PNG in one go?

No. The tool exports only the slice on screen and has no batch option. A SimpleITK loop that pulls out each slice, rescales it and writes a numbered PNG will process a whole volume in one run.

Why does my PNG show stripes or random noise?

Two common causes. A .mha saved with CompressedData = True is read as if it were uncompressed, and big-endian data, in MetaImage or NRRD, is read in the wrong byte order. Resave the volume as an uncompressed little-endian .mha, or as a little-endian NRRD with raw or gzip encoding, which is decoded properly.

Does the converter support color MetaImage files?

No. Rendering is grayscale only, so RGB volumes won't display correctly. Convert a single channel or a luminance version to a scalar volume before loading it.

Where is my file processed, and what gets shared?

Your volume is processed on your own computer, and its voxel data is never sent to our servers. There is no stored copy for us to delete. The page does fetch its code libraries from the jsDelivr CDN, which sees your IP address. When Google Analytics is running, it receives the file's name, size and format. If a file is turned away for being over 200 MB, those same details are reported to us.