Questions about Hue lazarus / 39-Graphics ---------------------------------------------------------------------- user5 · 2019-02-06 16:53 I have several questions about the code below.         1. What is the term "fpictureON"?         2. What type of variable should "hue" be and what is its acceptable range?     The code runs but it only produces a black image. Thanks.     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 procedure TForm1.Button4Click(Sender: TObject);var  t: TLazIntfImage;  mybitmap:TBitmap;  newcolor:TColor;  px,py : integer;  CurFPColor: TFPColor;  r,g,b,h,l,s : byte;  alpha : word;  hue:integer;  filename:string;  mypicture:TPicture;begin  if opendialog1.execute = true then  begin   mypicture := TPicture.create;   mybitmap := TBitmap.create;   filename := opendialog1.FileName;   hue := 128;   try    image3.Picture.Bitmap.loadfromfile(filename);    mypicture.loadfromfile(filename);;    image3.width := mypicture.width;    image3.height := mypicture.height;    image4.width := image3.width;    image4.height := image3.height;    //t :=  fpictureON.Bitmap.CreateIntfImage;    t:=TLazIntfImage.Create(0,0);  t.loadfromfile(filename);     t.width := image3.width;    t.height := image3.height;    for py:=0 to image3.Height-1 do begin    for px:=0 to image3.Width-1 do begin    CurFPColor := t.Colors[px,py];    newcolor := image3.canvas.pixels[px,py];    RGBtoHLS(hi(curFPColor.red ),hi(curFPColor.green),hi(curFPColor.blue),h,l,s);    HLStoRGB(hue,l,s,r,g,b);    curFPColor.red := r shl 8;    curFPColor.green := g shl 8;    curFPColor.blue := b shl 8;    t.Colors[px,py] :=  curFPColor;   end;   end;     t.savetofile('C:\Users\Arthur\Desktop\temp11\new1.bmp');    application.processmessages;    image4.Picture.bitmap.loadfromfile('C: \Users\Arthur\Desktop\temp11\new1.bmp');;   finally     t.free;   end;   mybitmap.free;   mypicture.free;  end; ---------------------------------------------------------------------- Blaazen · 2019-02-06 17:43 1) Probably some public or protected field: 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 fpictureON: TPicture;2) You have to look to code of HLSToRGB (I don't know what library it is). The range can be 0..100 or rather 0..255 since it is byte. ---------------------------------------------------------------------- engkin · 2019-02-06 17:53 I don't know, I see that you extract the hue value into variable h, but you convert the wrong value from a different variable hue: 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         RGB toHLS(hi(curFPColor.red),hi(curFPColor.green),hi(curFPColor.blue),h,l, s);        HLStoRGB(hue,l,s,r,g,b);  Edit: IIRC, setting the dimensions might delete the image. Your code seems to do that.