如何减少basic4android中jpeg图像的大小

时间:2015-03-25 07:00:22

标签: basic4android

你好,此时相机拍摄的图像尺寸超过1 mb。我想将它减少到20kb。请帮帮我。

Sub Camera1_PictureTaken (Data() As Byte)
    camera1.StartPreview
    DateTime.DateFormat ="HH.mm.ss.SS_dd-MM-yy_"
    forDate=DateTime.Date(DateTime.now)
    imei = pID.GetDeviceId

    filename = forDate & imei& "_.jpeg"
    File.MakeDir(File.DirRootExternal,"/data/data/a3a/cam/update/images")
    out = File.OpenOutput(File.DirRootExternal,"/data/data/a3a/cam/update/images/"&filename, False)
    out.WriteBytes(Data, 0, Data.Length)
    out.Close
End Sub

1 个答案:

答案 0 :(得分:0)

您可以将RSImageProcessing库添加到项目中。

这段代码会很明亮:)

Sub ReSize(b As Bitmap, newWidth As Int, newHeight As Int) As Bitmap
   Dim r As RSImageProcessing
   Return r.scaleBitmap(b, newWidth, newHeight)
End Sub