Saving the Picturebox

0

I'm trying to save the contents of a picturebox, but it always saves the original image and not the one being displayed. Can anyone help me?

DimmyEncoderAsEncoderDimmyImageCodecInfoAsImageCodecInfoDimmyEncoderParameterAsEncoderParameterDimmyEncoderParametersAsEncoderParametersDimbmpAsBitmap=CType(imgJpgPng.Image,Bitmap)DimbmptAsNewBitmap(640,640)UsinggAsGraphics=Graphics.FromImage(bmpt)g.DrawImage(bmp,0,0,bmpt.Width,bmpt.Height)EndUsingmyImageCodecInfo=GetEncoderInfo(ImageFormat.Jpeg)myEncoder=Encoder.QualitymyEncoderParameters=NewEncoderParameters(1)myEncoderParameter=NewEncoderParameter(myEncoder,CType(75L,Int32))myEncoderParameters.Param(0)=myEncoderParameterbmpt.Save("d:\TempImg
Dim myEncoder As Encoder
    Dim myImageCodecInfo As ImageCodecInfo
    Dim myEncoderParameter As EncoderParameter
    Dim myEncoderParameters As EncoderParameters
    Dim bmp As Bitmap = CType(imgJpgPng.Image, Bitmap)
    Dim bmpt As New Bitmap(640, 640)
    Using g As Graphics = Graphics.FromImage(bmpt)
        g.DrawImage(bmp, 0, 0, bmpt.Width, bmpt.Height)
    End Using
    myImageCodecInfo = GetEncoderInfo(ImageFormat.Jpeg)
    myEncoder = Encoder.Quality
    myEncoderParameters = New EncoderParameters(1)
    myEncoderParameter = New EncoderParameter(myEncoder, CType(75L, Int32))
    myEncoderParameters.Param(0) = myEncoderParameter
    bmpt.Save("d:\TempImg%pre%00.JPG", myImageCodecInfo, myEncoderParameters)
00.JPG", myImageCodecInfo, myEncoderParameters)
    
asked by anonymous 25.12.2016 / 23:44

0 answers