A lightweight and easy-to-use Python tool to convert .mat (MATLAB) files into .jpg image files. Useful for data preprocessing, machine learning pipelines, or visualization purposes.
- Converts 2D
.matarrays into.jpgimages - Batch processing support
- Custom output directory
- Normalizes pixel values (0β255)
- CLI-based usage for ease of automation
Input .mat file:
Output .jpg image:
Grayscale image where pixel values are scaled based on the matrix.
- Python 3.7+
scipynumpyPillow
git clone https://github.com/fazeelibtesam/Extractor.git
cd Extractor
pip install -r requirements.txtpython mat_to_jpg.py --input_dir ./mat_files --output_dir ./jpg_outputmat-to-jpg-converter/
β
βββ examples/ # Sample .mat files and output images
βββ README.md # Documentation
βββ mat_to_jpg.py # Main script
βββ requirements.txt # Dependencies
- Make sure the
.matfiles contain 2D arrays for image conversion. - Use
--keyif the variable name inside the.matfile is not obvious.
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
This project is licensed under the Apache 2.0 License - see the LICENSE file for details.
Feel free to fork, star β, and follow for updates!