Re: [dev] Looking for simple, alpha supporting image format

From: Tony Lainson <t.lainson_AT_gmail.com>
Date: Fri, 18 Jul 2014 06:28:41 +1000

> Is there an image format that's simpler than PPM and that supports
> alpha transparency?

If you want a format that works with existing tools, TGA can be
simple. Just don't use run-length encoding or indexed colour or
extension information (colour correction table, gamma field,
premultiplied alpha flag, pixel aspect ratio).


# write a sample TGA image:

printf '\x00' # no image ID field
printf '\x00' # no color map
printf '\x02' # unmapped, uncompressed RGB
printf '\x00\x00\x00\x00\x00' # color map info (ignored)
printf '\x00\x00' # x origin
printf '\x00\x00' # y origin
printf '\x10\x00' # width
printf '\x10\x00' # height
printf '\x20' # bits per pixel
printf '\x28' # 8 alpha bits per pixel, origin top left (0x20), no interleaving
# origin bottom left (0x00) is common.

for i in 0 1 2 3 4 5 6 7 8 9 a b c d e f; do
    for j in 0 1 2 3 4 5 6 7 8 9 a b c d e f; do
        printf "\xff\x00\x00\x$i$j" # BGRA - bright blue, varying alpha
    done
done

# optional footer:
# printf '\x00\x00\x00\x00' # no extension area
# printf '\x00\x00\x00\x00' # no developer directory
# printf 'TRUEVISION-XFILE.\x00'
Received on Thu Jul 17 2014 - 22:28:41 CEST

This archive was generated by hypermail 2.3.0 : Thu Jul 17 2014 - 22:36:07 CEST