With ImageMagick 7, run magick identify -format "%m %wx%h" sample.png. If it reports JPEG and the expected dimensions, the suffix and encoding disagree. Rename a copy to .jpg when JPEG is permitted.

If the destination actually needs PNG, open the image and export it as PNG, then repeat the format check on that output. Preserve the source while diagnosing decoder errors.

JPG vs JPEG: Can you rename .jpeg to .jpg? · ImageMagick identify