The correct API pattern is: 1. Set image.format = outputFormatEnum first 2. Then call image.write(callback) with the format already set This ensures the image is written in the correct format with proper headers (RIFF for WebP, etc.) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>