Android Question help ,reduce photo jpg

mvera

Active Member
Licensed User
Longtime User
Hello.
I need to lower the size of a jpg photo, for that I use the library RSImageProcessingFixed,
the problem I have when I take the photo gives me the following error.


java.lang.IllegalArgumentException: bitmap size exceeds 32bits

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

There is another way to reduce the size of a photo?

Thank
 

mvera

Active Member
Licensed User
Longtime User
Yes, here I put the code.
Thank you





#Region Module Attributes
#FullScreen: False
#IncludeTitle: True
#ApplicationLabel: Camera example
#VersionCode: 1
#VersionName:
#SupportedOrientations: landscape
#End Region

'Activity module
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.

End Sub

Sub Globals
Dim camera1 As Camera
Dim btnTakePicture As Button
Dim Panel1 As Panel
Dim r As RSImageProcessing
End Sub

Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("1")
End Sub
Sub Camera1_Ready (Success As Boolean)
If Success Then
camera1.StartPreview
btnTakePicture.Enabled = True
Else
ToastMessageShow("Cannot open camera.", True)
End If
End Sub

Sub Activity_Resume
btnTakePicture.Enabled = False
camera1.Initialize(Panel1, "Camera1")

End Sub

Sub Activity_Pause (UserClosed As Boolean)
camera1.Release
End Sub

Sub Camera1_PictureTaken (Data() As Byte)
camera1.StartPreview
Dim out As OutputStream
out = File.OpenOutput(File.DirRootExternal, "/seguridad/1.jpg", False)
Dim b, bs As Bitmap
out.WriteBytes(Data, 0, Data.Length)
out.Close
ToastMessageShow("Image saved: " & File.Combine(File.DirRootExternal, "1.jpg"), True)

b.Initialize(File.DirRootExternal, "/seguridad/1.jpg")
bs = ReSize(b,10,10)
out = File.OpenOutput(File.DirRootExternal,"1_resize.jpg",False)
bs.WriteToStream(out,10,"JPG")
btnTakePicture.Enabled = True

End Sub

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



Sub btnTakePicture_Click
btnTakePicture.Enabled = False
camera1.TakePicture
End Sub
 
Upvote 0
Top