ColorDialog returns incorrect colour values

0

I have a ColorDialog box which I use to set a precise colour: Red:20; Green:133; Blue:116. (All decimal values) I create a bit map with this colour in my app, and save it as a bitmap. When I view the bitmap in a graphics program, it records the colour values as decimal Red:32; Green:132; Blue:114. The difference is subtle, but discernible when the bitmap is placed onto the background of the desired colour. When I relaunch the app, the ColorDialog box says the colours are as I wanted (red:20 etc). Why should D10 report one set of values, when they appear to be different? Is there anything significant in 20 (which I enter as a decimal number) being 32 if it was a hex number? (I don't think so, as I tried setting red:14 (if hex, then decimal=20) but the graphics program reported the colour as decimal 28).

P.s. this is my 4th question, and since I have had no reply to the previous three, I am thinking that perhaps being unregistered means no-one can reply to me? Or my questions are considered stupid.

 

I am using D10 on Windows 10.

  • Accepted Answer

    Thursday, July 13 2017, 01:31 AM - #Permalink
    0

    Hi Registered U32173,

    Firstly: It is possible for other people to reply.

    Secondly: the only stupid question is one which is not asked.

    First guess: The problem is perhaps a limitation of your "graphics program". Or your graphics display hardware. A good test would be to create a bit map using delphi with sections that have red = 20 and sections that have red = 32 - both with green = 132 and blue = 114 and confirm that you can see the difference with when the bit map is viewed using your delphi app. Then open the same bit map in your graphics program and confirm that the two areas have been made the same. 

    Then try opening the bit map in other graphics programs (or the same graphics program on a different PC).

    Are you using VCL or FireMonkey?

    Are you compiling for a Windows target, if so Win32 or 64bit? - Does it make any difference if you compile for the opposite to your current test?

    Regards Roger

     

    The reply is currently minimized Show
  • Responses (1)
    • Accepted Answer

      Thursday, July 13 2017, 05:52 AM - #Permalink
      0

      Hi Roger,

      Many thanks for your reply!

      I was using PSPX8 (fairly modern) to open the bitmap and check the colour values. I tried opening the bitmap in PSP4 (c.1996) but it says it is not a valid bitmap. I don't have anything else I can open it with to check the colour value.

      I am using the VCL. So as an example case, I selected the "teal" sort of colour preset, which gives "r:64 g:128 b:128". The slider on the right hand side of the box is a little lower than halfway. Using this colour in my bitmap, when I save it and load it into PSPX8, it reports a colour value: "r:68 g:127 b:127".

      I have always been a little suspicious of PSPX8. I had all sorts of problems (which were never resolved) when I first bought it. I was given two fixes for every problem I reported: 1) Reinstall 2) Change your windows settings. I wasn't prepared to do the latter when it was only PSPX8 giving me trouble, and I got fed up doing the former, which never changed a thing. I have therefore downloaded Gimp, loaded this last image, and it reports "r:64 g:128 b:128", i.e. as per Delphi. So my problem is NOT Delphi, but a supposedly top class graphics program being unable to identify colour values correctly. Genius.

      I am very sorry to have bothered you guys with this, I should have known better than to use PSPX8 for absolutely anything. But your answer has at least explained this problem that was driving me mad!

      Graham

      The reply is currently minimized Show
    Your Reply

    Please login to post a reply