[pywin32-bugs] [ pywin32-Feature Requests-1374042 ] Improve GetBitmapBits()
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: SourceForge.net <no...@so...> - 2005-12-06 21:30:37
|
Feature Requests item #1374042, was opened at 2005-12-06 15:29 Message generated for change (Comment added) made by swoolford You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=551957&aid=1374042&group_id=78018 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: win32 Group: None Status: Open Resolution: None Priority: 5 Submitted By: Stuart Woolford (swoolford) Assigned to: Nobody/Anonymous (nobody) Summary: Improve GetBitmapBits() Initial Comment: It would be a great enhancement to GetBitmapBits if it would return a string of the bitmap data, rather than a tuple of integers. The reasoning for this is that just about every other imaging library (for example PIL and wxPython) can handle data as a string of bytes, and converting to this is VERY slow. I would suggest perhaps there should be a GetBitmapBitsString() added.. As an example at present I have to: bmp=win32ui.CreateBitmapFromHandle(mybitmap) data=array.array('B',bmp.GetBitmapBits()).tostring() image=Image.fromstring("RGBA",size,data,"raw","BGRA" And the middle line takes around 0.7 seconds for 720x576x32bit, this is VERY slow. I would like to: bmp=win32ui.CreateBitmapFromHandle(mybitmap) data=bmp.GetBitmapBitsString() image=Image.fromstring("RGBA",size,data,"raw","BGRA" Which should take MUCH less time. This is currently an urgent problem, but the change is trivial and I will do it to my own copy, hopefully submitting a patch, although I dont usually do much C under windows. ---------------------------------------------------------------------- >Comment By: Stuart Woolford (swoolford) Date: 2005-12-07 10:30 Message: Logged In: YES user_id=158782 Thank you so much Mark, that patch works perfectly, and I would love to see it in the next version. The time to fetch a single image into PIL went from 0.7 seconds to 0.013 seconds. Perfect! ---------------------------------------------------------------------- Comment By: Mark Hammond (mhammond) Date: 2005-12-06 19:03 Message: Logged In: YES user_id=14198 I'm attaching a patch that does this by way of an optional param. Let me know if this works for you. alternatively let me know which Python version you use and I'll mail a new .pyd to you. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=551957&aid=1374042&group_id=78018 |