{"action":"created","issue":{"url":"https://api.github.com/repos/mrdoob/three.js/issues/6520","labels_url":"https://api.github.com/repos/mrdoob/three.js/issues/6520/labels{/name}","comments_url":"https://api.github.com/repos/mrdoob/three.js/issues/6520/comments","events_url":"https://api.github.com/repos/mrdoob/three.js/issues/6520/events","html_url":"https://github.com/mrdoob/three.js/issues/6520","id":73967677,"number":6520,"title":"Loading Texture with encoded Data retains previous pixels","user":{"login":"saadfaisal","id":2168025,"avatar_url":"https://avatars.githubusercontent.com/u/2168025?v=3","gravatar_id":"","url":"https://api.github.com/users/saadfaisal","html_url":"https://github.com/saadfaisal","followers_url":"https://api.github.com/users/saadfaisal/followers","following_url":"https://api.github.com/users/saadfaisal/following{/other_user}","gists_url":"https://api.github.com/users/saadfaisal/gists{/gist_id}","starred_url":"https://api.github.com/users/saadfaisal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/saadfaisal/subscriptions","organizations_url":"https://api.github.com/users/saadfaisal/orgs","repos_url":"https://api.github.com/users/saadfaisal/repos","events_url":"https://api.github.com/users/saadfaisal/events{/privacy}","received_events_url":"https://api.github.com/users/saadfaisal/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/mrdoob/three.js/labels/Bug","name":"Bug","color":"ffcfcf"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-05-07T12:25:58Z","updated_at":"2015-05-11T15:27:09Z","closed_at":null,"body":"Hi , this issue is in reference to suggestion made by @mrdoob on #3430.\r\n\r\nHi Everyone , I am doing an svg designer that generates 3D Preview of the design using JSModeler and ofcourse Three.js. I am generating the preview of my design from a standard SVGToPNG solution available all over the web , that uses <canvas> to generate & render the image. The image data comes in as base64 encoded. \r\n\r\nIn order to generate the relevant texture out of my image, i use the approach suggest by @mrdoob which is \r\n````\r\nvar image = document.createElement( 'img' );\r\nvar texture = new THREE.Texture( image );\r\nimage.onload = function()  {\r\n    texture.needsUpdate = true;\r\n        ...\r\n};\r\nimage.src = 'data:image/png;base64,XXXXX';\r\n`````\r\n\r\nhowever as the svg designer, user is free to move around the components on the screen so when the user attempts to preview their changes , they are seeing components that were moved not only on the new location but they also see them on their previous location.Please refer to the image below\r\n\r\n![preview_overlap_issue](https://cloud.githubusercontent.com/assets/2168025/7514900/6257a170-f4db-11e4-9d11-bbf8714a3a69.jpg)\r\n\r\n\r\n\r\nHere you can see that when the user attempts to move around the image , they are seeing a ghosting effect , how can i stop this behavior ?? any ideas ? Here is code that i have written\r\n\r\n````\r\n        var prev_img = $('#preview-img')[0];\r\n        var image = document.createElement( 'img' );\r\n        var mapSprite = new THREE.Texture( image );\r\n                \r\n        image.onload = function() {\r\n            mapSprite.needsUpdate = true;\r\n            var material = new THREE.MeshBasicMaterial( { map: mapSprite, transparent: true } );\r\n            \r\n            var bbox_head = head.geometry.boundingBox;\r\n            \r\n            var w = bbox_head.max.x - bbox_head.min.x;\r\n            var h = bbox_head.max.z - bbox_head.min.z;\r\n            \r\n            var geo1 = new THREE.PlaneGeometry( w, h, 10 , 10 );\r\n            var mesh = new THREE.Mesh( geo1, material);\r\n            mesh.rotateZ(DegToRad(180));\r\n            mesh.rotateX(DegToRad(90));\r\n        }\r\n        \r\n        image.src = $(prev_img).attr('src');\r\n````"},"comment":{"url":"https://api.github.com/repos/mrdoob/three.js/issues/comments/100944673","html_url":"https://github.com/mrdoob/three.js/issues/6520#issuecomment-100944673","issue_url":"https://api.github.com/repos/mrdoob/three.js/issues/6520","id":100944673,"user":{"login":"saadfaisal","id":2168025,"avatar_url":"https://avatars.githubusercontent.com/u/2168025?v=3","gravatar_id":"","url":"https://api.github.com/users/saadfaisal","html_url":"https://github.com/saadfaisal","followers_url":"https://api.github.com/users/saadfaisal/followers","following_url":"https://api.github.com/users/saadfaisal/following{/other_user}","gists_url":"https://api.github.com/users/saadfaisal/gists{/gist_id}","starred_url":"https://api.github.com/users/saadfaisal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/saadfaisal/subscriptions","organizations_url":"https://api.github.com/users/saadfaisal/orgs","repos_url":"https://api.github.com/users/saadfaisal/repos","events_url":"https://api.github.com/users/saadfaisal/events{/privacy}","received_events_url":"https://api.github.com/users/saadfaisal/received_events","type":"User","site_admin":false},"created_at":"2015-05-11T15:27:09Z","updated_at":"2015-05-11T15:27:09Z","body":"Sorry for the delay , however i am still unable to create the fiddle as i am knee deep in the live project. However i have noticed that this happends only with chrome and Firefox doesnt show any such behavior , i will try to create a fiddle as soon as i get sometime."}}