I had the same question but arrived at a perhaps more elegant answer.
binwalk -D 'png:png:convert %e %e' myfile.bin
That will run the convert
program in place on any extracted PNG files.
При извлечении файлов изображений из дампа прошивки с помощью binwalk, я получаю много действительных файлов png. Моя проблема заключается в следующем: все эти файлы очень большие. Они начинаются с правильного начала, но так же долго, как и остальная часть дампа. Как автоматически вырезать эти файлы?
I had the same question but arrived at a perhaps more elegant answer.
binwalk -D 'png:png:convert %e %e' myfile.bin
That will run the convert
program in place on any extracted PNG files.
Often you can use an image converter to convert the PNG's to ... PNG's.
Many image 'processors' will read the image based on the headers in the image file itself, which means they'll only read what is needed to load the picture. Then re-save the image, perhaps to a new name.
I created a fat PNG
(ha!) by cat
ing several files together, a PNG, and then a 3Meg PDF.
feh
loads the image just fine
gimp
loads the image, and saves it properly, dropping the extra garbage.
convert
(from imagemagick
package) works well, convert fat.png jcraig.png
strips off the extra.
gwenview
(KDE app) read and saved the file properly.
I only tried the few applications I could think of that I knew I had installed. The imagemagick
utility convert
is promising and scriptable.
for f in *.png; do convert "$f" "skinny.$f" done
Probably make light work of your weighty images.