If you ask a browser's canvas for an AVIF, it will hand you a PNG. Not an error. Not null . A perfectly valid PNG, byte-for-byte identical to the one you would have gotten by asking for PNG in the first place — and roughly ten times larger than the WebP you could have had.
I measured this in Chromium 149 (headless) because "just add AVIF to your converter" is advice you see everywhere, and the failure is silent. The code below is the same chain every client-side image tool uses: decode → drawImage → toBlob(type, quality) .
const c = document . createElement ( 'canvas' ) ; c . width = img . naturalWidth ; c . height = img . naturalHeight ; c . getContext ( '2d' ) . drawImage ( img , 0 , 0 ) ;
c . toBlob ( blob => { console . log ( blob . type , blob . size ) ; // image/png 2150964 } , 'image/avif' , 0.85 ) ;
Enter fullscreen mode
Exit fullscreen mode
You asked for image/avif . You got image/png , 2,150,964 bytes, first bytes 89504e470d0a1a0a . That is the PNG magic number.…