Skip to main content

All Questions

Tagged with
0 votes
0 answers
920 views

Convert a SVG to PNG react

I've an SVG image that includes two PNG images that makes them one SVG image, now I want to convert this image into PNG/JPG. I've the following code of SVG in react: import P1 from "../../assets/...
Muhammad Zubair's user avatar
0 votes
1 answer
1k views

Load SVG into canvas to get base64 dataurl

I have this SVG in my html : <svg xmlns="http://www.w3.org/2000/svg" class="bi flex-shrink-0 me-2 green-check" width="24" height="24" role="img" ...
user2360915's user avatar
  • 1,129
0 votes
0 answers
184 views

Is there a way to use a transparent PNG as a path when drawing on a canvas in JavaScript / HTML5?

So what I'm trying to do is draw the outline of a body and fill it in with a user selected color. What I have right now is this initiation of shapes (the second one is iffy): let shapes = [new Path2D('...
Raphael Morgan's user avatar
-1 votes
1 answer
172 views

Convert SVG groups into multiple "individual" PNG files

I have an SVG file containing multiple tags. When loading the file into an HTML canvas, the groups are recognised as separate objects. However, I would like to use javascript / Node to convert each ...
Alien13's user avatar
  • 598
0 votes
0 answers
43 views

SVG/Canvas with background image to png conversion gives black background [duplicate]

I have a svg with background patterns defined using images. To convert this SVG into png and save in disk , I am using canvg to convert first into canvas and into png image as follows: const canvas =...
Sanjay's user avatar
  • 515
0 votes
0 answers
105 views

Downloading an SVG as a PNG at a Specific Size via Javascript

I am trying to set up a generator to let people custom build wallpapers for their phones. At the moment I have them doing the customizing by editing an svg template by changing the colors and text ...
Bobby Grant Jr's user avatar
2 votes
0 answers
666 views

CSS styles not applied to SVG when SVG is rendered on Canvas

I am styling an SVG image using CSS in a separate file. Then I am rendering the SVG onto a canvas that can be saved as a PNG. The SVG receives the CSS styles properly when it is just an SVG element on ...
thecreatorgear's user avatar
0 votes
1 answer
454 views

SVG to PNG in javascript

I have a problem with converting svg to png(base64). Svg to base64 works fine, because it displays just fine in the browser. But when i try to load in the image, it won't load. Anybody might have an ...
Fred Durst's user avatar
0 votes
2 answers
884 views

Javascript canvas.toDataUrl() not encoding properly in Firefox [duplicate]

I'm trying to take an SVG and convert it to an image/png data url. In Chrome 68 it works perfectly, but in Firefox 61 it renders an empty image with the URL of: data:image/png;base64,...
Michael's user avatar
  • 524
0 votes
1 answer
291 views

How do I get the full canvas content (even the hidden ones) with Javascript?

I am currently working on a Javascript project and I am struggling with exporting the entire SVG image on the canvas. So far I've been only able to export the visible part of the canvas, with out the "...
im1tta's user avatar
  • 31
0 votes
0 answers
236 views

JSON to PNG Empty picture

Need help with my function to download a PNG from a SVG. I read many similar post about that but don't succeed to apply to my code. The image that I download is empty ... My code : function ...
user avatar
5 votes
1 answer
3k views

How to Include CSS style when converting svg to png

i've created a simple SVG elment that get dowbloaded to png when clicking on a button, my solution is similiar to here The basic idea is: 1.svg to canvas 2.canvas to dataUrl 3.trigger download from ...
LazyCreep's user avatar
  • 211
1 vote
2 answers
3k views

Convert d3 chart (svg) to an image and display it

Im trying to convert a d3 chart to a png image. I've read many question on SO, which explains how to do it. Capture HTML Canvas as gif/jpg/png/pdf? Basically im trying this, what is mentioned in the ...
lunatikz's user avatar
  • 736
1 vote
1 answer
984 views

height,width and font not consistent when converting svg to png

I am trying to convert svg to png and I found that the converted image is not the same as svg. How can as assure consistency among both svg and png? Code to covert svg to png jQuery('#imgDiv')....
kinkajou's user avatar
  • 3,698
1 vote
1 answer
1k views

SVG to PNG Conversion in javascript

I am working on d3.js charts. I have radar chart that I want to print in PNG format, but when I do conversion it shows nothing and when I save image it saved but totally black or some time gives error ...
Najam-us-Saqib's user avatar

15 30 50 per page