Topic: Question about file extension troubles (.jfif and .png's)

Posted under General

The things I upload here for some reason say "Type: JPG" under the information section of the artworks despite showing up as PNGs in my file explorer. I only just now realized this after going back and checking the things I've uploaded, so now I am paranoid that I've accidentally messed up the handful of things I've uploaded to this site.

I get my stuff from Twitter. When you download things from Twitter, it tries to save it as a .jfif file. Being a somewhat normal person, I see .jfif and go "ew" and change it to something else. What I do is simply delete the .jfif part of the file and replace it with .png during the 'Save As' file explorer thing. Is this incorrect/bad? I theorize this is why the things I upload here that show up as PNGs in my file explorer are displayed as JPGs.

TLDR: I might've messed up because .jfif stuff is annoying.

Donovan DMC

Former Staff

jfif is essentially just a jpeg by another name (there are minor differences, but for our purposes they don't matter), we detect them as a jpeg all the same so they should just work

Changing the extension of a file does absolutely nothing, the image is still a jpeg, and the site completely discards the extension
The filetype is detected via a file signature of the first typically 8-16 bits (also known as a magic number) which is part of the file and is completely unrelated to its name, you can read more here (and see a list here)

Updated

E621 determines file type from a byte sequence that it matches to a lookup table of our allowed file types. You can't just change the encoding of a file by changing the name of the extension, it has to be fully re-econded.

However, you should never re-encode a jpg as a png because all it will do is waste space. Turning it into a real png will do nothing unless you are the one exporting that file in the first place.

Basically, your file explorer trusts the extension given, e621 does not, and e621 will always be more accurate because it checks the bytes rather than the extension.

Oof, I was doing it wrong. Thanks for the info y'all, I'll do it the right way from now on.

gattonero2001 said:
You can read our guide on sourcing from Twitter here -> https://e621.net/wiki_pages/26055#twitter

Twitter URLs are whitelisted, and they are the preferred method of upload. Don't change the "format" part, just change the "name" part to "orig".

If I upload things from Twitter via pasting the image URL instead of manually dropping a file, does e621 store it locally? (not sure how to phrase that question.) The reason I've been doing manual files instead of linking image URLs is because I have the preconceived notion of "wait, when Twitter finally dies, will all those uploads just... disappear?"

IrfanView will warn and ask you to rename wrong extenstion. For example you open fake *.PNG file, but actually it's *.JPG with incorrect renamed extenstion, IrfanView will ask you to rename it to correct extenstion.

tarrgon said:
Basically, your file explorer trusts the extension given, e621 does not, and e621 will always be more accurate because it checks the bytes rather than the extension.

Looks like explorer also don't care much about extenstion, but use *.PNG, *.JPG as flag that is a picture. Otherwise it was unable to show content because PNG decodes differently than JPG.

Updated

i_am_not_here_ok said:

If I upload things from Twitter via pasting the image URL instead of manually dropping a file, does e621 store it locally? (not sure how to phrase that question.) The reason I've been doing manual files instead of linking image URLs is because I have the preconceived notion of "wait, when Twitter finally dies, will all those uploads just... disappear?"

URL upload means that e621 downloads it from the url link, it isn't just retrieving it from twitter every time someone opens the post.

snpthecat said:
URL upload means that e621 downloads it from the url link, it isn't just retrieving it from twitter every time someone opens the post.

Additionally users are encouraged to use URL uploads when available. https://e621.net/upload_whitelists

You can request additions to the whitelist here: topic #22269

Last but not least, always check how to obtain the highest quality available when that is not possible. https://e621.net/wiki_pages/16162

For example Bluesky requires a userscript that can be applied through the Tampermonkey browser extension

BSky Redirect
// ==UserScript==
// @name         BSky Redirect
// @namespace    http://tampermonkey.net/
// @version      2024-05-26
// @description  Redirect you to the best version available from bluesky
// @author       You
// @match        https://cdn.bsky.app/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=bsky.app
// @grant        none
// ==/UserScript==

(async function () {
  'use strict';

  let url = window.location.pathname.split("/")

  if (url.length < 6) return

  let did = url[4]
  let cid = url[5].slice(0, url[5].lastIndexOf("@"))

  if (did && cid) {
    window.location.href = `https://bsky.social/xrpc/com.atproto.sync.getBlob?did=${did}&cid=${cid}`
  }
})();
  • 1