summaryrefslogtreecommitdiff
path: root/bin/raw2png.py
diff options
context:
space:
mode:
authorJosé Fonseca <jrfonseca@tungstengraphics.com>2008-07-07 19:35:23 +0900
committerJosé Fonseca <jrfonseca@tungstengraphics.com>2008-07-08 07:29:18 +0900
commit6701ecb3bae4bb34d14d0740a4da9481dd9f7704 (patch)
treef521f7c4da16e4dd8db17aa43fb1f585f9c2d17e /bin/raw2png.py
parent30b6b0b9ef05b4f19a9b151b676e7069320be74d (diff)
raw2png: More helpful messages. Handle PIPE_FORMAT_A8B8G8R8_SNORM.
Diffstat (limited to 'bin/raw2png.py')
-rwxr-xr-xbin/raw2png.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/bin/raw2png.py b/bin/raw2png.py
index 741839f73a..880dc89f55 100755
--- a/bin/raw2png.py
+++ b/bin/raw2png.py
@@ -277,6 +277,7 @@ translate = {
PIPE_FORMAT_X8R8G8B8_UNORM: (4, 1, 1, translate_rgba),
PIPE_FORMAT_B8G8R8A8_UNORM: (4, 1, 1, translate_rgba),
PIPE_FORMAT_B8G8R8X8_UNORM: (4, 1, 1, translate_rgba),
+ PIPE_FORMAT_A8B8G8R8_SNORM: (4, 1, 1, translate_rgba),
PIPE_FORMAT_YCBCR: (4, 2, 1, translate_ycbcr),
PIPE_FORMAT_YCBCR_REV: (4, 2, 1, translate_ycbcr_rev),
}
@@ -287,15 +288,20 @@ def read_header(infile):
return struct.unpack_from(header_fmt, header)
def process(infilename, outfilename):
+ sys.stderr.write("%s -> %s\n" % (infilename, outfilename))
infile = open(infilename, "rb")
format, cpp, width, height = read_header(infile)
- sys.stderr.write("format = %s, cpp = %u, width = %u, height = %u\n" % (formats[format], cpp, width, height))
+ sys.stderr.write(" %ux%ux%ubpp %s\n" % (width, height, cpp*8, formats[format]))
outimage = Image.new(
mode='RGB',
size=(width, height),
color=(0,0,0))
outpixels = outimage.load()
- bsize, bwidth, bheight, translate_func = translate[format]
+ try:
+ bsize, bwidth, bheight, translate_func = translate[format]
+ except KeyError:
+ sys.stderr.write('error: unsupported format %s\n' % formats[format])
+ return
for y in range(0, height, bheight):
for x in range(0, width, bwidth):
indata = map(ord, infile.read(4))