Let's say you downloaded a picture off the net as a GIF image (Image.gif), and renamed it to Image.jpg. Although it would change the file name, would the file be encoded as a jpg (i.e.: some of the image being thrown out due to it being a lossy format), or would the file remain the same as it was on the net (.png), with only the name being changed?

  • 1
    No. The Extension has nothing to do with anything really, it's just a hint to tell programs how to treat your file. This isn't really on-topic though as it isn't anything to do with graphic design.
    – Cai
    Sep 15, 2016 at 5:33
  • @Cai If this doesn't belong here, please give an example of where it does belong.
    – Summer
    Sep 15, 2016 at 10:53
  • 4
    Questions related to systems and general computer stuff are usually appropriate for Super User--although this particular question is more about basic computer usage. A google search quickly finds the answer to this question. Questions on a StackExchange sites should explain what you already found too. Here is a good example of this question appropriately asked on SuperUser Sep 15, 2016 at 11:28

3 Answers 3


No. Changing the extension is a bit like changing the label on the soy sauce dispenser to say "Maple syrup". The results will not be useful and may be unpleasant.

FWIW, in some cases, when you open a file over the web in a browser, the browser may "sniff" the file and handle it correctly despite the misinformation handed it by the file extension. Some files have a detectable "signature" pattern of bytes at the beginning of the file.

But generally, changing the extension is asking for problems.

  • 1
    Nice example...
    – Rafael
    Sep 15, 2016 at 20:46


Neither OS X nor Windows will actually do anything for the image. They will just rename it to a different name. The operating system will be fooled though. This is trivially the case on Windows machine but OS X is a bit less naive in general. However in this case the net effect is the same.

This is easy to prove take a PNG image copy it rename it to same name but with a jpg extension. Ask file info, OS now reports the file is a JPEG file. But observe that the file size is exactly the same, that is a bit suspect. OK, so we can read the actual file if it starts with \0089PNG as per standard then its a png file. So we can just take the header of the file and look at it. Lo and behold the file is in fact a PNG even if the extension is a jpg. Note: the terminal can not display the first character so it substitutes it with a question mark.

enter image description here

Image 1: Nothing changed in the files just by changing extension name. Still the operating system and the file info is fooled.

Case closed.

  • Is OSX any less naive?
    – Cai
    Sep 15, 2016 at 8:29
  • @Cai not in this case, but for some files OSX and Linux use a system of magic tokens at beginning of files for file recognition. This system would not be fooled by the change of extension. Windows on the other hand always naively expects extension to be correct. So not accurate enough but not nearly as naive as Windows.
    – joojaa
    Sep 15, 2016 at 8:42
  • Are you talking about magic bytes? Those are file content. I don't know about Linux but in the case of OSX there is no magic. It just stores the extra information about Creator and File Type (and some more stuff) in a file hidden for normal users. The 'original' file is unchanged, and untested.
    – Jongware
    Sep 15, 2016 at 17:58
  • @RadLexus yes i know but that gives it a possibility to be smarter, it might ignore extension type and conclude that the file is still a PNG because only thing that changed was name. But apparently it does not do so. Even linux does not always use magic bytes anymore though. But then quite many formats would report being zip files
    – joojaa
    Sep 15, 2016 at 18:10

i use Mac OSX, and it asks when you change the extension if you really want to change the file type or not. i just tested it with a PNG file and renamed to a JPG. when i get the file info, it says it's an JPG file.

however, i recommend you use a image editing software such as Photoshop to do it properly and control the output to fit your needs.

sscreenshot of information of two files in Mac OSX

edit: to clarify: i'm not saying it's exactly the same. i'm saying that OSX is fooled and says it's a JPG file. if you export the same original from Photoshop as JPG or PNG you get different settings, sizes, etc. it may do the trick for something he's trying to accomplish, even if it's not the correct way.

  • 1
    I think you are a bit too trusting (I have a bridge to sell you). Yes the OS is fooled (that's the point of extension change), but the file is still a PNG! And here is the proof as image the file is still the same format that can be seen by catting the file header (also a second hint is in same size). A jpeg just has different file structure and does not start with ?PNG.
    – joojaa
    Sep 15, 2016 at 6:43
  • i know they're not the same, that's why i recommended him to use an image editing software. usually when exporting PNGs and JPGs from Photoshop (for example) you get different settings, filesizes, etc. it may do the trick for something, but it's not the right way. Sep 15, 2016 at 12:28
  • No the point is that they are the same.
    – joojaa
    Sep 15, 2016 at 12:29
  • i mean that PNG files and JPG files are not the same. not the specific files we're talking about. in this case, yes. it's the same file for sure. OSX and maybe a web application may be fooled and think it's a different file. Sep 15, 2016 at 12:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.