2009-09-05から1日間の記事一覧

[Python Imaging Library] ImageDib.py

"""Helper functions for Image object.""" from ctypes import * from ctypes.wintypes import * gdi = windll.gdi32 def todib(image): """Image.tostring('raw', rawmode, stride=0, ystep=1) "rawmode" is a pixel format. (ex. RGB, GBR...) "stride" i…

[Python Imaging Library] convert Image object to HBITMAP.

上を踏まえて HBITMAP に変換。 色々決め打ちだけど GDI なんてレガシーはこれでいいんだ。 ああメンドクサイ。 import ImageDib ImageDib.tohbitmap(image) ImageWin? 動かんかった…

[Python Imaging Library] convert Image object to DIB.

CreateDIBSection() で作った DIB にコピーできるようなバイト列に変換。 tostring() のまともな __doc__ は [Image-SIG] Re: Explaination of encoder in tostring(encoder_name='raw', *args) くらいしかない。後はソース見ないと分からん。一発で変換でき…