mirror of
https://github.com/dnet/pySSTV.git
synced 2025-12-06 07:12:00 +01:00
27 lines
552 B
Python
27 lines
552 B
Python
#!/usr/bin/env python
|
|
|
|
"""primitive partial PIL to IronPython (.Net) wrapper"""
|
|
|
|
import clr
|
|
clr.AddReference("System.Drawing")
|
|
from System.Drawing import Image as SDI
|
|
|
|
class Image(object):
|
|
@classmethod
|
|
def open(_cls, filename):
|
|
return Image(SDI.FromFile(filename))
|
|
|
|
def __init__(self, img):
|
|
self.img = img
|
|
self.size = (img.Width, img.Height)
|
|
|
|
def convert(self, _ignore):
|
|
return self # TODO
|
|
|
|
def load(self):
|
|
return self
|
|
|
|
def __getitem__(self, (x, y)):
|
|
color = self.img.GetPixel(x, y)
|
|
return int(color.R), int(color.G), int(color.B)
|