Questions tagged [getimagedata]

a function to access the raw pixel data of HTML5 canvas element.

a function to access the raw pixel data of HTML5 canvas element.

For more information see the MDN documentation of CanvasRenderingContext2D.

211 questions
8
votes
1 answer

javascript memory leak with HTML5 getImageData

I've been working on trying to make some visual effects for a javascript game I'm creating, and I noticed a piece of code that I'm using to modulate the color of my sprites makes my browsers memory usage go up and up, seemingly without limit. You…
zookatron
  • 630
  • 6
  • 9
6
votes
2 answers

HTML5 canvas image caching/putImageData questions

I'm using the HTML5 canvas to load a single instance of an image which I then blit multiple times onto a single canvas. The image needs some slight pixel-based manipulation in order to customise it. My initial plan of attack had been to load the…
ndg
  • 2,585
  • 2
  • 33
  • 58
6
votes
2 answers

Why is a canvas drawn with an image a slightly different color than the image itself?

I am painting an image to a HTML canvas and getting image data from it to find the colors of specific pixels. The image is a map where each country is a different color. I want to cross reference the color returned by .getImageData() to a list of…
obventio56
  • 325
  • 2
  • 12
6
votes
1 answer

javascript memory leak with HTML5 Canvas getImageData in Chrome browser for mac OSX

this problem was fixed in the new chrome version(Version 35.0.1916.114) In chrome for mac osx, CanvasRenderingContext2D#getImageData function will make memory leaks, how can I avoid this problem, here is the test case and result, it's only happened…
6
votes
2 answers

Convert a byte array to image data without canvas

Is it somehow possible to convert an byte array to image data without using canvas? I use currently something like this, however I think that can be done without canvas, or am I wrong? var canvas = document.getElementsByTagName("canvas")[0]; var…
yckart
  • 32,460
  • 9
  • 122
  • 129
6
votes
1 answer

Transparency lost with getImageData - HTML5 2d Context

I noticed a strange problem with getImageData; transparency of the image seems to be ignored when the image data is fetched. Since any image needs to be drawn on to a canvas before its image data can be obtained, I assumed this was a problem with…
Rikonator
  • 1,830
  • 16
  • 27
5
votes
1 answer

Does Flickr support CORS? SECURITY ERROR with getImageData

Hello dear community. I'm trying to create extract colors from images fetched from Flickr. That all works really great to the point when I try to process that images in canvas with getImageData(). As described through WHATWG loading an image into…
user1083071
5
votes
1 answer

What is "colorspace" in imagedata?

Needed to do some pixel manipulation, but ImageData has changed. Now it has a colorSpace property. What is this, and how do I use it as normal? Just get an ImageData object in Chrome to reproduce.
Kriso
  • 165
  • 1
  • 1
  • 10
5
votes
2 answers

Javascript getImageData for canvas html5

I've tearing my hair out! I got this working, thought 'i can afford not to save a version of this', then i .. broke the 'build'. The line myImageData = context.getImageData(0, 0, canvas.width, canvas.height); seems to breaking this, as an alert…
hugh jackson
  • 53
  • 1
  • 1
  • 5
5
votes
0 answers

How to call getImageData() in IE11 without invoking security error?

I draw an image on HTML5 canvas, and the source of the image is an SVG string. Then I getImageData of the canvas, this works well in Firefox and Chrome, but in IE11 it will invoke a security error. I write a simple test page to reproduce my…
slayerxj
  • 273
  • 1
  • 8
5
votes
1 answer

Shape detection javascript canvas

I am doing a web application where i am pulling in an image from an IP camera, and I need to be able to see if there is a car in the parking spot. I wanted to do this using some sort of shape detection but all I can seem to find is face detection…
Dnaso
  • 1,335
  • 4
  • 22
  • 48
5
votes
1 answer

HTML5 Canvas drawing pixels with different color than the one provided

After setting a certain colour as the fillStyle of the canvas and drawing a rectangle with fillRect, the colour of the rectangle sometimes differs a bit from the one provided (the getImageData returns different values - usually one of them is lower…
Konrad Madej
  • 1,271
  • 1
  • 11
  • 19
5
votes
1 answer

Is there a way to get pixel data from Internet Explorer?

Excanvas.js allows IE to work with the canvas tag, but the getImageData method is not supported. Is there any way at all to get the value of a specified pixel in IE (img or VML or whatever other ways bitmaps from a server can be displayed in IE)?…
Nosredna
  • 83,000
  • 15
  • 95
  • 122
4
votes
1 answer

Reconstruct original 16-bit Raw pixel data from the HTML5 canvas

If a 16-bit single channel (Gray-scale) raw pixel data losslessly encoded into Image format(e.g.PNG, Webp , Jpeg-2000 or JPEG-XR) and Image rendered to HTML5 canvas, then is there any way to retrieve original 16-bit Raw pixel data from the canvas?
4
votes
2 answers

getImageData memory leak?

Background: Over the last week I've been working on a game that is essentially multi-directional Tron, using Canvas and JavaScript. I opted not to clear the Canvas every frame so that my little line segments leave a trail. For collision detection, I…
1
2
3
14 15