예제 #1
0
class InternationalText(bin.Structure, encoding='utf8'):
    keyword = bin.String()
    is_compressed = bin.Integer(size=1)
    compression = bin.Integer(size=1, choices=COMPRESSION_CHOICES)
    language = bin.String()
    translated_keyword = bin.String()
    content = bin.Bytes(size=bin.Remainder)  # TODO: decompress
예제 #2
0
class Header(bin.Structure):
    marker = bin.FixedString(b'JFIF\x00')
    major_version = bin.Integer(size=1)
    minor_version = bin.Integer(size=1)
    density_units = bin.Integer(size=1, choicse=DENSITY_UNITS)
    x_density = bin.Integer(size=2)
    y_density = bin.Integer(size=2)
    thumb_width = bin.Integer(size=1)
    thumb_height = bin.Integer(size=1)
    thumb_data = bin.Bytes(size=3 * thumb_width * thumb_height)

    @property
    def version(self):
        return '%i.%02i' % (self.major_version, self.minor_version)
예제 #3
0
class TGA(bin.Structure, endianness=bin.LittleEndian):
    id_size = bin.Integer(size=1)
    color_map_type = bin.Integer(size=1, choices=COLOR_MAP_TYPES)
    image_type = bin.Integer(size=1, choices=IMAGE_TYPES)
    color_map_info = bin.SubStructure(ColorMap)
    x_origin = bin.Integer(size=2)
    y_origin = bin.Integer(size=2)
    width = bin.Integer(size=2)
    height = bin.Integer(size=2)
    bit_depth = bin.Integer(size=1)
    image_origin, alpha_depth = bin.SubStructure(AlphaOrigin)
    image_id = bin.Bytes(size=id_size)
    color_map_data = bin.List(bin.Integer(size=color_map_info.entry_size) / 8,
                              size=color_map_info.length)
    image_data = bin.List(bin.Integer(size=1), size=width * height * bit_depth)
예제 #4
0
파일: bmp.py 프로젝트: pombredanne/biwako
class BMP(bin.Structure, endianness=bin.LittleEndian):
    signature = bin.FixedString('BM')
    filesize = bin.Integer('Total file size', size=4)
    reserved = bin.Reserved(size=4)
    data_offset = bin.Integer('Offset of the actual image data', size=4)
    header_size = bin.Integer(size=4, default_value=40)
    width = bin.Integer(size=4)
    height = bin.Integer(size=4)
    plane_count = bin.Integer(size=2, default_value=1)
    bit_depth = bin.Integer(size=2)
    compression_type = bin.Integer(size=4,
                                   choices=COMPRESSION_TYPES,
                                   default_value=0)
    data_size = bin.Integer('Size of the actual image data', size=4)
    ppm_x = bin.Integer('Pixels per meter (X axis)', size=4)
    ppm_y = bin.Integer('Pixels per meter (Y axis)', size=4)
    color_count = bin.Integer('Number of colors', size=4)
    important_color_count = bin.Integer('Number of important colors', size=4)
    palette = bin.List(PaletteColor, size=color_count)
    pixel_data = bin.Bytes(size=bin.Remainder)
예제 #5
0
class EmptyChunk(bin.Chunk):
    id = bin.Integer(size=2)
    size = bin.Bytes(size=0)
    payload = bin.Payload(size=0)
예제 #6
0
class ICCProfile(bin.Structure):
    name = bin.String(encoding='latin-1')
    compression = bin.Integer(size=1, choices=COMPRESSION_CHOICES)
    profile = bin.Bytes(size=bin.Remainder)  # TODO: decompress
예제 #7
0
class CompressedText(bin.Structure, encoding='latin-1'):
    keyword = bin.String()
    compression = bin.Integer(size=1, choices=COMPRESSION_CHOICES)
    content = bin.Bytes(size=bin.Remainder)  # TODO: decompress
예제 #8
0
class Data(bin.Structure):
    data = bin.Bytes(size=bin.Remainder)
예제 #9
0
class Transparency(bin.Structure):
    data = bin.Bytes(size=bin.Remainder)
예제 #10
0
class Background(bin.Structure):
    data = bin.Bytes(size=bin.Remainder)
예제 #11
0
class SignificantBits(bin.Structure):
    data = bin.Bytes(size=bin.Remainder)