Study a game in a community, which uses MNG files.
MNG is used to kill the GIF format, but it is not popular yet, but the expressiveness is indeed good. Xnview can be opened directly, but the support is not perfect yet. Few software can edit MNG, and many files can only be output in MNG format. The image repair function is edited using png mng construction set. After the image is imported, the game crashes. I guess it must have been something in it that was lost after being edited.
I found this software and wanted to see what I had lost, so I had no idea how to edit it. --B. Looking for software, I hope it is gimp, but I do not know why, file-mng.exe always reports an error. It is said that there is no problem with the Linux version. Finally, I gave up. I honestly studied the formats of MNG and PNG. However, this research has a strong purpose, so I only analyzed the chunk type and Chunk combination in the game, which is not complete. Okay, let's talk about it.
You can go to libpng.org to find information about these files, and download the libmng source code.
First, both MNG and PNG are 8-byte signatures, followed by a string of chunks. The chunk format is generic. 4-byte data size, 4-byte chunk name, the chunk data is followed by the 4-byte CRC. It should be noted that the data size is in the top position and should be exchanged during use.
For the simplest PNG, there are three chunks after the signature. ihdr, idat * n, iend, and I are the meaning of image. Ihdr defines things such as width, height, and color. Idat is the data, but I have observed that after editing with PS, if you do not select "cross-save", there will be no multiple idat blocks, but one block will be closed. The structure of multiple idat blocks is designed from fuzzy to clear when images are displayed on the network.
If a palette is used, a plte Chunk is generated. It doesn't make much sense to me. You just need to add it before idat.
Let's take a look at MNG. The first is a mhdr, and the end is mend. Many Attributes in mhdr are not described in detail. Then there is usually a fram, because MNG is an animation, so there is a frame concept. One of the fram attributes is name. I suspect that the game uses this name for locating. Of course, a MNG may not have fram, so it is a static image.
FRAM has some trouble in attributes, mainly because it is omitted. You can just take a closer look at this document.
After fram, there are several optional chunks, such as defi and Defi, which are used to define an object. Here, you can specify the left and top attributes of the image. Generally, the first image is the background and there is no defi, defi will be available for subsequent images.
Whether there is defi or not, the most important part is ihdr/idat/iend. This is an image. After ihdr, there are also some Optional options, besides the plte mentioned earlier, there are also text, the function of text is very simple: Put a keyword, A/0 and a value. The key word mainly involves the title. I guess the game also looks for the image based on this, and the chunk thrown away is probably like this.
A fram can contain multiple graphs, that is, multiple ihdr/idat/iend groups.
To split MNG, find ihdr/idat/iend and add a PNG signature to the file. For MNG, the chunks other than ihdr/idat/iend/plte use the original MNG, and the four are PNG.