function getPng2PrgOutputFormat(array $output) : string { $convLine = ''; /* * find the line with the converted info * png2prg echoes a line like this: * * converted "INFILE" to "OUFILE" in "FORMAT" format * * step 1.) look for a line starting with 'converted' */ foreach ($output as $line) { if (substr($line, 0, 9) === 'converted') { $convLine = $line; break; } } /* * step 2.) split the line on char " to array * and return element '5' with the FORMAT */ $convLineArr = explode('"', $convLine); if (!array_key_exists('5', $convLineArr)) return ''; return trim($convLineArr['5']); }
Awesome job again Burglar! Thanks! But one thing for the "wishlist": It would be nice if your console output would provide a "machine recognizable" line what the final output format is.
bitmap = $2000 screenram = $3f40 colorram = $4328 d020color = 0 d021color = 1
Option 2. is something I wanted to avoid, because I want to be able to just throw a bunch of PNGs that could contain anything into a dir and rely on your autodetection ;-)
write 8356 bytes to "q.prg" in "koala" format.