Page 1 of 1

PNGs => MNG Good, MNG => PNGs Fails

Posted: 2012-11-08T01:53:18-07:00
by philip_rhoades
People,

I have been happily using a script for some time now that converts scanned, single PNGs into an MNG file and viewing this with either "display" or "mplayer" but now I need to be able to convert some MNGs back into their individual PNG files but this:

convert test.mng t_%d.png

only produces one PNG file (the MNG was constructed with 3 PNGs using convert). Trying an equivalent conversion to multi-page TIFF and splitting that works fine so it looks like it is just a MNG split problem.

Anyone got any solutions? I found a couple of other MNG splitting tools but they fail with error messages or just don't produce any output at all.

Thanks,

Phil.

Re: PNGs => MNG Good, MNG => PNGs Fails

Posted: 2012-11-08T02:33:51-07:00
by philip_rhoades
People,

To qualify my own question - this problem only occurs on MNG files that were created WITHOUT the "delay" switch switch eg:

convert *png t.mng

instead of:

convert -delay 100 *png t.mng

Thanks,

Phil.

Re: PNGs => MNG Good, MNG => PNGs Fails

Posted: 2012-11-08T07:01:56-07:00
by glennrp
Thanks for your clarification. Indeed, decoding a MNG with no delay between layers into a single frame is the proper behavior according to the MNG spec.

Re: PNGs => MNG Good, MNG => PNGs Fails

Posted: 2012-11-08T08:20:26-07:00
by philip_rhoades
glennrp,

I was wondering if that was the case . . so is there any way of extracting the individual PNGs somehow?

Thanks,

Phil.

Re: PNGs => MNG Good, MNG => PNGs Fails

Posted: 2012-11-08T08:48:11-07:00
by glennrp
philip_rhoades wrote:... is there any way of extracting the individual PNGs somehow?
I don't know but there might be. I will have a look. What happens if you do

Code: Select all

animate -delay 100 file.mng
or

Code: Select all

convert -delay 100 file.mng file%02d.png
I believe you can use "pngsplit" which comes with "pngcheck" to extract all of the individual PNG
chunks out of a MNG, and then simply "cat" each group of chunks from IHDR to IEND into a PNG.

Re: PNGs => MNG Good, MNG => PNGs Fails

Posted: 2012-11-08T09:48:57-07:00
by philip_rhoades
glennrp,

No . . I still just get one image . .

I did try pngsplit ("pngcheck -x") but it produces no output . .

Thanks,

Phil.

Re: PNGs => MNG Good, MNG => PNGs Fails

Posted: 2012-11-08T12:50:07-07:00
by philip_rhoades
glennrp,

I found a solution - if the delay was not included when creating the MNG, then this will extract the PNGs:

mplayer -ss 00:00:00 -frames 4 -vo png t.mng

- the PNG files produced are large but shrink when processed into a MNG again (with the delay switch this time).

Regards,

Phil.