Open timmarkhuff opened 6 months ago
ns a PIL image. Too much stuff would break.
Also aren't there some docs we should update for this? I think we should recommend to people to star tusing the grabimg method.
Sure, I can update the docs. Should we log a warning when someone uses grab
and then eventually deprecate it? Or maybe we just offer two methods?
I think we just offer two, and recommend the PIL image as being simple and more reliable.
Previously, FrameGrab has always returned numpy arrays. This PR changes FrameGrab to return PIL images instead.
numpy arrays can be challenging because they don't contain any metadata about color space, and therefore it's easy to mix up RGB and BGR. PIL images contain a
mode
attribute that fixes this usability problem.We believe users will appreciate receiving PIL images. If they need a numpy array, they can easily convert.
This will be a breaking change, and I'm not sure if there is a way to avoid this. We could leave the old
grab
method the way it is, returning numpy arrays, and then create a new method calledgrab_frame
(or something similar) that returns PIL images, but I don't believe this works towards our ultimate goal of deprecating numpy images; people will gravitate towardsgrab
because it's simpler and probably the first thing autocomplete serves them. Maybe we could log a warning when people usegrab
and deprecate it in the future? However this leaves us withgrab_frame
as our main method, which is not as elegant as justgrab
.