Skip to content

Sryml/mmp_convert

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BoD - mmp files convert(Python program)  中文文档


July 2019 by Sryml

Why write this program?

There are 3 mmp programs on the current network:

  • RAS's BaB
    It seems that it can't package 32bpp images, and it can only be packaged and cannot be unpacked.

  • mmp_dump
    The command line starts, it can only unpack and can not be packaged, can not unpack 32bpp images.

  • SGIMMPWorkstation
    By SGI. All features are perfect.
    packing/unpacking/deleting/adding/generating dat... support 8/24/32bpp, is a very convenient software.
    The only drawback is batch processing.


I hope there is something that can be handled in a more convenient way, so mmp_convert was born.:sunglasses:

  • mmp_convert.py
    packing/unpacking/deleting/adding/generating dat/convert bpp/convert format... support 8/24/32bpp, batch automation and multi-process.
    The most important thing: the python environment

Instructions

  1. You need a Python environment (I use python 3.7)
  2. Check if you have pip installed
    Enter pip --version in cmd
  3. Install third-party library PIL
    Enter pip install Pillow in cmd
  4. Drag the file or folder you want to process to the .bat file

P.s. Adjust the variable CPU_COUNT in the mmp_convert.py file to reduce cpu usage.

Functional description

Supported formats

  • bmp, jpeg, png, webp

unpacking

  • Unpacking MMP
  • 1 required parameter
    --path: File or folder paths.
  • 1 optional parameter
    --bpp: 8/24/32, default bpp from the original mmp.

mmp-unpacking


packing

  • Pack/add images to MMP
  • 1 required parameter
    --path: File or folder paths.
  • 2 optional parameter
    --bpp: 8/24/32, default bpp from the original image.
    -y: overwrite, no -y does not overwrite.

mmp-packing


tobpp

  • Convert MMP to other bpp
  • 1 required parameter
    --path: File or folder paths.
  • 3 optional parameter
    --bpp: 8/24/32, default 8.
    -max: resolution(Allow the largest edge, ignoring the image below the maximum).
    -y: overwrite, no -y does not overwrite.

32bpp-1024 To 8bpp-768:
mmp-tobpp


todat

  • Generate a list of names to dat
  • 1 required parameter
    --path: File or folder paths.

MMP To Dat:
mmp-todat


remove

  • Delete images in mmp file
  • 1 required parameter
    --path: File path.
  • Enter multiple numbers separated by spaces to delete images.

MMP Remove:
mmp-remove


toImg

  • Image format convert
  • 2 required parameter
    --path: File or folder paths.
    --output: Output format.
  • 5 optional parameter
    --bpp: 8/24/32/Alpha, default bpp from the original image.
    -max: resolution(Allow the largest edge, ignoring the image below the maximum).
    --scale: Zoom factor, such as 4x or 0.25x.
    --quality: JPG image quality, default is 95.
    -y: overwrite, no -y does not overwrite.

BMP To PNG:
mmp-toImg


StdUnify

  • Files Unification
    Uniform name/Uniform format/File remapping
  • 1 required parameter
    --path: File or folder paths.
  • 2 optional parameter
    --format: File format
    -kl: Extract the file in the specified format and maintain the directory hierarchy; otherwise give the file a unique ID and move to the same directory

Uniform name:
ReStdUnify

File remapping:
ReStdUnify

Uniform format:
None


swapBGR

  • Image channel conversion (RGB and BGR)
  • 1 required parameter
    --path: File or folder paths.
  • 1 optional parameter
    --quality: JPG image quality, default is 95.

Update log

v1.12

[+]Added functionswapBGR - Image channel conversion.
[^]``toImg increases the image quality optional parameter quality (applies to JPG format).


v1.1

[+]Added function StdUnify - Files Unification(Uniform name or uniform format).
[+]Increase the toImg function's parameter --scale, scale the image proportionally.
[^]Fix tobpp MMP files of the same bpp cannot convert resolution.


v1.0

[+]Added function remove - Delete images in mmp file.
[+]Added function toImg - Image format convert.
[+]Added font color, green progress bar.

[^]Fixing images with Alpha directly converted to 8bpp causes distortion (first converted to 24bpp and then to 8bpp).
[^]Improve pre-parsed files.
[^]Other code modifications.


v0.9

  • The mmp_convert program provides four functions
    unpacking, packing, tobpp, todat
  • Support multi-process to quickly process files.

Known issues

  • If the error Command line is too long, it is because there are too many files selected. Put these files in a folder and drag the folder to handle it. The result of this is that only one parameter folder path is passed.