Results 1 to 6 of 6

Thread: Autocoloring

  1. #1
    Join Date
    Sep 2010
    Posts
    37
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Autocoloring

    Okay so I'm trying my hand at autocoloring and I have a few questions. I've read some tutorials, looked through a few posts and I've come to the conclusion that autocoloring via R, G, B seems to be the best way to do it. So my first question is why?

    Second question why is it better than using H, S, L, or X, Y, Z?

    And finally if people could provide me with a few examples of good autocolors (I looked at the one in SRL and it was pretty cool, the explanations were nice, but I found it a bit too advanced for what I'm looking to make).

    Thanks,

    Inspirations

  2. #2
    Join Date
    Dec 2007
    Posts
    2,766
    Mentioned
    2 Post(s)
    Quoted
    37 Post(s)

    Default

    Quote Originally Posted by Inspirations View Post
    Okay so I'm trying my hand at autocoloring and I have a few questions. I've read some tutorials, looked through a few posts and I've come to the conclusion that autocoloring via R, G, B seems to be the best way to do it. So my first question is why?

    Second question why is it better than using H, S, L, or X, Y, Z?

    And finally if people could provide me with a few examples of good autocolors (I looked at the one in SRL and it was pretty cool, the explanations were nice, but I found it a bit too advanced for what I'm looking to make).

    Thanks,

    Inspirations
    AFAIK XYZ is more precise than any other.

  3. #3
    Join Date
    Sep 2010
    Posts
    37
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    cool. and how do I get these x, y, z ranges? Only through the ACA?

  4. #4
    Join Date
    Feb 2009
    Location
    Irvine, CA
    Posts
    2,873
    Mentioned
    8 Post(s)
    Quoted
    138 Post(s)

    Default

    Simba Code:
    program New;
    //By Mastaraymond
    //0 = Min
    //1 = Max
    var
      I,II : integer;
      RGBColor : Array[1..3] of Integer;
      RGB : Array[0..1] of Array[1..3] of Integer;
      XYZColor, HSLColor : Array[1..3] of Extended;
      HSL,XYZ : Array[0..1] of Array[1..3] of Extended;
      Colors : TIntegerArray;
      Strings : Array[0..9] of String;
    Procedure Init;
    begin;
      Colors := [];
    end;
    begin
      Init;
      For I:= 1 to 3 do
      begin;
        Writeln('');
        RGB[0][i] := 255;
        HSL[0][i] := 255; //Max is 240?
        XYZ[0][i] := 255; //Max is ...?
      end;
      Strings[1] := 'R: ';
      Strings[0] := '   ';
      Strings[2] := 'G: ';
      Strings[3] := 'B: ';
      Strings[4] := 'H: ';
      Strings[5] := 'S: ';
      Strings[6] := 'L: ';
      Strings[7] := 'X: ';
      Strings[8] := 'Y: ';
      Strings[9] := 'Z: ';
      For I:= 0 to High(Colors) do
      begin;
        Strings[0] := Strings[0] + Padr('Color: '+inttostr(Colors[i]),16) +' | ';
        ColortoRGB(Colors[i],RGBColor[1],RGBColor[2],RGBColor[3]);
        ColortoHSL(Colors[i],HSLColor[1],HSLColor[2],HSLColor[3]);
        ColortoXYZ(Colors[i],XYZColor[1],XYZColor[2],XYZColor[3]);
        For II:= 1 to 3 do
        begin;
          RGB[0][II] := Min(RGBColor[II],RGB[0][II]);
          RGB[1][II] := Max(RGBColor[II],RGB[1][II]);
          HSL[0][II] := MinE(HSLColor[II],HSL[0][II]);
          HSL[1][II] := MaxE(HSLColor[II],HSL[1][II]);
          XYZ[0][II] := MinE(XYZColor[II],XYZ[0][II]);
          XYZ[1][II] := MaxE(XYZColor[II],XYZ[1][II]);
        end;
        For II := 1 to 3 do
          Strings[II] := Strings[II] +Padr(IntToStr  (RGBColor[II]),16) +' | ';
        For II := 4 to 6 do
          Strings[II] := Strings[II] +Padr(FloatToStr(HSLColor[II-3]),16) +' | ';
        For II := 7 to 9 do
          Strings[II] := Strings[II] +Padr(FloatToStr(XYZColor[II-6]),16) +' | ';
      end;
      For I:= 0 to 9 do
        Delete(Strings[i],Length(Strings[i])-2,3);
      For I:= 0 to 9 do
      begin;
        if (I = 1) or (I = 4)or (I = 7)  then Writeln('');
        Writeln(Strings[i]);
      end;
      Writeln('');
      Writeln('Highest RGB values = R: '+ Padr(FloatToStr(RGB[1][1]),3) +  ' | ' +'G: '+ Padr(FloatToStr(RGB[1][2]),3)  +  ' | ' +'B: '+ Padr(FloatToStr(RGB[1][3]),3) );
      Writeln('Lowest  RGB values = R: '+ Padr(FloatToStr(RGB[0][1]),3) +  ' | ' +'G: '+ Padr(FloatToStr(RGB[0][2]),3)  +  ' | ' +'B: '+ Padr(FloatToStr(RGB[0][3]),3) );
      Writeln('Differ  RGB values = R: '+ Padr(IntToStr(RGB[1][1] - RGB[0][1]),3) + ' | G: '+ Padr(inttostr(RGB[1][2] - RGB[0][2]) ,3) + ' | B: '+Padr(inttostr(RGB[1][3] - RGB[0][3]),3));
      Writeln('Middle  RGB values = R: '+ Padr(IntToStr((RGB[1][1] + RGB[0][1]) div 2),3) + ' | G: '+ Padr(inttostr((RGB[1][2] + RGB[0][2]) div 2),3) + ' | B: '+Padr(inttostr((RGB[1][3] + RGB[0][3]) div 2),3));
      Writeln('Middle  RGB color  = '   + IntToStr(RGBToColor((RGB[1][1] + RGB[0][1]) div 2,(RGB[1][2] + RGB[0][2]) div 2,(RGB[1][3] + RGB[0][3]) div 2)));
      Writeln('');
      Writeln('Highest HSL values = H: '+ Padr(FloatToStr(HSL[1][1]),16) +  ' | ' +'S: '+ Padr(FloatToStr(HSL[1][2]),16)  +  ' | ' +'L: '+ Padr(FloatToStr(HSL[1][3]),16) );
      Writeln('Lowest  HSL values = H: '+ Padr(FloatToStr(HSL[0][1]),16) +  ' | ' +'S: '+ Padr(FloatToStr(HSL[0][2]),16)  +  ' | ' +'L: '+ Padr(FloatToStr(HSL[0][3]),16) );
      Writeln('Differ  HSL values = H: '+ Padr(FloatToStr(HSL[1][1] - HSL[0][1]),16) + ' | S: '+ Padr(FloatToStr(HSL[1][2] - HSL[0][2]) ,16) + ' | L: '+Padr(FloatToStr(HSL[1][3] - HSL[0][3]),16));
      Writeln('Middle  HSL values = H: '+ FloatToStr((HSL[1][1] + HSL[0][1]) div 2) + ' | S: '+ FloatToStr((HSL[1][2] + HSL[0][2]) div 2) + ' | L: '+FloatToStr((HSL[1][3] + HSL[0][3]) div 2));
      Writeln('Middle  HSL color  = '   + IntToStr(HSLToColor((HSL[1][1] + HSL[0][1]) div 2,(HSL[1][2] + HSL[0][2]) div 2,(HSL[1][3] + HSL[0][3]) div 2)));
      Writeln('');
      Writeln('Highest XYZ values = X: '+ Padr(FloatToStr(XYZ[1][1]),16) +  ' | ' +'Y: '+ Padr(FloatToStr(XYZ[1][2]),16)  +  ' | ' +'Z: '+ Padr(FloatToStr(XYZ[1][3]),16) );
      Writeln('Lowest  XYZ values = X: '+ Padr(FloatToStr(XYZ[0][1]),16) +  ' | ' +'Y: '+ Padr(FloatToStr(XYZ[0][2]),16)  +  ' | ' +'Z: '+ Padr(FloatToStr(XYZ[0][3]),16) );
      Writeln('Differ  XYZ values = X: '+ Padr(FloatToStr(XYZ[1][1] - XYZ[0][1]),16) + ' | Y: '+ Padr(FloatToStr(XYZ[1][2] - XYZ[0][2]) ,16) + ' | Z: '+Padr(FloatToStr(XYZ[1][3] - XYZ[0][3]),16));
      Writeln('Middle  XYZ values = X: '+ FloatToStr((XYZ[1][1] + XYZ[0][1]) div 2) + ' | Y: '+ FloatToStr((XYZ[1][2] + XYZ[0][2]) div 2) + ' | Z: '+FloatToStr((XYZ[1][3] + XYZ[0][3]) div 2));
      Writeln('Middle  XYZ color  = '   + IntToStr(XYZToColor((XYZ[1][1] + XYZ[0][1]) div 2,(XYZ[1][2] + XYZ[0][2]) div 2,(XYZ[1][3] + XYZ[0][3]) div 2)));
      WritelN('');
    end.

    MR's TPA script should be sufficient to find XYZ values

  5. #5
    Join Date
    Sep 2010
    Posts
    37
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    doh! Sabzi showed be that before and I never bothered running it, just tried looking at it (which was way over my head haha) Thanks!

  6. #6
    Join Date
    Feb 2009
    Location
    Irvine, CA
    Posts
    2,873
    Mentioned
    8 Post(s)
    Quoted
    138 Post(s)

    Default

    Quote Originally Posted by Inspirations View Post
    doh! Sabzi showed be that before and I never bothered running it, just tried looking at it (which was way over my head haha) Thanks!
    haha same here i just know it works =)

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •