Small readme changes

This commit is contained in:
Niles Rogoff 2017-04-22 01:52:41 -04:00
parent ce1836539e
commit 4859c9b404
No known key found for this signature in database
GPG Key ID: B78B908F23430F80
1 changed files with 10 additions and 10 deletions

View File

@ -48,7 +48,7 @@ This takes an index of a chunk (see below) and overwrites the crc in that chunk
img.color_type = libpme.color_types.RGB img.color_type = libpme.color_types.RGB
img.width = img.height = 1 img.width = img.height = 1
img.chunks[1][2] = b'\x00\xFF\x00\x00' # a 1x1 red image, assuming that the second chunk is the only IDAT chunk img.chunks[1][2] = img.compress(b'\x00\xFF\x00\x00') # a 1x1 red image, assuming that the second chunk is the only IDAT chunk
img.recalculate_crc(1) # img.chunks[1][3] is now set to b'T\xbb\xd3\xea' img.recalculate_crc(1) # img.chunks[1][3] is now set to b'T\xbb\xd3\xea'
### `recalculate_length` ### `recalculate_length`
@ -69,7 +69,7 @@ This saves the image to the disk, overwriting a file if it was already there. If
Concatenates the (still compressed) data of each IDAT chunk, then returns it. Concatenates the (still compressed) data of each IDAT chunk, then returns it.
img.width = 2 img.width = 2
img.chunks.insert(2, [b'\x00\x00\x00\x03', b'IDAT', img.compress(b'\x00\xFF\x00'), b'j\xee\xb3\xd0']) # making it a 2x1 image with a red and a green pixel img.chunks.insert(2, [b'\x00\x00\x00\x03', b'IDAT', img.compress(b'\x00\xFF\x00'), b'j\xee\xb3\xd0']) # reusing the old data, now it's a 2x1 image with a red and a green pixel
img.decompress(img.get_concatenated_idat_data()) # returns '\x00\xFF\x00\x00\x00\xFF\x00'; img.decompress(img.get_concatenated_idat_data()) # returns '\x00\xFF\x00\x00\x00\xFF\x00';
### `write_raw_idat_data` ### `write_raw_idat_data`