MHA to PNG Converter for MetaImage Slices | MiConvert

MHA to PNG Converter

Pick any slice of a MetaImage (.mha) volume and save it as a lossless 8-bit grayscale PNG, with contrast set automatically or by hand. The file must be uncompressed and keep its voxel data inside it (ElementDataFile = LOCAL).

🔒 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
MHA → PNG

What happens when an MHA becomes a PNG

MHA is the single-file form of MetaImage, the native format of the ITK toolkit. It has a short plain-text header listing dimensions, element type and voxel spacing, followed directly by the raw voxel values. 3D Slicer, ITK-SNAP and ITK-based scripts read it without trouble, but image editors, browsers and document tools do not. One file also usually contains a whole stack of slices rather than a single picture.

MiConvert reads the header and voxels with a MetaImage parser that runs in your browser, so the volume is not uploaded to our servers. The viewer opens on the middle slice and sets contrast from the 1st to 99th percentile of that slice's values. This keeps a few very bright or very dark voxels from flattening the image. A slice slider and window/level sliders let you change both, and the PNG records the slice exactly as displayed.

PNG compression is lossless, so the exported picture has no compression artifacts and keeps the slice's native width and height in pixels. The original intensities do not survive: 16-bit integer or floating-point voxels are squeezed into 256 gray levels by the window you chose. Only the visible slice is written. ElementSpacing, orientation and every other header field are dropped, so you cannot measure distances from the PNG. Slices with unequal pixel spacing will look stretched. The background is opaque; there is no transparency.

Typical uses are a figure for a paper draft, a lab meeting, a README or a bug report, or a quick look at what is inside an .mha a colleague sent, without installing anything. If you need every slice or the full-depth intensities, export from ITK or 3D Slicer instead. This tool is for quick single-slice pictures.

Converting an MHA file to PNG, step by step

  1. Open the .mha in a text editor and read the first lines. ElementDataFile should say LOCAL, and CompressedData should be False or missing. If it is True, re-save the volume uncompressed in the program that wrote it.
  2. If you have an .mhd header plus a .raw or .zraw file, combine them first. Save the volume as a single .mha or as .nrrd in 3D Slicer or with ITK, because only one file can be uploaded.
  3. Drop the file, up to 200 MB, onto the converter and wait for the middle slice to appear in the preview.
  4. Move the slice slider to the position you want, then adjust window and level until the structure of interest stands out.
  5. Select PNG, convert, and save the download. For another slice, move the slider and export again.

MHA to PNG capabilities

  • Reads single-file MetaImage volumes with local data and standard MET_ element types, including 16-bit integer and floating-point voxels
  • Starts on the middle slice and lets you step through the stack with a slider
  • Automatic percentile-based contrast, with a manual window and level override
  • Lossless 8-bit grayscale PNG at the slice's native pixel dimensions
  • Single-file input only: an .mhd that points to a separate .raw is rejected with 'Invalid MHA file: could not find data section'
  • JPG and one-page PDF output from the same tool

Video Tutorial

Are you struggling with how to convert your MHA file to PNG format? Don't worry, in this video I will reveal a super convenient tool to help you change your file extension completely for free without

MHA to PNG FAQ

Is this for My Hero Academia PNGs with a transparent background?

No. On this page MHA means MetaImage, a medical and scientific image format used with ITK, not the anime. The PNG it produces is a fully opaque grayscale image of one scan slice, so it has no transparent background either.

Can I export every slice of the volume as PNG at once?

No. Each export writes only the slice currently on screen, and the tool loads one file at a time, so a full stack means exporting slice by slice. For dozens or hundreds of slices, a short SimpleITK script or the Screen Capture module in 3D Slicer will be much faster.

Why do I get 'Invalid MHA file: could not find data section'?

This appears when the header does not contain the voxel data itself. Most often the file is an .mhd whose ElementDataFile line names a separate .raw or .zraw file, and that file cannot be uploaded alongside it. Open the pair in 3D Slicer or ITK and save the volume as a single .mha or as .nrrd, then convert that file. A truncated or malformed MHA produces the same message.

The PNG looks like static or stripes. What went wrong?

Two kinds of MHA are read incorrectly today. Files with CompressedData = True are not decompressed. Files with ElementByteOrderMSB = True (big-endian) are read in the wrong byte order. Re-save the volume uncompressed and with ElementByteOrderMSB = False, then try again.

What does 'MHA file has invalid dimensions' mean?

The header's size information could not be read as valid dimensions. Check the NDims and DimSize lines in a text editor, or re-save the file from the software that created it.

Does the PNG keep the original values, spacing or orientation?

No. It stores 8-bit display values produced by your window and level settings, not the original voxel intensities, and none of the header travels with it. Keep the .mha for analysis and use the PNG only as a picture. It is not suitable for diagnosis or quantitative work.

Does my MHA file get uploaded?

No. The volume is parsed and rendered in your browser and the PNG is generated there, so MiConvert never receives the voxel data and has nothing to retain or delete. The page does fetch its libraries from cdn.jsdelivr.net, which sees your IP address. When Google Analytics is loaded, it records the file's name, size and detected format. Choosing a file over 200 MB reports those same details to our server. Avoid file names that contain personal information.