PNGs => MNG Good, MNG => PNGs Fails

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
philip_rhoades
Posts: 7
Joined: 2012-09-12T12:39:19-07:00
Authentication code: 67789

PNGs => MNG Good, MNG => PNGs Fails

Post 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.
philip_rhoades
Posts: 7
Joined: 2012-09-12T12:39:19-07:00
Authentication code: 67789

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

Post 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.
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

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

Post 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.
philip_rhoades
Posts: 7
Joined: 2012-09-12T12:39:19-07:00
Authentication code: 67789

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

Post 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.
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

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

Post 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.
philip_rhoades
Posts: 7
Joined: 2012-09-12T12:39:19-07:00
Authentication code: 67789

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

Post by philip_rhoades »

glennrp,

No . . I still just get one image . .

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

Thanks,

Phil.
philip_rhoades
Posts: 7
Joined: 2012-09-12T12:39:19-07:00
Authentication code: 67789

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

Post 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.
Post Reply