image icon indicating copy to clipboard operation
image copied to clipboard

how to convert the package image to flutter default Image type?

Open Fethi-Hamdani opened this issue 5 years ago • 6 comments

Fethi-Hamdani avatar Nov 17 '19 18:11 Fethi-Hamdani

Does anybody know how to do this without saving image into a file?

agordeev avatar Feb 05 '20 13:02 agordeev

try this Image.memory(im.encodePng(image))

Fethi-Hamdani avatar Feb 05 '20 14:02 Fethi-Hamdani

Having the above code snippet in the top-level documentation/sample would have saved me a few hours of time.

rich-j avatar Jul 06 '20 23:07 rich-j

Above code no longer worked for me because im.encodePng returns int list while Image.memory expects uintList. This minor modification works for me: Image.memory(Uint8List.fromList(im.encodePng(rectifiedImage)))

physxP avatar Aug 15 '21 18:08 physxP

You should also be able to typecast the returned type: Image.memory(im.encodePng(rectifiedImage) as Uint8List).

brendan-duncan avatar Aug 15 '21 18:08 brendan-duncan

What is the opposite way, i.e. how to generate a package Image from default Image type?

Terranic avatar Oct 25 '22 18:10 Terranic