Resize and Compress image to byte array without saving the new image

前端 未结 2 1513
春和景丽
春和景丽 2020-12-22 02:48

The image is first resized, compressed and then saved on disk as \"Preview.jpg\" and then it is opened to convert into byte array. The code works fine but I cannot figure ou

2条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-22 03:23

    You could save it to a stream and load it from there

        Using Str As New MemoryStream
            myThumb.Save(Str, jgpEncoder, myEncoderParameters)
            myImage = Image.FromStream(Str)
        End Using
    

提交回复
热议问题