Load an image from raw pixels data

531 views
Skip to first unread message

andre.a...@gmail.com

unread,
Apr 4, 2017, 1:17:13 PM4/4/17
to Flutter Dev
Hi, I am trying to create a camera service, but I can't find any way to push the raw pixels from the binary channel to an ui.Image. 
I found that decodeImageFromList only decodes an image from memory in some specific format like PNG. Is there any way to 
create an Image from uncompressed bitmap data, based on width, width step, height and in the pixels format (BGRA, RGBA,...) ?
If not, can this be done in canvas?

Thanks

Adam Barth

unread,
Apr 4, 2017, 1:19:37 PM4/4/17
to andre.a...@gmail.com, Flutter Dev
decodeImageFromList should support BMP, which basically just encodes that information into the start of the byte stream:

https://en.wikipedia.org/wiki/BMP_file_format

Adam


--
You received this message because you are subscribed to the Google Groups "Flutter Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

André Abreu

unread,
Apr 4, 2017, 1:55:39 PM4/4/17
to Flutter Dev
In that case, I need to create another byte buffer to add that information, I was expecting a way to access directly to the camera buffer without performing a new copy in each frame.

Adam Barth

unread,
Apr 4, 2017, 1:57:42 PM4/4/17
to André Abreu, Flutter Dev
That makes sense.  Would you be willing to file an issue?  It should be pretty easy to add a function that takes the raw data and the size/stride as separate arguments.

André Abreu

unread,
Apr 4, 2017, 2:40:52 PM4/4/17
to Flutter Dev
Reply all
Reply to author
Forward
0 new messages