Hello I was wondering if anyone knew how to apply filters on an image using sharpjs(preferably) or any image processing lib with a nodejs SDK using only a colorMatrix. The two inputs I have are the input image and the 4 x 5 color matrix and I want to transform the input image using the color matrix. For context, I can do transformations in the web browser canvas API using feColorMatrix tag but I want to actually manipulate the image on the backend now. Has anyone got any experience with this?
Related
In my project, I need a way to interactively draw multiple bounding boxes in an image when displayed inside a web browser. When the bounding boxes are drawn, I need to read out their coordinates. Can somebody propose a javascript library that can handle this task? I have no experience with frontend technologies like React or Angular and only have experiences with plain javascript.
This answer tells you how to draw boxes: https://stackoverflow.com/a/65376701/6469130
Either:
you should have the image drawn to the overlay canvas or
you should have an image element beneath the canvas as in this answer
What you need to add is storing the coordinates in handleMouseUp(). Logging example:
console.log(prevStartX, prevStartY, prevWidth, prevHeight);
I'm working on a php project.
I'm provided with some data like race,height,weight,martial status,etc.
Based on these inputs, I want to draw a vector image, which can be a svg or any format.
Is it possible to do so? If it is possible, how can I do that?
I can't put some set of images and use them according to the data as, i have very huge data.
I want to draw a vector image dynamically based on the data.
Please help.
I'm making a game for a school project, and we have been tasked to create a game using the HappyFunTimes plugin for Unity. For the game my group is making, we need to generate a random sprite image in a C# script in Unity, and get the sprite to display in the upper middle of the phone's controller screen. Unfortunately, at this point in my education I'm only familiar with C# so I'm having trouble working through the HappyFunTimes's game-pad code. Any help would be appreciated.
I don't know how to generate an image in Unity. I know last time I checked there was no easy 2D API for direct rendering (as in draw a line, draw a rectangle, draw a circle, etc...)
You can render a scene to a texture though, see render texture, render to it, and then get the data out.
Or if you could just create an array and set values if it's a small image. (for example the gravatar images here on SO or a QR code).
Once you have the data you'd need to base64 encode it there should be some C# functions to do that. Then you can send it to the phone. On the phone you'd need to decode it, put it in an ImageData then you can copy it into a canvas with putImageData
You can then either display that canvas as is, OR, use it to draw into another canvas, OR, generate a dataURL for an image. All of that will have to be in JavaScript/HTML/CSS not C#
... although you could make C# send a dataURL directly and skip the decoding, imagedata, and canvas parts. Just assign the image's src property to the dataURL
So basically I have use SVG/javascript/PHP so that when a user clicks on a PNG image it takes the coordinates and uses these to plot a small black square on the PNG image, it's really very simple.
However, I was wondering if it's possible if you have the PNG in tags within the SVG element, and the filled square on top of the PNG image (made using SVG 'rect'), to save this as 1 single PNG?
You should probably go through a simple canvas tutorial. I suggest checking the Mozilla (mdn) tutorials. Canvas isn't very hard to work with. For a quick idea of what you will need, check out this tutorial about drawing a rectange and to save the image you can access the canvasElement.toDataURL() method to get a base64 encoded string of the image on the canvas. To save to user you can location.href=dataURL; or post it to a sever using ajax.
I have an image on my canvas . the canvas is annotated with text on top of the image. I wrote the text using canvas.fillText(). How do i save this text to the google chrome cache. I can use HTML5 or js.
You have to save the text in variables as you write it on to the canvas. The canvas element does not retain the internal structure of what you've written on to it, once something is drawn it's just pixels, the only way to get it back would be to implement some sort of OCR in JavaScript.
If you want to retain the structure of the elements you're adding to a dynamic picture then use SVG instead.