add banbanmini
This commit is contained in:
14
banban-mini/svg2png.js
Normal file
14
banban-mini/svg2png.js
Normal file
@@ -0,0 +1,14 @@
|
||||
const sharp = require('sharp');
|
||||
const fs = require('fs');
|
||||
|
||||
(async () => {
|
||||
const svgData = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M19.14 12.94C19.18 12.64 19.2 12.33 19.2 12C19.2 11.67 19.18 11.36 19.14 11.06L21.17 9.48C21.35 9.34 21.4 9.07 21.29 8.87L19.37 5.55C19.25 5.33 19 5.26 18.78 5.33L16.39 6.29C15.89 5.91 15.36 5.59 14.77 5.35L14.41 2.81C14.37 2.57 14.17 2.4 13.93 2.4H10.09C9.85 2.4 9.65 2.57 9.61 2.81L9.25 5.35C8.66 5.59 8.13 5.92 7.63 6.29L5.24 5.33C5.02 5.25 4.77 5.32 4.65 5.55L2.73 8.87C2.62 9.08 2.67 9.34 2.85 9.48L4.88 11.06C4.84 11.36 4.82 11.67 4.82 12C4.82 12.33 4.84 12.64 4.88 12.94L2.85 14.52C2.67 14.66 2.62 14.93 2.73 15.13L4.65 18.45C4.77 18.67 5.02 18.74 5.24 18.67L7.63 17.71C8.13 18.09 8.66 18.41 9.25 18.65L9.61 21.19C9.65 21.43 9.85 21.6 10.09 21.6H13.93C14.17 21.6 14.37 21.43 14.41 21.19L14.77 18.65C15.36 18.41 15.89 18.08 16.39 17.71L18.78 18.67C19 18.75 19.25 18.68 19.37 18.45L21.29 15.13C21.4 14.92 21.35 14.66 21.17 14.52L19.14 12.94ZM12 15.6C10.01 15.6 8.4 13.99 8.4 12C8.4 10.01 10.01 8.4 12 8.4C13.99 8.4 15.6 10.01 15.6 12C15.6 13.99 13.99 15.6 12 15.6Z" fill="#9CA3AF"/>
|
||||
</svg>`;
|
||||
|
||||
await sharp(Buffer.from(svgData))
|
||||
.png()
|
||||
.toFile('gear.png');
|
||||
|
||||
console.log('SVG 转成 PNG 完成: gear.png');
|
||||
})();
|
||||
Reference in New Issue
Block a user