Comments (3)
sudo apt-get install libcairo2-dev libjpeg-dev libpango1.0-dev libgif-dev build-essential g++
npm i --save canvas
var Canvas = require('canvas')
, Image = Canvas.Image
, canvas = new Canvas(200, 200)
, ctx = canvas.getContext('2d');
const crypto = require('crypto');
const getSHA1ofJSON = function(input){
return crypto.createHash('sha1').update(JSON.stringify(input)).digest('hex')
}
const x = getSHA1ofJSON({'this':'too'})
// sha1 always 40 chars long
console.log('sha1 is', x);
ctx.font = '30px Impact';
ctx.rotate(.1);
ctx.fillText("Awesome!", 50, 100);
var te = ctx.measureText('Awesome!');
ctx.strokeStyle = 'rgba(0,0,0,0.5)';
ctx.beginPath();
ctx.lineTo(50, 102);
ctx.lineTo(50 + te.width, 102);
ctx.stroke();
//console.log('<img src="' + canvas.toDataURL() + '" />');
var base64Data = canvas.toDataURL().replace(/^data:image\/png;base64,/, "");
require("fs").writeFile("out.png", base64Data, 'base64', function(err) {
console.log(err);
});
from mdworld-jackson.
from mdworld-jackson.
Also for retro post json
from mdworld-jackson.
Related Issues (20)
- Merge medium.com & local posts
- mypc component
- Convert posts
- Sort posts by date
- Add a 404 page
- Fix performance
- Serverless functions
- Custom domain with HTTPS HOT 4
- pwa HOT 1
- Hero logo as Canvas
- Run JS in a MD post HOT 4
- Custom font "Delicious" in Hero HOT 1
- Redirect lift subdomain HOT 3
- Do not set ./cover/image.png as path
- Cancel and move hosting
- 404 redirect loop HOT 2
- Images not loading
- Order of the posts in Previous/Next is off
- Use Sentry
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mdworld-jackson.