Export any DOM element to a PNG download — exportElementAsPng from src/lib/png-export.js
png-export dynamically imports html2canvas at runtime.
If it is not installed the function will throw with a clear error message.npm install html2canvasClick "Export as PNG" to capture the card below and download it as a file. Open the browser's Network tab to confirm html2canvas loaded from CDN.
アイウエオ · Neural core stability: 42%
// Install peer dep first: npm install html2canvas
import { exportElementAsPng } from '@whykusanagi/corrupted-theme/png-export';
const el = document.getElementById('my-card');
// Default: scale=2, transparent background, filename="export.png"
await exportElementAsPng(el);
// With options
await exportElementAsPng(el, {
filename: 'corrupted-card.png',
scale: 3, // 3× resolution for retina
backgroundColor: '#000000', // null = transparent
});