Cloudflare Images can do this out of the box. However to make it even easier, use the Image component from this package: https://github.com/keyute/cloudflare-image
And make sure to enable Cloudflare Images for the zone your worker is in.
You can pass any URL to an image to the component and it will transform it in such a way that the image gets downloaded to the Cloudflare CDN - visitors to your website will get served from there.