diff --git a/code/bmp.py b/code/bmp.py index 57c3627..4feb4ca 100644 --- a/code/bmp.py +++ b/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), \ No newline at end of file +for line in img.content.map: + for pixel in line: + print "rgb(%s, %s, %s)" % (pixel.r, pixel.g, pixel.b) + print \ No newline at end of file diff --git a/code/classes.py b/code/classes.py index b8facba..1ddd08b 100644 --- a/code/classes.py +++ b/code/classes.py @@ -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 diff --git a/code/classes.pyc b/code/classes.pyc index 1de96c7..1e861da 100644 Binary files a/code/classes.pyc and b/code/classes.pyc differ