How to convert canvas json to base64image? - node.js

This functionality I need in server side(nodejs)
I have installed canvas 2.2.0 version and in this I m unable to use loadFromJSON function.
But when I am using fabric and its canvas then this working fine.
I have changed from Fabric canvas to canvas because unable to change/set custom font in that
With the canvas 2.2.0 version, I am able to change or set custom fonts. But now I am anable to convert json data to base64image.
Any help would be appreciated.
Thanks in advance

Related

How to swtich image in phaser js?

How to swtich image in phaser js?
I change profile image but its showing still same but when reload the game image has been changed
With the little details you provided, I think you're looking for Image.setTexture(key: string). This method will set the texture used by an image GameObject to that of "key".

Is the possible to load PPT/PPTX (powerpoint) file into FabricJS canvas?

I'm trying to implement some editing tool using canvas with FabricJS.
Is there any existing javascript library can extract from PPT/PPTX content and convert to canvas compatible object.

Python docx image rendering using docx template library

I am trying to render a image to a docx template which has a jinja hook in it.
I am using inlineImage method from docx template using this I was able to render image it is opening in libreoffice writer but not in msword where it should be really using.
In msword a image is rendered but not shown just a blank area is shown.
I do even tried using the subdoc method it is also giving me same results.
Please do help me understand what am doing wrong.
I am using python-docx 0.8.7 and docxtemplate 0.5.17 library to achieve the result
I am bound to use these versions since docxtemplate enforced to use this version of python-docx
I am posting this as an answer so that it may help others trying to achieve the same.
In my code i was using NamedTemporaryFile(delete=None) to create the image before I pass the value to inlineimage as InlineImage(template, tmpfile.name) Which was causing the Issue , I remodelled my logic to directly add the image after doing some resize based on image aspect ratio and send the path of the image instead of filename into the InlineImage method and it worked like a charm.

Fabricjs v2.4.1 loadFromJSON generated from v1.7.17 image scaling issues

I've a JSON object that defines an image on the canvas like so:
The JSON was created from Fabricjs version 1.7.17 and I'm loading that JSON into a canvas made from Fabricjs versions 2.3.6 & 2.4.1 and this is what the image looks like:
The canvas sizes are the same and the options for the canvas are the same. The JSON loads just fine in the 1.7.17 version. All the other objects from the JSON data load fine, the image box is the right width/height and placement (left & top)...it's just the image isn't scaled to fit.
I've tried setting the scaleX/Y, resize filters to no avail - anyone tackle this issue already?
Fabric 2.0 changed the way that height/width attributes are handled for images in order to support cropping. You'll find an explanation and example code for dealing with this here:
http://fabricjs.com/v2-breaking-changes#image

Weird results when converting SVG to js for Raphael

Im trying to use this image with Raphael:
http://upload.wikimedia.org/wikipedia/commons/9/9f/Argentina_Buenos_Aires_City_location_map.svg
I convert it to js with: http://toki-woki.net/p/SVG2RaphaelJS/
And I get this:
Any Idea of what can I do to solve this? This is worst apparently when I add text in inkscape above each reagion to change later via javascript.
Im using SVGWEB now without problems buy Im trying another alternatives because I cannot make the addeventlistener work in IE7/8 like I said here:
can't add listener to a SVG in Internet Explorer using SVGweb
Any ideas?
Thanks!
Try mapSVG plugin instead.
Demo with your map: http://map.karaliki.ru/bu.html (zoom in-out with mouse wheel)
It works in IE7-8 as well.
Plugin's description: http://map.karaliki.ru

Resources