From 9210ece885394f061b8a45ead2df89569ca0984e Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Mon, 7 Sep 2015 10:37:58 +0200 Subject: [PATCH] =?UTF-8?q?erreur=20de=20padding=20pour=20v=C3=A9rif=20de?= =?UTF-8?q?=20taille?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- code/bmp.py | 20 +++++--------------- code/classes.py | 6 +++--- code/classes.pyc | Bin 6195 -> 6178 bytes 3 files changed, 8 insertions(+), 18 deletions(-) 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 1de96c7ed77dc3b5033d6b4ab3d7f868993dda13..1e861da0aa195db3159045e7c9a22501825b1dd4 100644 GIT binary patch delta 256 zcmdmNu*iUo`7vbm;O;S5l6NKlZiet0R)!j82J>20hQdjcFY*R525eU5o6jhs#{dLO{EV!OT+EV; z^2|bv94wn}@GG%!aRDWqfw-7yGK)y0hz~<86GMd)Lk$x{77If&1A|Mf$>c&21*RJ2 z$umV1eb_-_H4F^#93V1_gCUC(%wS}wVPQ~cW@KP2;esjQ2Fq|GDS_zVVUP#woy;bh X#mGCkP*iL30@0(4nw!(a&N2c3Y>zjM delta 271 zcmZ2vu-Sl(`79$yd&h z!p7k4QNqa3%)r1nS(JAr{~?C(8dioHW(M