Submitted by Luthemplaer t3_z4xi3p in explainlikeimfive
Obviously I'm just tired of constantly renaming downloaded files because I can't open them in discord or photoshop. It seems entirely unnecessary.
Submitted by Luthemplaer t3_z4xi3p in explainlikeimfive
Obviously I'm just tired of constantly renaming downloaded files because I can't open them in discord or photoshop. It seems entirely unnecessary.
Why can't photoshop open a jfif or webp but if I rename it it can?
Upgrade to Photoshop 2021 (v22) or Photoshop 2022 (v23). What you're describing is a known bug in older versions of Photoshop. Photoshop 2020 and Photoshop 2019 had a bug where they could only open .jfif files if they were incorrectly renamed as .jpg.
Do you mean if you open Photoshop then tell it to open a jfif file, it can't? I have no idea.
If you mean, "Why doesn't Photoshop open when I doubleclick the jfif file?" then that's nothign to do with Photoshop...that's your OS not knowing to open Photoshop when you try to open a jfif file.
They can.
If you are talking about double-clicking the file in a folder you have to set that up in your OS. In Windows you can right click & do "Open With" and select your preferred app. In the Open With menu you can pick "Choose another app" & then there's a check box "Always use this app to open...". Check that check box & pick your app, then next time you double click that file type it'll open with that app.
If you are trying to use the Open File dialog box, you can change the extension(s) it's looking for. You can manually type in *. followed by the extension. So for jfifs, you'd type in "*.jfif". Or most times there's a drop down next to where you can type in the file name & you can pick a file type or set of types.
The sw has to explicitly decide (and a programmer implement it) to check the file if it's a renamed file.
The simpler way is to try to open the file and decode it according to the file format and if it fails show an error message.
So it Photoshop could do it, but someone has to program it and it would cost money to do it.
In any software that's written, never should a file be tried to open based on extension alone. Because that would mean that renaming an executable to an .jpg and having someone open it in said software, executes the file.
So Photoshop already does the actual checking of a file by its contents. What might be happening is that it already rejects the file based on extension however. But the second part is definitely already there.
> Because that would mean that renaming an executable to an .jpg and having someone open it in said software, executes the file.
What? That's just wrong. That's not at all how software works.
> Because that would mean that renaming an executable to an .jpg and having someone open it in said software, executes the file.
This couldn't happen, an exe file can't just run when loaded by a piece of software it would have to be explicitly interpreted as an executable program which Windows does to files named .exe but which some random image viewer wouldn't if you renamed it to jpeg.
Instead if would just check the file contents against the image formats it knows, and then give up when it doesn't find a match.
[removed]
Many file formats have what is literally called a "Magic Number" at the very beginning of the file. If the program sees that magic number, they know it is that file format.
Fixed link: https://en.wikipedia.org/wiki/List_of_file_signatures
Fun fact: I've encountered jpeg files mis-labeled as ".gif" and vice-versa. A lot of software has no trouble with this at all, since it looks at the magic number. Your web browser for example.
The file name doesn’t have anything to do with the format inside. File extensions serve two purposes: mostly, they are there to help people remember the type of data in the file, and sometimes they are used by the desktop environment to sort files and decide which programs open them.
In fact, the program itself opens the file and checks the data inside the file to figure out what to do with it.
JPEG, GIF, WebP, are all very different. You can name the files whatever you want, but if you look at the first few bytes of data in the file, you can tell right away if you are looking at a JPEG file that’s name ends in .GIF
This is why I was able to trick my friends (and myself for a while) into thinking animated jpegs were a thing. I just used to rename the file extension of a gif to .jpg.
Yeah no. SPSS recently defaulted to .sav files and is now the standard suggested program for me to open my emulation save files. Something went fucky along the way.
Your desktop software (perhaps Windows Explorer), has a database where programs can store an association between a file suffix and a program so that when you double-click on a file, the operating system will use that program. The installer software sets that up. That has nothing to do with the file format — that’s a configuration option of the desktop software.
On MacOS classic, each file had a “resource fork”, which was actually a second hidden file (they exist in version of Windows too, but are mostly unused). The resource fork file contained a code to indicate the file type, and the preferred program to open the file (usually set by the program that created it). The file name was completely irrelevant unless a program was written to filter by name.
Modern macOS would check to see if there was an extension and look up in text files what programs could open them and what the user has as a default. If the extension wasn’t recognized, then it would open the file and read part of it and use that to look up what format the file was (UNIX’ file method). There, the file extension was only important if given, because it was understood to be used by the user to o specify how to sort the files and which programs to use to open it.
Changing the file extension doesn’t change the data inside. If you rename a .jpg file .gif, it’s still a JPEG. If you have a desktop environment configured to open both with the same image editor (say, Photoshop), then double-clicking on the file tells Photoshop to open it. Photoshop then looks at the first few bytes of the file to see what’s inside. If it’s JPEG, it uses a routine to load JPEGs, even if the file has the .gif file extension.
Different formats store information in dramatically different ways, but many programs are capable of reading all sorts of data formats. Sometimes they pay attention to the file name, sometimes they don’t.
First of all, JFIF is another name for JPEG, so they are the same.
Second, most image file formats have a way to identify the file format by looking at the first bit of the file. All PNGs start with the same 8 bytes. All JPEGs start with the same 3 bytes.
It is quite common for image loading code to automatically detect the type of image file and load it appropriately.
However, you should not assume this applies to other types of file - it usually doesn't.
You should not even assume that all image programs will do it (though most will).
I use IrfanView as my image viewer and it even notifies you when the extension doesn't match the actual file format, like "this JPEG file has .png extension, would you like to rename it to .jpg?"
Good ol' IrfanView. Haven't used it in probably 15 years.
Any reason you stopped? Is there a better option? Being able to just spin through hundreds of images with the mousewheel and zoom to 100% with a single side-button click was a gamechanger. Needs a little setting tweekage after install, but after that it blows windows' default viewer out of the water.
Looking at it again, probably the GUI. Looks straight out of 1997. I am about to try it again though, given what you said about its speed.
I used Windows Photo Viewer (even on Windows 10) and tried probably a dozen different imagine viewers until I found ImageGlass. Modern GUI, highly customisable: https://github.com/d2phap/ImageGlass
Likewise, I went through about 20 (!) music players (foobar2000, mp3cube, MusicMonkey, etc.) until I found MusicBee, which is incredibly good for music listening and management: https://www.getmusicbee.com/
Yeah the GUI isn't exactly current-millennia, but it's unbeaten on features. There are even basic colour correction tools inbuilt, you can copy chunks of an image straight into photoshop or whatever just by selecting an area and hitting ctrl-C (saving having to drag the whole image in there), and as long as the thumbnail previews have generated it can skip through fairly large images as fast as you can spin your mouse wheel (and wrap back around if you've enabled the setting). Irfan plus Pureref for transparent imageboard overlays is an indispensable combo to any sort of visual artist / 3D modeller.
Whatever application you're using to open the file in question knows how to display the file in question.
File extensions don't actually matter, they're for humans, not computers. More or less.
Most every file of any type has a piece of info at the beginning that tells your computer how it would like be opened and what type of file it is. Basically a hidden 'real' file extension. But you can open a .jpg in a text editor any time you want. Your computer assumes that's not what you really want to do, so it generally doesn't give you that option without you forcing it to.
If you wanna go deeper, it's all numbers and letters and the extension does not matter at all. Like almost every computer game you play, the file that saves your progress is very often just a .zip file renamed.
> File extensions don't actually matter, they're for humans, not computers. More or less.
Well, I wouldn't say that. They are used (in Windows) to decide what icon to use and what program to open it with when you double click.
Technically Windows could look inside every file to decide this, but that would be much slower when listing files in a folder.
Also while most applications will check the contents of a file while opening it, some assume a format based on the file extension (eg. LibreOffice will always open .csv as a text csv file, even if the file is actually an xls/ods)
Yeah you right with all of that, especially the last, I was kinda being generic with my response.
It just kinda freaks me out when I'm on my Linux laptop and it'll save my file 'fartbutt' as a file with no extension at allunless I tell it to, and it's still valid.
Something people had neglected to mention. For many file formats (especially image file), inside the file, there will be a header, a piece of data that tells you information about the file, including explicitly what format it is. So the application can tell easily what file format it is in despite the wrong extension name.
Renaming the extension doesn't ruin the file/image format. Window's relies strongly on extensions to know which program use to ipen a certain file when you double click it. Other OSes, like Mac and Linux use the magic number to determine the type of file. If your orogram is able ro open the file once renamed, you may simply right click on one of them, with the original extension, choose "open with" the program you use and tick the box to always use that program. This should solve your problem.
[removed]
Any decent application that open a file will check if it is in correct format by checking some predefined markers in them. For example every bmp file starts with BM, pngs start with PNG, JPEG and variant contain some text like JFIF inside of them, the they continue with specific information like format version etc. this kind of information is not limited to image files btw, exe files start with MZ for example, zip files with PK, rar files with RAR
And whatever happened to JPEG-2000? I thought that was supposed to be the future of JPEGs, lol!
I figure someone here would know.
It's an excellent format in many ways, but had a number of problems.
The technology it used (wavelet transform) was new and dozens of new start up companies were out there patenting everything wavelet related they could think of. Lawyers were concerned that JPEG-2000 was potentially impacted by a ton of patents. As a result, very little software supported it, and that which did was typically highly priced professional software, with JPEG-2000 support as an additional expensive option.
The wavelet transform is substantially more complex than the discrete cosine transform used in JPEG 1. Saving and opening files can be dramatically slower. High resolution files which would take 1 second to display in JPEG 1, could take minutes with JPEG 2000 on a similar year 2000 CPU.
The new features JPEG2000 offered (lossless compression, less visible lossy compression artefacts, HDR, imaging tiling, hyperspectral imaging and 3D) were of limited interest to most users at the time and did not outweigh the cost and CPU requirements, and even today, many of the features are still niche.
Some industries did use JPEG2000, mainly the medical and scientific (e.g. satellite imaging) communities, because of it's advantages and the fact that the had a clear need for the features, could mitigate the disadvantages and were prepared to pay. For example, in medical imaging JPEG2000 was typically used for transfer of images on CD/DVD or over a slow WAN network connection. If it took 10 minutes to compress the images before burning to a CD, and it allowed only 1 disc to be burned instead of 2, that was a big advantage.
The patent issue has been a recurring problem. For example JPEG 1 is generally thought of as being always lossy. There is, in fact, a lossless mode - but at the time JPEG 1 launched, the technology it used (arithmetic coding) was heavily patented, and most companies developing JPEG software stayed far away from the lossless mode. Lossless JPEG 1 is a very niche file format - mainly only used for medical image transfer - with almost no software able to open it.
Technically whichever company invented jpeg owns all pictures encoded as .jpeg. I'd imagine it wouldn't hold up in court because it's been unenforced for like 20-30 years now. But in theory jpeg itself is the same way. Was one of the earliest mass copyright attempts. And why I still prefer gif or png when at all possible.
JPEG was developed by the Joint Photographic Experts Group and the CCITT, with the intention of being a free and open standard. Where they did use patented technology, they specifically negotiated with the patent holders to get free use rights.
Lossless JPEG, in particular, used a ton of patented technology, whereas lossy JPEG was pretty much patent-free. Some lawyers were concerned that the agreements may be CCITT/JPEG might not cover all patents, so lossless JPEG was immediately hamstrung by legal concerns, plus the fact that for most purposes, lossy JPEG was plenty good enough and gave much better compression.
There was a bit of a controversy, because in 2002, a company with a patent on the DCT technology behind lossy JPEG, suddenly started instructing lawyers to sue any company using JPEG files or using software which could handle JPEG files. This patent wasn't listed in the legal documents produced by JPEG/CCITT, so they didn't have a legal agreement in place. In the end, the company decided to drop the claims, because the patent wasn't actually valid.
GIF has also been problematic from a patent and legal perspective, although PNG has been designed from the ground up to be open and avoid patented technologies completely.
It is still around and a decent format, just not so much for “normal” images. It is big in medical imaging and some other specialty industries for a number of its features.
It died a quick death. Virtually nothing used JPEG-2000 when it was new, and nothing uses it now except to deliver backwards compatibility with 20-year-old images.
JPEG is still the principal image format in 2022, with PNG a distant second, and webp (Google's format) being used for perhaps 0.00000001% of images.
For animated image files, there's a transition happening from GIF to GIFV (GIF Video, aka mp4). There's also APNG (animated PNG) but that's used 0.00000001% of the time.
The file extension is just a suggestion to the OS what application should be used to open the file, and you can change the file association if you want. On Windows, you use the Default Apps applet to change specific file extensions to be associated with specific applications.
The real format information is in the metadata of the file itself, the first few bytes of the data. For example, if the first two bytes of a file are MZ the file is a DOS/Windows executable file (MZ are the initials of the guy who designed the file format).
JPG and JPEG files have, for some time and for the most part, been saved in the JFIF format internally. If you open a JPG file in a hex editor or programmer's text editor, you'll see somewhere around byte offset 0x7 the characters JFIF indicating that the file is actually in that format. Likewise PDF files have PDF in about the same position.
There are two ways programs try to identify the format of a file.
One is to just naively trust the extension. This can sometimes lead to security problems because it causes the OS to open a file is the "wrong" program if the file extension isn't named right.
Another is to utterly ignore the extension and just read the starting bytes of the file's content. Pretty much all files use an ID code as the first few bytes of content that define the file type. They all do this other than plain old ASCII files (Or Unicode UTF-8 files which end up kind of being the same thing as plain old ASCII.) In the UNIX world the first two bytes of file content were referred to as the file's "Magic Number" and you could figure out the type just from those two bytes. But later the algorithm to identify a file by its first few bytes got more complex as some files started using longer byte patterns so it's not just the first two bytes now sometimes it's the first 4 or the first 8.
In the Windows world, it wasn't so common to use the "magic number" idea originally, but it tends to use it more nowadays than it used to.
The problem with using the "magic number" method is that while it may be much more reliable than using the file extension that any user can just name wrongly, you cannot see this "magic number" until you open the file and start reading it. When the file is just a directory entry in a folder and you haven't looked inside it yet, you don't have anything to go on other than the extension. It's impractical and slow for a program that's showing a list of files in a folder to open every file one at a time to read the magic number from all of them. It relies on the file extension to decide what to show you on the screen for the file's icon, and to guess what program should open the file.
The reason .webp and .jpg both work is because often the same program that can read a .jpg file can also read a .webp file, so once the program is opening the file and reading the content, it (should) no longer care what the filename extension was and just believe the magic ID number in the file's content. When it reads that it goes, "oh, this is webp. Well I know how to display those so I'll read this file as webp and show it" and it completely ignores that the filename claims it's a jpeg file.
The place where the file extension being wrong for the format causes big problems is when the program that can read a file of one type cannot read a file of the other type. Then the extension being wrong causes the system to open it in the wrong program, which can't deal with it.
[removed]
Every file has a header. Basically a string of information encoded within the file that helps programs identify what kind of file it actually is even if you rename or even delete the extension. A good image viewer will be able to identify based on that.
If Photoshop can't do it, then that just means it doesn't bother checking for the right file format or it's just a bug.
If you’re on a Mac you can right click the file and select “convert image” and change it to a jpg.
Are you renaming them after saving them to disk, or changing the URL to have a different name?
Some web sites offer the same file in multiple formats. Changing the URL means you're requesting the file in a different format, and some sites can oblige and actually give you the alternate formats.
tdscanuck t1_ixta9ey wrote
The file extension just tells the OS what program to use to open the file. The program that tries to open it is going to actually look at the file to see what it is.
In virtually all cases, any program that can open webp or jfif also knows how to open gif or jpeg, so when they open the file they just go "Oh, this is a jfif" and keep doing their thing.