0

Well I am using the image functions to draw pixels on an image file using PHP. The problem is that when for instance I draw a black pixel and right next to it a white pixel and than again a black pixel the white pixel will get faded! It will go grey or something. I really want precision!

4
Contributors
6
Replies
7
Views
6 Years
Discussion Span
Last Post by metalix
0

It would help if you'd show your code. :)

well I guess something like that...

<?php 
$x=0;
while($x<300)
{
imageline($img,$x,0,$x,50,$red);
$x=$x+2;
}
?>

assume that I have already got img and $red color

0

Assuming that you are correctly displaying a white pixel, you might be pushing the limits of the monitor or more likely the human eye. You may need something larger than a single pixel in order to have the color clearly distinguished. I'm not a physics expert but remember than a monitor creates (the illusion of) a whole variety of colors through combinations of red, green and blue dots. The human eye interprets the different combinations as other colors instead of red, green and blue. If you make the dots much bigger, then you start to see them as the three prime colors again. With a white pixel (actually red, green and blue) on a black background, the eye is probably doing some interpretation. If you were to use a magnifying glass to look at the pixel, it might then appear to be more white than gray.

0

I just tried the code like you posted and I can't reproduce your problem apart from a little JPEG-encoding (~1 fluctuation e.g. 255 -> 254).
Maybe your screen is playing tricks on you?

0

What I did exactly was to compare every pixel r,b,g and if it was above 100 I would turn it into a white, and if it was below or equal to 100 i would turn it into black. Now when I displayed the image I could see something like noise on some parts of the image,pixels that were something in between black and white. I saved the image from browser, I opened photoshop I focused in, I clearly saw that these pixels were neither black nor white, I took the "color copier" tool, I selected the pixels and they were grey. No illusions at all!

0

It' seems the php is interpolating the image, is the colour in photoshop #808080?
We all can't seem to re-create your problem, but maybe check your php file-system/ini file

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.