A pixel is the smallest unit that can be represented or controlled on a display. The word pixel is derived from the phrase "picture element".
Questions tagged [pixel]
4067 questions
12
votes
5 answers
putImageData(), how to keep old pixels if new pixels are transparent?
In html5, when you draw to a canvas using putImageData(), if some of the pixels you are drawing are transparent (or semi-transparent), how do you keep old pixels in the canvas unaffected?
example:
var imgData =…

Mohsin
- 513
- 1
- 5
- 12
12
votes
2 answers
How does the CPU interact with the monitor?
So the question is: How does a computer go from binary code representing the letter "g" to the correct combination of pixel illuminations?
Here is what I have managed to figure out so far. I understand how the CPU takes the input generated by the…

Jean-Luc Thumm
- 145
- 1
- 1
- 4
12
votes
4 answers
Rotating a 2D pixel array by 90 degrees
I have an array of pixel data for an image. The image I am getting is already rotated to 270 degrees. So I am trying to rotate it again by 90 degrees to have the correct image. I've tried a transpose algorithm, by changing data[x][y] to data[y][x],…

0xC0DED00D
- 19,522
- 20
- 117
- 184
12
votes
2 answers
javascript ImageData typed array read whole pixel?
So there is are a lot of examples on how to write an entire pixel from a Uint32Array view of the ImageData object. But is it possible to read an entire pixel without incrementing the counter 4 times? From hacks.mozilla.org, writing an rgba pixels…

leeoniya
- 1,071
- 1
- 9
- 25
12
votes
4 answers
CALayer drawInContext can't draw 1px lines on retina displays
I want to draw double colored line with 1px lines of 2 different colors.
I have a lot of code so I'm putting it after trying to explain.
If I use uiview drawRect method it works fine when I switch off antialiasing but when I use layer's…

Knshiro
- 231
- 2
- 11
11
votes
1 answer
How do I force a web page to ALWAYS be rendered with a pixel ratio of 1.0 (not 1.5) on iPhones and Androids?
For example, by default, iPhones and Androids will automatically zoom the page to attempt to make it fit nicely in the frame if no viewport meta tag exists. Web sites designed for desktops will be zoomed out so they fit inside the small viewport,…

trusktr
- 44,284
- 53
- 191
- 263
11
votes
2 answers
Java fast pixel operations
I would like to know how I would handle pixel operations best in Java. I'm using swing and drawing a rectangle of 1 by 1 pixel is terribly slow. I need to get 60 fps at least, without using too much resources. Would blitting to an image first mean…

RobotRock
- 4,211
- 6
- 46
- 86
11
votes
5 answers
How do I read pixels from a PNG file?
I know how to capture a screenshot by using Robot, Windowtester or FEST. I also know how to read a pixel from the screen by using robot.
int x = 10;
int y = 10;
Color px = getPixelColor(int x, int y);
However, I don't know how to read a pixel from…
user793623
11
votes
4 answers
Access to hardware pixels on mobile devices
Information to clarify the terminology from here.
Hardware pixel: A physical pixel on the display. For example, an iPhone 5 has a screen with 640 horizontal hardware pixels.
Device-independent pixel (dip): A scaling of device pixels to match a…

Mark
- 563
- 4
- 18
11
votes
2 answers
Understanding image (its hex values)
I am trying to understand the hex values of a 10 x 10 pixel png image file.
For example: I am using this image http://www.sweethome3d.com/blog/common/images/feed-icon-10x10.png?. I opened it in Sublime Text 2 and saw following values
8950 4e47 0d0a…

stuartnox
- 649
- 1
- 6
- 15
11
votes
2 answers
How do browsers convert a point-based font-size to pixels?
If a browser has to deal with the following CSS:
font-size: 12pt;,
how does it calculate the effective size on the screen? Can it know the dpi's of the screen (via some OS function) or is it just an approximation?
If it is an approximation - is it…

Teetrinker
- 850
- 1
- 15
- 30
11
votes
3 answers
Handling alpha channel in WPF pixel shader effect
Is there something unusual about how the alpha component is handled in a pixel shader? I have a WPF application for which my artist is giving me grayscale images to use as backgrounds, and the application colorizes those images according to the…

vanmelle
- 1,605
- 1
- 14
- 22
11
votes
1 answer
How to load a pixel struct into an SSE register?
I have a struct of 8-bit pixel data:
struct __attribute__((aligned(4))) pixels {
char r;
char g;
char b;
char a;
}
I want to use SSE instructions to calculate certain things on these pixels (namely, a Paeth transformation). How can…

fuz
- 88,405
- 25
- 200
- 352
11
votes
2 answers
iOS: Get pixel-by-pixel data from camera
I'm aware of AVFoundation and its capture support (not too familiar though). However, I don't see any readily-accessible API to get pixel-by-pixel data (RGB-per-pixel or similar). I do recall reading in the docs that this is possible, but I don't…

FeifanZ
- 16,250
- 7
- 45
- 84
11
votes
1 answer
Web Design for Smart Phone - Pixel Size
I need someone to help clarify my understanding regarding pixel size on new phones with high density screens. Since, it's throwing a curve ball into my web design.
My initial understanding about smartphones was that the pixel size was roughly 480 x…

jstacks
- 2,437
- 8
- 32
- 48