MHA to JPG Converter for MetaImage Slices
Open a single-file MetaImage .mha, scroll to the slice you want, set the contrast and download it as a grayscale JPG. Compressed MHA files (CompressedData = True) are not decoded, so re-save those without compression first.
Drop your file here
DICOM (.dcm, single files or a whole series), NIfTI (.nii, .nii.gz), NRRD (.nrrd), MHA (.mha), MHD (.mhd + .raw)
Up to 1 GB per file • Processed locally
What an MHA file is and what this converter does with it
An .mha file is the single-file version of MetaImage, the format ITK uses natively and that 3D Slicer, ITK-SNAP and many research pipelines read and write. It starts with a short plain-text header, with lines such as NDims, DimSize, ElementType and ElementSpacing. The voxel data follows directly after a line reading ElementDataFile = LOCAL. Because the file holds a whole 3D stack, often stored as 16-bit integers or floating point, photo viewers, slide software and email previews have nothing they can display.
This page reads the file with JavaScript inside the browser tab, and the voxel data is not uploaded to MiConvert. The parser takes the dimensions from the header, opens the volume on its middle slice and gives you a slider to move through the rest. Contrast is set automatically from the 1st to 99th percentile of the slice's values. Window and level sliders let you override it before export. The slice you are looking at is then saved as a JPEG at quality 0.92.
Two things carry over: the slice's pixel grid at its native size, and the contrast exactly as it appears on screen. Several things do not. You lose every other slice, the header (spacing, origin, orientation) and the original bit depth, because values are mapped to 8-bit grayscale through the current window. Voxels are written one-to-one, so a slice with non-square spacing is not resized to its true proportions. JPEG compression also softens sharp edges slightly. That matters for label maps and segmentation masks, and the PNG option on the same screen avoids it.
People who search for how to convert an mha file to jpg usually want a picture, not a dataset. Common uses are a figure for a slide deck or poster, a snapshot for a lab report, a quick check of which scan a file contains, or an image a collaborator without imaging software can open. The result is a display rendering for communication, not for diagnosis or measurement.
How to turn an MHA slice into a JPG
- Check the header first. Open the .mha in a plain-text editor and confirm that it says ElementDataFile = LOCAL and does not say CompressedData = True. If the file is compressed, re-save it without compression in 3D Slicer or ITK, or export it as .nrrd instead.
- Click to choose the file. One volume is read at a time, up to 200 MB.
- Drag the slice slider from the middle position to the slice you need. The preview updates as you move.
- If structures look washed out or too dark, adjust window and level until the region you care about is readable.
- Pick JPG as the output and download. For more slices, move the slider and export again. Each download contains one slice.
What the MHA to JPG tool gives you
- Slice navigation through the volume. It opens on the middle slice, and a slider moves to any other slice.
- Automatic percentile-based contrast, plus manual sliders for level (-2000 to 4000) and width (1 to 8000).
- Output at the slice's native resolution, one JPG pixel per voxel, encoded at quality 0.92.
- PNG and single-page PDF are offered from the same screen, for lossless 8-bit pixels or a printable page.
- The file is parsed inside the tab. The same 200 MB limit applies whether or not you have an account.
- Plain error messages for headers the tool cannot use, such as a missing data section or invalid dimensions.
Video Tutorial
Changing a MHA file to JPG has never been easier! Watch this detailed guide on how to do it completely free right in your web browser. 🔗 Visit MiConvert: https://miconvert.com/en/mha-to-jpg?utm_sour
MHA to JPG questions
Is this the right page for my MHA file?
It is if your file is a MetaImage medical or scientific volume. Open it in a text editor and the first lines will read something like ObjectType = Image and NDims = 3. Searches for MHA often mean My Hero Academia, or battery capacity in mAh. Neither one is a file this tool can convert.
What does "Invalid MHA file: could not find data section" mean?
The tool found no voxel data after the header. Either the header names a separate .raw file instead of ElementDataFile = LOCAL, or the file is malformed. Load the original in 3D Slicer or an ITK script and save it again, either as a single .mha with ElementDataFile = LOCAL or as .nrrd. Then try again.
Why does it say "MHA file has invalid dimensions"?
The NDims or DimSize lines in the header are missing or do not make sense, for example a size of zero. Re-export the volume from the program that created it and try again.
The preview looks like static or stripes. What went wrong?
Two header settings are not handled. With CompressedData = True, the data is not decompressed. With ElementByteOrderMSB = True, big-endian data is read in the wrong byte order. Re-save the volume uncompressed with ElementByteOrderMSB = False, then upload the new file. Color (RGB) volumes are not supported either, because only grayscale is rendered.
Can I export all slices, or several MHA files, in one go?
No. The tool handles one file and exports only the slice on screen. For a handful of slices, move the slider and download each one. For a full stack of JPGs, 3D Slicer or a short SimpleITK or ITK script is the practical route.
Will the JPG keep Hounsfield units or 16-bit detail?
No. Values are mapped to 8-bit grayscale through the current window, so the JPG shows contrast, not measurements. It is not suitable for diagnostic reading. Keep the .mha for analysis and use the JPG for display.
Why won't the tool start, or why does it say the converter engine is not loaded?
The reading libraries are fetched from cdn.jsdelivr.net each time the page opens, so the tool does not work offline. If a blocker or firewall stops that domain, you will see "Medical converter engine not loaded. Please refresh the page." Allow cdn.jsdelivr.net and reload.
Is my scan uploaded or stored?
The voxel data is read inside your browser and is not sent to MiConvert, so no server copy exists. Some details do leave the page. When Google Analytics is active, it records the file name, size and format. jsDelivr sees your IP address when the libraries load. A file over 200 MB has its name, size and format reported to our server. The tool does not anonymize anything. The JPG carries no header fields, but any text burned into the pixels stays visible.