getimagedata

Render .pdf to single Canvas using pdf.js and ImageData

孤人 提交于 2019-11-28 18:26:52
I am trying to read an entire .pdf Document using PDF.js and then render all the pages on a single canvas. My idea: render each page onto a canvas and get the ImageData (context.getImageData()), clear the canvas do the next page. I store all the ImageDatas in an array and once all pages are in there I want to put all the ImageDatas from the array onto a single canvas. var pdf = null; PDFJS.disableWorker = true; var pages = new Array(); //Prepare some things var canvas = document.getElementById('cv'); var context = canvas.getContext('2d'); var scale = 1.5; PDFJS.getDocument(url).then(function

Render .pdf to single Canvas using pdf.js and ImageData

你。 提交于 2019-11-27 11:34:20
问题 I am trying to read an entire .pdf Document using PDF.js and then render all the pages on a single canvas. My idea: render each page onto a canvas and get the ImageData (context.getImageData()), clear the canvas do the next page. I store all the ImageDatas in an array and once all pages are in there I want to put all the ImageDatas from the array onto a single canvas. var pdf = null; PDFJS.disableWorker = true; var pages = new Array(); //Prepare some things var canvas = document

How to scale an imageData in HTML canvas?

一曲冷凌霜 提交于 2019-11-27 07:14:58
I have a canvas in my webpage; I create a new Image data in this canvas then I modify some pixel through myImgData.data[] array. Now I would like to scale this image and make it bigger. I tried by scaling the context but the image remains small. Is it possible to do this? Thanks You could draw the imageData to a new canvas, scale the original canvas and then draw the new canvas to the original canvas. Something like this should work: var imageData = context.getImageData(0, 0, 100, 100); var newCanvas = $("<canvas>") .attr("width", imageData.width) .attr("height", imageData.height)[0];

SECURITY_ERR: DOM Exception 18 on using getImageData in a Chrome Extension

五迷三道 提交于 2019-11-26 22:54:38
问题 I'm writing my first Chrome extension. I'm trying to use jQuery and the jQuery Image Desaturate plugin to desaturate an image on a page on http://www.flickr.com. I'm loading my script (and jQuery and the plugin) programatically in my background.html: // On browser action click, we load jQuery and the desaturate plugin, then // call our own flickrnoir.js to desaturate the photo. chrome.browserAction.onClicked.addListener(function(tab) { chrome.tabs.executeScript(null, { file: "jquery.js" },

How to scale an imageData in HTML canvas?

风流意气都作罢 提交于 2019-11-26 13:06:16
问题 I have a canvas in my webpage; I create a new Image data in this canvas then I modify some pixel through myImgData.data[] array. Now I would like to scale this image and make it bigger. I tried by scaling the context but the image remains small. Is it possible to do this? Thanks 回答1: You could draw the imageData to a new canvas, scale the original canvas and then draw the new canvas to the original canvas. Something like this should work: var imageData = context.getImageData(0, 0, 100, 100);

Android get image from gallery into ImageView

℡╲_俬逩灬. 提交于 2019-11-26 12:14:06
I'm trying to add a photo from galery to a ImageView but I get this error: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=1, result=-1, data=Intent { dat=content://media/external/images/media/1 }} to activity {hotMetter.pack/hotMetter.pack.GetPhoto}: java.lang.NullPointerException This is my code: Intent intent = new Intent(); intent.setType("image/*"); intent.setAction(Intent.ACTION_GET_CONTENT); startActivityForResult(Intent.createChooser(intent,"Select Picture"), SELECT_PICTURE); } Bitmap bitmap=null; public void onActivityResult(int requestCode, int

Android get image from gallery into ImageView

若如初见. 提交于 2019-11-26 02:33:25
问题 I\'m trying to add a photo from galery to a ImageView but I get this error: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=1, result=-1, data=Intent { dat=content://media/external/images/media/1 }} to activity {hotMetter.pack/hotMetter.pack.GetPhoto}: java.lang.NullPointerException This is my code: Intent intent = new Intent(); intent.setType(\"image/*\"); intent.setAction(Intent.ACTION_GET_CONTENT); startActivityForResult(Intent.createChooser(intent,\

Get pixel color from canvas, on mouseover

房东的猫 提交于 2019-11-25 23:44:28
问题 Is it possible to get the RGB value pixel under the mouse? Is there a complete example of this? Here\'s what I have so far: <script> function draw() { var ctx = document.getElementById(\'canvas\').getContext(\'2d\'); var img = new Image(); img.src = \'Your URL\'; img.onload = function(){ ctx.drawImage(img,0,0); }; canvas.onmousemove = function(e) { var mouseX, mouseY; if(e.offsetX) { mouseX = e.offsetX; mouseY = e.offsetY; } else if(e.layerX) { mouseX = e.layerX; mouseY = e.layerY; } var c =