Questions tagged [pixel-manipulation]
54 questions
21
votes
4 answers
Why is setting HTML5's CanvasPixelArray values ridiculously slow and how can I do it faster?
I am trying to do some dynamic visual effects using the HTML 5 canvas' pixel manipulation, but I am running into a problem where setting pixels in the CanvasPixelArray is ridiculously slow.
For example if I have code like:
imageData =…

Nixuz
- 3,439
- 4
- 39
- 44
14
votes
1 answer
How do you simply obtain an array of pixel data from an image?
Thank you all for responding. I should have been more specific with my question. I looked at a number of examples, but here is the one from W3 Schools (thank you @Pointy for pointing out that this is not a source one should rely on - no pun…

Jackmc1047
- 391
- 2
- 5
- 12
5
votes
3 answers
Javascript imageData returns array of 0's
I am trying to manipulate imageData but my imageData array returns all 0's after I load up the image and get its pixel data.
There are a few html elements like sliders and text boxes. Please ignore those.
There is an ImageObject data structure…

Htlcs
- 545
- 3
- 13
- 26
4
votes
3 answers
Draw saturation/brightness gradient
I'm trying to draw the following gradient image in canvas, but there's a problem in the right bottom.
Desired effect:
Current output:
I'm probably missing something really simple here.
function color(r, g, b) {
var args =…

akinuri
- 10,690
- 10
- 65
- 102
4
votes
0 answers
Qt: What is the most scalable way to iterate over a QImage?
I'm aware of two methods in order to access to all the pixels in a QImage called img.
Method 1
for (int y = 0; y < img.height(); y++) {
QRgb *line = (QRgb *) img.scanline(y);
for (int x = 0; x < img.width(); x++) {
// line[x] has an…

logo_writer
- 283
- 2
- 10
4
votes
1 answer
Optimizing setting of pixels in HTML5 canvas
The HTML5 Canvas has no method for explicitly setting a single pixel.
The solution I know so far is :
use getImageData and putImageData but the efficiency is too low for animation
due to the low performance of putImageData
use heavy object like…

Hentold
- 853
- 7
- 11
3
votes
1 answer
Android image sharpening, saturation, hue, brightness, and contrast
I'm trying to create an app that will allow me to adjust the hue, saturation, brightness, contrast, and sharpness of an image by adjusting the seekbars for each of the above fields.
like at…

mna
- 101
- 1
- 3
- 7
2
votes
2 answers
How to set QImage pixel colour for an RGB888 image in Qt
I have an RGB888 format qImage defined as follows:
myQrgb = QImage(img_in, width, height, QImage::Format_RGB888);
I wish to alter specific pixel values, so I followed the example here, like so:
QRgb value = qRgb(0, 0, 0);
myQrgb.setPixel(i, j,…

Bill Cheatham
- 11,396
- 17
- 69
- 104
2
votes
2 answers
Buffered image pixel manipulation
I have this code:
public Image toNegative()
{
int imageWidth = originalImage.getWidth();
int imageHeight = originalImage.getHeight();
int [] rgb = null; // new int[imageWidth * imageWidth];
originalImage.getRGB(0, 0, imageWidth,…

Lukasz Madon
- 14,664
- 14
- 64
- 108
2
votes
1 answer
HTML5 canvas putImageData seems to mess with pixels not getting expected results
I am trying to draw an isometric square with some custom code to build the pixel data up and then put it on a canvas with putImageData.
But I'm not getting the expected results, after a quick look through the raw pixel data of the canvas it seems…

Tristan
- 3,845
- 5
- 35
- 58
2
votes
1 answer
Addition leads to `MethodError: no method matching +(::Array{Int64, 0}, ::Int64)`
I'm using Julia, and I tried to test out a function that creates an image and assigns Red values based on the string given. Just from hearing that sentence I'm sure you can think of a million things I could have done to receive an error message, but…

Raphael Morgan
- 190
- 15
2
votes
1 answer
how to find xy coordinate of pixel in pixel array from android bitmap
i have an int array derived from a bitmap using the Bitmap.getPixels() method. This method populates the array with the pixels from the Bitmap. How can i get the xy coordinate of each pixel when i loop through that array? thanks in advance…

turtleboy
- 8,210
- 27
- 100
- 199
2
votes
1 answer
Can't draw a line on the canvas
I am having trouble drawing a line on the HTML canvas with JavaScript. For the record, I don't want to use any pre-written line-drawing methods, I need to do it using pixel manipulation. I tried drawing a line on a 500x500 pixel canvas that I…

Bill Bllson
- 179
- 1
- 1
- 14
2
votes
2 answers
can't get pixels[] from an PImage in processing js
i've been trying to run the following code using processing.js however it just gets me a grey window. I think it's because its not accessing correctly to the image pixels[].
PImage img;
void setup() { // this is run once.
size(600, 400);
…

JosRego
- 51
- 2
2
votes
2 answers
UIImage RBG Values Change when Saved to Device Library
I am working on a project that requires image pixel manipulation. What I am doing now is using UIImagePicker to receive a UIImage from the devices library. I then convert it to a CGImage, get the RBG values and change them slightly.
I then convert…

Firo
- 15,448
- 3
- 54
- 74