© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Cloudflare DevelopersCD
Cloudflare Developers•2y ago•
5 replies
sakura

Image Transformation not working

I have a worker that makes fetch calls with resizing options using the following code. But the image doesn't actually get resized. The headers contain
cf-cache-status: HIT
cf-cache-status: HIT
but not
Cf-Resized
Cf-Resized
as I expected based on the docs - https://developers.cloudflare.com/images/reference/troubleshooting

What am I doing wrong?

const response = await fetch(url, {
          cf: {
            image: {
              height: 512,
              width: 512,
            },
          },
        })
        const arrayBuffer = await response.arrayBuffer()
        const headers = response.headers
        // Log each header
        for (const [key, value] of headers.entries()) {
          console.log(`${key}: ${value}`)
        }
        const rawLargeBase64 = Buffer.from(arrayBuffer).toString("base64")
        rawResizedImageSize = rawLargeBase64.length
        console.log(`Raw image size for ${url}:`, rawResizedImageSize)
const response = await fetch(url, {
          cf: {
            image: {
              height: 512,
              width: 512,
            },
          },
        })
        const arrayBuffer = await response.arrayBuffer()
        const headers = response.headers
        // Log each header
        for (const [key, value] of headers.entries()) {
          console.log(`${key}: ${value}`)
        }
        const rawLargeBase64 = Buffer.from(arrayBuffer).toString("base64")
        rawResizedImageSize = rawLargeBase64.length
        console.log(`Raw image size for ${url}:`, rawResizedImageSize)
Cloudflare Docs
Troubleshooting | Image Resizing · Cloudflare Image Optimization docs
Does the response have a Cf-Resized header? If not, then resizing has not been attempted. Possible causes:
Troubleshooting | Image Resizing · Cloudflare Image Optimization docs
Cloudflare Developers banner
Cloudflare DevelopersJoin
Welcome to the official Cloudflare Developers server. Here you can ask for help and stay updated with the latest news
85,042Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Image transformation not working
Cloudflare DevelopersCDCloudflare Developers / general-help
2y ago
Image Transformation Not Working via Worker
Cloudflare DevelopersCDCloudflare Developers / general-help
2y ago
Strange image transformation billing
Cloudflare DevelopersCDCloudflare Developers / general-help
2y ago
Image Transformation from URL metrics
Cloudflare DevelopersCDCloudflare Developers / general-help
3mo ago