Inspect alpha, not the extension.
PNG and WebP can contain transparent pixels, but an opaque image can still have either extension. Open the file and analyze its decoded pixels. Zero alpha means fully transparent; 255 means fully opaque. Counts include every pixel in the decoded still frame, including partial transparency along antialiased edges.