B4A Library BitmapExtended Library

Discussion in 'Additional libraries, classes and official updates' started by XverhelstX, Sep 24, 2011.

  1. pixelpop

    pixelpop Active Member Licensed User

    Could someone post a code snippet that shows valid parameters for scaleBitmap? I'm not sure what the "degrees" parameters should be.
     
  2. wheretheidivides

    wheretheidivides Active Member Licensed User

    "Everything is explained in the library. A sample is delivered."

    there's not much in instructions here. I tried and failed as usual. Is there any way you could explain is a little better? I have a imageview that are sometimes hor and sometimes vert. I have a thumbnail but would like to them to enlarge and be in correct orientation
     
    Last edited: Jan 27, 2013
  3. wheretheidivides

    wheretheidivides Active Member Licensed User

    the attached zip example doesn't do anything. Here's the code.

    Code:
    Sub Globals
       
    'These global variables will be redeclared each time the activity is created.
       'These variables can only be accessed from this module.
       
       
    Dim btmpex As BitmapExtended
       
    Dim btmp As Bitmap
       btmp.Initialize(
    File.DirAssets,"rs2.png")
       

    End Sub

    Sub Activity_Create(FirstTime As Boolean)

       
    If FirstTime Then
          btmpex.Initialize(
    "BitmapExtended")
       
    End If
       

    End Sub

    Sub Activity_Resume

    If File.Exists(File.DirDefaultExternal,"rs2.png"Then
       
    Else
       
    File.Copy(File.DirAssets,"rs2.png",File.DirDefaultExternal,"rs2.png")
    End If

    End Sub

    Sub Activity_Pause (UserClosed As Boolean)

    End Sub
     
  4. antreg

    antreg Member Licensed User

    Hi!
    I have to create an image, using bitmapextender.SetPixels starting from an array of int.
    The array of int is a conversion of bytes (one to one, so each value of byte become a int with a java routine written in eclipse)
    I am able to obtain a visible image...that is supposed to be a grayscale image, but with a yellow tint and probabily with other problem of saturation.
    My question is: with then same values, ina vb.net program on windows I see a perfect and grayscaled, luminosity balanced image, what I'm doing wrong in android world?
     
  5. antreg

    antreg Member Licensed User

    HI! I solved. All behaviour depends from bitmap config and how you convert the integer.
    For the bitmap config I solved using RGB_565. I create an image directly from a java lib I wrote for converting list of byte in array of int.
    For the byte->integer conversion:
    Code:
    int gByte = (int) myBytes[i] & 0xFF;
    int rgb = (gByte << 
    16) | (gByte << 8) | gByte;
    Where myBytes contains the bytes downloaded from a camera in async way.
     
  6. Firpas

    Firpas Active Member Licensed User

    How to initialize as mutable a bitmap with config "RGB_565" createed with createbitmap2??

    Sub Process_Globals
    Dim btmpex As BitmapExtended
    ...

    Sub Activity_Create(FirstTime AsBoolean)
    If FirstTime Then btmpex.Initialize("")
    ...

    Sub BtnConvert_Click
    Dim Bmp1 AsBitmap = Img1.Bitmap
    Dim Bmp2 AsBitmap = btmpex.createBitmap2(Bmp1.Width, Bmp1.Height, "RGB_565")

    'This change the config from RGB_565 to ARGB_8888
    Bmp2.InitializeMutable(Bmp1.Width, Bmp1.Height)

    'Convert to Black and White
    For y = 0 To Bmp2.Height-1
    For x = 0 To Bmp2.Width-1
    If btmpex.getPixel(Bmp1, x, y) >= 0xFFDCDCDC Then
    btmpex.setPixel(Bmp2, x, y, Colors.White)
    Else
    btmpex.setPixel(Bmp2, x, y, Colors.black)
    End If
    Next
    Next
     
    Last edited: Dec 4, 2013
  7. Itila Tumer

    Itila Tumer Active Member Licensed User

    I couldn't see the working results . what should I see ??
     
  8. Garen Evans

    Garen Evans New Member Licensed User

    I am encountering the same problem as Firpas. The following returns a runtime exception to the effect that an Object should first be initialized.


    Dim bm3 As Bitmap = bmex.createBitmap2 (256,256,"RGB_565")
    Log(bm3.Width & " " & bm3.Height )
     
  9. Devv

    Devv Active Member Licensed User

    rotate bitmap is reducing the quality of the image too much !
     
  10. Urishev

    Urishev Member Licensed User

    I get the bitmap using the camera preview. To work you need a specific part of the bitmap. How to create a new bitmap with the specific coordinates? J use BitmapExtended.createBitmap. Error in the last line. Why?
    Code:
    Dim jpeg() As Byte = camEx.PreviewImageToJpeg(PreviewPic, 70)
        lastPreviewSaved = 
    DateTime.Now
        
    Dim in As InputStream
        
    in.InitializeFromBytesArray(jpeg0jpeg.Length)
        bmp.Initialize2(
    in)
        
    in.Close
          bmp1 = 
    BitmapExtended.createBitmap(bmp, 100400640480jpegfalse)
     
    Last edited: May 18, 2019
  11. Erel

    Erel Administrator Staff Member Licensed User

    You can use Bitmap.Crop.
     
  12. Urishev

    Urishev Member Licensed User

    Thanks. Everything is working. BitmapExtended library is not needed.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice