On Thu, 05 Apr 2012 20:19:16 -0400 Samuel Bronson <naes...@gmail.com> wrote:
> It would be possible to check "Color type" field first, but there does > not appear to be any way to do arithmetic on a value read from the > file before printing it, so I don't see any practical way to get the > behavior that you want. Thanks for the pragmatic reply, and ensuing interesting puzzle. Arithmetic for 'magic' values sounds like a useful feature, so that could be another 'wishlist' bug. Fortunately, output more like 'file *.BMP' requires no arithmetic: 0 string \x89PNG\x0d\x0a\x1a\x0a PNG image data, !:mime image/png >25 byte 0 grayscale, >25 byte 2 color RGB, >25 byte 3 colormap, >25 byte 4 gray+alpha, >25 byte 6 color RGBA, >28 byte 0 non-interlaced >28 byte 1 interlaced >16 belong x \b, %ld x >20 belong x %ld >25 byte 0 >>24 byte x \b x %d >25 byte 2 >>24 byte 8 \b x 24 >>24 byte 16 \b x 48 >25 byte 3 >>24 byte x \b x %d >25 byte 4 >>24 byte 8 \b x 16 >>24 byte 16 \b x 32 >25 byte 6 >>24 byte 8 \b x 32 >>24 byte 16 \b x 64 Which (when copied to '/etc/magic') outputs: # 'imagemagick' contains various PNGs. % cd /usr/share/doc/imagemagick/images/ ; file [wn]*.png ; cd - > /dev/null navy.png: PNG image data, color RGB, non-interlaced, 64 x 64 x 48 networkredux.png: PNG image data, colormap, interlaced, 140 x 31 x 8 wand.png: PNG image data, color RGBA, non-interlaced, 32 x 32 x 32 white-highlight.png: PNG image data, color RGB, non-interlaced, 70 x 70 x 48 wizard.png: PNG image data, color RGB, non-interlaced, 940 x 1250 x 24 Online PNG references consulted: http://en.wikipedia.org/wiki/Portable_Network_Graphics#Color_depth http://www.w3.org/TR/PNG/#11IHDR http://www.libpng.org/pub/png/book/toc.html HTH... -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org