Get started with psd.js CDN

MIT licensed

PSD.js: Lightweight library for converting, manipulating PSDs in web apps.

Tags:
  • images
  • psd
  • parser
  • node

Stable version

Copied!

How to start using psd.js CDN


<!DOCTYPE html>
<html>
<head>
    <title>Get started with psd.js CDN - cdnhub.io</title>
    <script src="https://cdn.cdnhub.io/psd.js/3.4.0/psd.min.js"></script>
</head>
<body>
    <script>
        async function loadPSD(filePath) {
            const psdFile = new PSDFile();
            await psdFile.load(filePath);
            return psdFile;
        }

        async function main() {
            const psdFile = await loadPSD('example.psd');
            console.log('Loaded PSD file:', psdFile);

            const imageData = psdFile.getImageData();
            const canvas = document.createElement('canvas');
            canvas.width = imageData.width;
            canvas.height = imageData.height;
            const ctx = canvas.getContext('2d');
            ctx.putImageData(imageData, 0, 0);

            document.body.appendChild(canvas);
        }

        main();
    </script>
</body>
</html>
Copied!
Copied!
Copied!

All versions