如果我将一个PNG文件改成ZIP文件然后尝试在Windows中打开,会发生什么?

huangapple go评论141阅读模式
英文:

What happens if I change a PNG file to a ZIP file and try to open it in Windows?

问题

如果我将一个随机文件更改为.zip文件并尝试打开它,会发生什么?会发生任何不好的事情吗?

想象一下,我拿一个.png文件,将文件扩展名更改为.zip。尝试打开或解压这个文件夹会导致任何问题,还是只会充斥着垃圾?

我尝试过在谷歌上搜索,但所有结果都是关于在文件仍在.zip文件中时重命名文件,这不是我想要的。

英文:

What happens if I change a random file into a .zip file and try to open it? Will anything bad happen?

Imagine that I take a .png file, and change the file extension to .zip. Will attempting to open or unzip this folder break anything, or will it just be filled with garbage?

I tried googling it, however all results were about renaming files whilst they are still inside a .zip file, which is not what I want.

答案1

得分: 1

我不知道你认为什么是“坏”的,但所有的事情只会导致尝试解压一个重命名为.zip的.png文件失败。.png格式与.zip格式完全无关。对于许多压缩格式,例如.pdf,甚至.gz,情况也是如此。(gzip不是zip。)

另一方面,有许多格式使用.zip格式作为打包其组件的一种方式。它提供了结构和压缩。办公软件是一个典型的例子,其中.docx,.xlsx,.pptx,.pages,.numbers,.key,.odt,.ods和.odp都是zip文件。它们都可以重命名为.zip,并且您可以使用zip工具来查看其内容。实际上,您甚至不需要重命名它们来执行unzip -l sheet.xlsx。Java .jar文件也是zip文件,还有许多其他示例。

英文:

I don't know what you consider to be "bad", but all that will happen is that trying to unzip a .png file renamed to .zip will fail. The .png format is entirely unrelated to the zip format. The same would be true of many compressed formats, such as .pdf, or even .gz. (gzip is not zip.)

On the other hand, there are many formats that use the .zip format as a way to package their components. It provides both structure and compression. Office software is a prime example, where .docx, .xlsx, .pptx, .pages, .numbers, .key, .odt, .ods, and .odp are all zip files. All of them can be renamed to .zip and you can use zip tools to peek inside. In fact, you don't even need to rename them to do unzip -l sheet.xlsx. Java .jar files are also zip files, and there are many other examples.

答案2

得分: 0

以下是翻译好的部分:

有一些文件格式之间的相似性不足以只通过更改扩展名来实用,而对于其他文件格式,作为程序处理的一部分可能会有益处。

您提到了PNG和ZIP,通常在ZIP包装器中可以找到PNG,比如.oxps或.ora或许多办公室格式。

一个简单的Windows组合是右键单击一组PNG文件并“包装”为“Zip文件夹”。

文件夹可以允许查看ZIP中的各个组成部分。

但是,如果您随后将一个包含图像的ZIP文件夹重命名为“.cbz”,它将变成一个漫画书,多个页面可以作为电子书查看。

英文:

There are NOT enough similarities between some file formats for them to be useful by simply rename the extension, whilst for others it may be beneficial as part of program processing.

You ask about PNG and ZIP where often a PNG can be found inside a ZIP wrapper such as an .oxps or .ora or many office formats.

One simple Windows combination is to right click a set of PNG and "enwrap" as a "Zip folder"

如果我将一个PNG文件改成ZIP文件然后尝试在Windows中打开,会发生什么?

The folder can allow the component parts to be seen individually in the zip.
如果我将一个PNG文件改成ZIP文件然后尝试在Windows中打开,会发生什么?

However if you then rename a zip folder of images as ".cbz" it becomes a Comic Book and the multiple pages can be viewed as an eBook

如果我将一个PNG文件改成ZIP文件然后尝试在Windows中打开,会发生什么?

答案3

得分: 0

最简单的方法是实际尝试一下。但不会损坏您的计算机。最多,您可能会收到某种错误消息,指出文件已损坏。这是因为当您双击一个文件时,操作系统将尝试使用预定的应用程序打开它。例如,一个重命名的 .png 文件通常会使用 Windows 的“压缩文件夹”功能打开。由于重命名的 .png 文件没有真正 .zip 文件的内部结构,系统会认为文件已损坏。所有这些都发生在应用程序级别,对计算机或其操作系统没有持久影响。希望这个答案有所帮助。

英文:

The easiest way to find out is to actually try it. But no, it will not break your computer. At the most, you'll get some sort of error message saying the file is corrupt. This happens because when you double click on a file, the operating system will attempt to open it using a pre-determined application. For example, a .zip file will normally open with the "compressed folder" feature of Windows. Since a renamed .png does not have the internal structure of a real .zip file, the system will think the file is corrupted. This all happens at the application level, and has no lasting consequences on the computer or its operating system. Hope this answer was informative.

huangapple
  • 本文由 发表于 2023年5月22日 20:59:40
  • 转载请务必保留本文链接:https://go.coder-hub.com/76306460.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定