Can I obtain Image width / height from a cloudflare worker?

Is there an API on the workers I can use to obtain the image height and width?

As far as I understand I cannot use the web platform to obtain an image height and width on a Cloudflare worker.

Example using the web platform APIs
        const img = new Image();
        const url = URL.createObjectURL(imageBlob);

        img.onload = () => {
            resolve({
                width: img.width,
                height: img.height
            });
            URL.revokeObjectURL(url);  // Clean up after loading the image
        };

        img.onerror = () => {
URL.revokeObjectURL(url);
        };

        img.src = url;
Was this page helpful?