I'm trying to "lighten the weight" of a bitmap.
Initially I used RSImageProcessing but it seems to save a wrong bitmap... sometimes (I think it does not accept bitmaps with much depth).
 (I think it does not accept bitmaps with much depth).
Then I used WriteToStream; if I save in JPEG format, decreasing the quality, it seems to increase the "weight" for the bitmap .
.
"Solved" saving as PNG.
Code I used:
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
			
			Initially I used RSImageProcessing but it seems to save a wrong bitmap... sometimes
Then I used WriteToStream; if I save in JPEG format, decreasing the quality, it seems to increase the "weight" for the bitmap
"Solved" saving as PNG.
Code I used:
			
				B4X:
			
		
		
		Sub Compress(Bmp As Bitmap, Quality As Int) As Bitmap
   Dim FileName As String = "temp.png"
  
   Dim OStream As OutputStream
   OStream = File.OpenOutput(File.DirInternal, FileName, False)
'   mRSImageProcessing.compress(Bmp, "JPEG", Quality, OStream)
   Bmp.WriteToStream(OStream, Quality, "PNG")
  
   Dim IStream As InputStream
   IStream = File.OpenInput(File.DirInternal, FileName)
   Dim BmpCompressed As Bitmap
   BmpCompressed.Initialize2(IStream)
  
   File.Delete(File.DirInternal, FileName)
   Return BmpCompressed
End Sub 
				 
 
		 
 
		 
 
		 
 
		 
 
		