• morrowind@lemmy.ml
      link
      fedilink
      English
      arrow-up
      14
      ·
      23 hours ago

      No, it’s a different format underneath.

      Occasionally it’ll work, cause an app will use a library that supports webp but forget to add it to the file picker (or deliberately don’t want it) but generally no.

      • Hazmatastic@lemmy.world
        link
        fedilink
        English
        arrow-up
        2
        ·
        23 hours ago

        Just had this experience with some .png files I downloaded. Apparently Chrome, which i used on my work computer to get some game files, downloads images in .webp by default. Even if specifically saved as other formats. Game wouldn’t recognize my pngs until I changed them back to .webp like you described, opened them in PS, and exported as .png. The filetype does some funky stuff

        • SteveTech@aussie.zone
          link
          fedilink
          English
          arrow-up
          2
          ·
          17 hours ago

          Apparently Chrome, which i used on my work computer to get some game files, downloads images in .webp by default.

          Some servers will serve webp to supported browsers to save bandwidth, even if the URL ends in .png. So its not Chrome’s default, its the website.

    • I Cast Fist@programming.dev
      link
      fedilink
      English
      arrow-up
      2
      ·
      21 hours ago

      Simply changing the extension wouldn’t work because each image type has a specific header - even changing a .png to .jpg wouldn’t work - and organizes the actual image data in different ways.

      The header is what actually identifies the file type. For webp, it’s called the RIFF header and it must be 21 bytes (it’s a standardized specification, btw). For jpeg, the header is only 2 bytes and has the values FF D8. In theory, this means that you could even rename the file to image.zip and, if you opened it in an appropriate program, it would read the header and still render it properly

    • Captain Aggravated@sh.itjust.works
      link
      fedilink
      English
      arrow-up
      1
      ·
      21 hours ago

      If we made a list of things you could do, that would be on the list.

      If that’s the only thing that changed, the data in the file isn’t changed, it’s still a webp file not a jpg, it’s just mislabeled now. I just tried it, Dolphin will let you do it but throw a dialog telling you it’s not actually going to change the file, just the name. Some systems might be smart enough to recognize the intent and run a conversion program in the background. Feels like an Apple thing to do. Also feels kind of Pythonic.

      A lot of image viewing software doesn’t know what to do with the webp format so they’ll try to load it and throw an error.