Oct-08-2023, 03:33 AM
You failed the test. I intentionally left an obvious error. Cannot believe you didn't spot it.
b24 = rgb[:, 0] * 65536 + rgb[:, 1] * 256 + rgb[:, 2]
I don't know how much difference that will make, but it really confused me for a while when I made a test image that was all red, but the primary color wasn't red.
The text file isn't very useful for testing. It is not an image or a pdf, and if I use the text to create an image or a pdf it will probably not be the same image or pdf that you created. Fonts have a lot of different colors. That is how they can have smooth looking edges. I made an image of a PDF page that was all text, and it had thousands of colors even though it was only black text on a white background. Black was the primary color, eking out white by 2%, but together they only made up 60% of the colors.
b24 = rgb[:, 0] * 65535 + rgb[:, 1] * 256 + rgb[:, 2]should be
b24 = rgb[:, 0] * 65536 + rgb[:, 1] * 256 + rgb[:, 2]
I don't know how much difference that will make, but it really confused me for a while when I made a test image that was all red, but the primary color wasn't red.
The text file isn't very useful for testing. It is not an image or a pdf, and if I use the text to create an image or a pdf it will probably not be the same image or pdf that you created. Fonts have a lot of different colors. That is how they can have smooth looking edges. I made an image of a PDF page that was all text, and it had thousands of colors even though it was only black text on a white background. Black was the primary color, eking out white by 2%, but together they only made up 60% of the colors.