erreur de padding pour vérif de taille
This commit is contained in:
parent
3904137b97
commit
9210ece885
20
code/bmp.py
20
code/bmp.py
|
@ -13,7 +13,7 @@ img.parse( sys.argv[1] );
|
|||
|
||||
|
||||
### print header human-readable data ###
|
||||
print img.header.info()
|
||||
#print img.header.info()
|
||||
|
||||
### print file human-readable data ###
|
||||
#print img.readableData
|
||||
|
@ -26,17 +26,7 @@ print img.header.info()
|
|||
|
||||
|
||||
|
||||
|
||||
#for line in img.content.map:
|
||||
# for pixel in line:
|
||||
# print "rgb(%s, %s, %s)" % (pixel.r, pixel.g, pixel.b)
|
||||
# print
|
||||
|
||||
for byte in img.content.bin:
|
||||
print ord(byte),
|
||||
print
|
||||
|
||||
img.content.unparse( img.content.map )
|
||||
|
||||
for byte in img.content.bin:
|
||||
print ord(byte),
|
||||
for line in img.content.map:
|
||||
for pixel in line:
|
||||
print "rgb(%s, %s, %s)" % (pixel.r, pixel.g, pixel.b)
|
||||
print
|
|
@ -79,7 +79,7 @@ class BMPHeader:
|
|||
print "====================="
|
||||
print "padding: %s" % ( (4- self.width*3 %4)%4 )
|
||||
print "====================="
|
||||
|
||||
print
|
||||
|
||||
|
||||
####################################################
|
||||
|
@ -108,7 +108,7 @@ class BMPContent:
|
|||
# si le fichier a une mauvaise taille donc mauvais format
|
||||
if not len(binContent) == correctSize:
|
||||
print "Mauvais format (erreur de taille)"
|
||||
exit()
|
||||
# exit()
|
||||
|
||||
# attribution de la map
|
||||
self.map = []
|
||||
|
@ -189,7 +189,7 @@ class BMPFile:
|
|||
with open( filename ) as file:
|
||||
for byte in file.read():
|
||||
self.bin += byte;
|
||||
self.readableData += str(hex(ord(byte))) + " "
|
||||
self.readableData += str(ord(byte)) + " "
|
||||
|
||||
headerSize = 54
|
||||
|
||||
|
|
BIN
code/classes.pyc
BIN
code/classes.pyc
Binary file not shown.
Loading…
Reference in New Issue