Crash in app lazarus / 43-Android ---------------------------------------------------------------------- biologic · 2025-03-23 03:11 Maybe someone more experienced in LAMW can help. Many thanks. ---------------------------------------------------------------------- biologic · 2025-03-23 16:59 The code I want to make is : - Open a bitmap with a press on a button (done) - Show rhe bitmap on the form (done) - with a press on 'convert' button, change the pixels to grayscale of the opened bitmap, and show the changed bitmap on the form. - with a press on the 'save' button, save this new gray bitmap. I'm stuck in step 3, convert bitmap to grayscale. ---------------------------------------------------------------------- biologic · 2025-03-28 22:49 I Found a good resource on Bitmaps in one of the AppDrawingInBitmap examples. https://en.proft.me/2017/08/2/how-work-bitmap-android/ ---------------------------------------------------------------------- biologic · 2025-03-30 17:21 Anyone knows how to read/write a pixel from a jBitmap/jCanvas ? ---------------------------------------------------------------------- dseligo · 2025-03-31 08:37 I don't have time to test it now, but ... Try to use BitmapToArrayOfJByte method, something like: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i var  posX, posY, bitmapWidth, bitmapHeight, bytesByLine: Word;  red, green, blue: Integer;  ABmp: jBitmap;  baBmp: TDynArrayOfJByte;  iNumPixels: Integer;begin  ... // load image to ABmp  ...  bitmapWidth := ABmp.GetWidth();  bitmapHeight := ABmp.GetHeight();  bytesByLine := Ceil(bitmapWidth / 8);  baBmp := nil;  iNumPixels := ABmp.BitmapToArrayOfJByte(baBmp); // to array in RGBA format   for posY := 0 to bitmapHeight - 1 do // for every row  begin    While j < bitmapWidth do // for every column    begin      For k := 0 to 7 do // for every bit bit in column byte      begin        posX := j + k;      if posX < bitmapWidth then // it doesn't have to be whole byte at last column        begin          // RGB values, I don't need alpha channel (alpha channel is +3)          red   := Byte(baBmp[ posY * bitmapWidth * 4 + posX * 4 + 0 ]);          green := Byte(baBmp[ posY * bitmapWidth * 4 + posX * 4 + 1 ]);          blue  := Byte(baBmp[ posY * bitmapWidth * 4 + posX * 4 + 2 ]);          ...          // you can do something now with pixel RGB values        end;      end;      j := j + 8;    end;  end;  ...  // convert it to new bitmapend; I didn't convert back to bitmap, because I am printing to POS printer. I see that methods GetBitmapFromJByteArray and SetByteArrayToBitmap exists, probably you can use them to get bitmap back from byte array. ---------------------------------------------------------------------- biologic · 2025-03-31 12:52 Thank you.  I will try this as soon as I can. Next weekend probably. ---------------------------------------------------------------------- biologic · 2025-04-06 18:03 If I want to call the getPixels method of the Bitmap Java object, can this be done inside the project code ? Or Something different to do ? Thanks ---------------------------------------------------------------------- biologic · 2025-04-09 07:57 I found a good explanation at Chatgpt.