So far there are two officially documented ways of getting image data after scanning: PIL.Image or NumPy array.
They both have their downsides. To only name one per package, PIL.Image lacks 48bit color support which limits all scans to only 24bit and a NumPy array is no image format. To get the data into something with proper image handling support (like a GdkPixbuf) this would have to be converted back to raw bytes, which makes the intermediate NumPy array useless.
Especially as both, PIL and NumPy, are optional dependencies, which are not enforced to use Python SANE, it would be nice to have some basic way to do a scan if neither PIL or NumPy are installed.
I'm currently developing a GUI scanning application in Python using the module, developed here. To do my scanning, I'll use "dev.snap()" which somewhat feels like an "undocumented internal function" but it does exactly what I need.
What I'm asking for is if it would be an useful addition to this module to expose "dev.snap()" in "sane.py" as "raw_snap" and add a convenience method "raw_scan" which, like the other "scan" methods, will call "start()" before calling "raw_snap". If so, I could prepare a Pull Request for this. I will keep using "dev.snap()" in the mean time as there is no useful alternative for now.
So far there are two officially documented ways of getting image data after scanning: PIL.Image or NumPy array.
They both have their downsides. To only name one per package, PIL.Image lacks 48bit color support which limits all scans to only 24bit and a NumPy array is no image format. To get the data into something with proper image handling support (like a GdkPixbuf) this would have to be converted back to raw bytes, which makes the intermediate NumPy array useless.
Especially as both, PIL and NumPy, are optional dependencies, which are not enforced to use Python SANE, it would be nice to have some basic way to do a scan if neither PIL or NumPy are installed.
I'm currently developing a GUI scanning application in Python using the module, developed here. To do my scanning, I'll use "dev.snap()" which somewhat feels like an "undocumented internal function" but it does exactly what I need.
What I'm asking for is if it would be an useful addition to this module to expose "dev.snap()" in "sane.py" as "raw_snap" and add a convenience method "raw_scan" which, like the other "scan" methods, will call "start()" before calling "raw_snap". If so, I could prepare a Pull Request for this. I will keep using "dev.snap()" in the mean time as there is no useful alternative for now.