c# - How to Download Image as JPG Compress it and Display it in a ImageView? -
how can download image url, compress it, , display in image view.
the way doing using bitmap , file sizes large on 20 images slows download , crashed together. there anyway this?
here have tried
using (webclient webclient = new webclient()) { byte [] data = webclient.downloaddata("https://fbcdn-sphotos-h-a.akamaihd.net/hphotos-ak-xpf1/v/t34.0-12/10555140_10201501435212873_1318258071_n.jpg?oh=97ebc03895b7acee9aebbde7d6b002bf&oe=53c9abb0&__gda__=1405685729_110e04e71d9"); using (memorystream mem = new memorystream(data)) { var yourimage = system.net.mime.mediatypenames.image.fromstream(mem) ; //as jpeg yourimage.save("path_of_your_file.jpg", imageformat.jpeg) ; } } but fromstream , , save not work
to download file (assuming jpg) , save do
using (webclient webclient = new webclient()) { byte [] data = webclient.downloaddata(image_url); file.writeallbytes(path_to_file, data); }
Comments
Post a Comment