Modify canvas of a TGraphic bitmap before drawing - how?

Web Core, Delphi 10.4.2.

I read a .gif file from the server into an object of type TGraphic with the LoadFromURL(URL, callback) method. In the callback function, I draw the loaded bitmap onto the canvas of a TJSCanvasRenderingContext2D context, this works fine.

My problem: I now have to manipulate the bitmap (exchange some pixels' color) before drawing. For that, I try to read the .canvas.pixels[...] array of the TGraphic object (in the callback function). But this gives only black pixels for the whole image.
And reading the image data with the method .GetBase64Image gives an empty string.

What am I missing?

Where is this TJSCanvasRenderingContext2D coming from and what is its relationship to your canvas?
Either you use TCanvas everywhere and can use Pixels or you use JavaScript objects like TJSCanvasRenderingContext2D and continue to work at level of the JavaScript object.

My goal is to read a graphics file, then manipulate it pixel-wise (for example exchange black pixels by gray) and finally draw it onto a paintbox. To make it more clear, please see following sample code.

    myGraphic : TGraphic;

procedure TForm1.graphcallback;
  count, x, y : integer;
  form1.weblabel1.caption:=inttostr(myGraphic.width)+' x '+inttostr(myGraphic.height)+' pixels';
  for x := 0 to myGraphic.width-1 do
      for y := 0 to myGraphic.height-1 do
            if myGraphic.canvas.pixels[x,y]=0 then
  weblabel2.caption:='black pixels: '+inttostr(count);

procedure TForm1.WebButton6Click(Sender: TObject);
  myGraphic.LoadFromURL('', form1.graphcallback);


When run, the code produces label1='187 x 187 pixels', which is correct. It also sets label2=''black pixels: 34969', which means that EVERY pixel is counted as a black pixel, but that's not true as you can easily see when looking at the picture.

How can I read the pixels of a TGraphic object which is loaded from the server?

You cannot do this directly.
I recommend to create a TCanvas and draw the TGraphic on this canvas and then access the pixels in this created TCanvas.