denoising.py/code/bmp.py

24 lines
477 B
Python
Raw Normal View History

2015-09-06 12:54:58 +00:00
# ~*~ encoding: utf-8 ~*~ #
###########################
# TRAITEMENT D'IMAGES #
###########################
2015-09-06 14:01:17 +00:00
# classes
2015-09-06 14:28:56 +00:00
from classes import *
2015-09-06 14:01:17 +00:00
2015-09-06 12:54:58 +00:00
import sys
2015-09-06 14:02:28 +00:00
fileData = ""
2015-09-06 12:54:58 +00:00
with open(sys.argv[1]) as f:
for byte in f.read():
2015-09-06 14:02:28 +00:00
fileData += byte
2015-09-06 12:54:58 +00:00
2015-09-06 14:01:17 +00:00
headerSize = 54
2015-09-06 14:28:56 +00:00
header = BMPHeader( fileData[:headerSize] )
2015-09-06 15:05:52 +00:00
content = BMPContent( fileData[header.offset:], header )
2015-09-06 12:54:58 +00:00
for line in content.map:
for pixel in line:
2015-09-06 16:35:58 +00:00
print "rgb(%s, %s, %s)" % (pixel.r, pixel.g, pixel.b)
print