共享資源:檔案類型

This page is a translated version of a page Commons:File types and the translation is 46% complete. Changes to the translation template, respectively the source language can be submitted through Commons:File types and have to be approved by a translation administrator.

Shortcut: COM:FT

維基媒體共享資源只接受「自由內容」。同樣地,我們允許自由檔案格式。

專有檔案格式不被維基共享資源所接受;可以接受的檔案格式如下列清單所述。專有檔案格式的例子如AACWMA以及大多數AVI編碼。我們的使命要求所收錄的內容必須可以自由發佈到所有領域。專有格式檔案不符合這個條件。

非自由格式和不支援的自由格式必須在上傳前轉換成可支援的自由格式。幸運的是,轉換這些格式通常並不困難。(但也許頗費時間,取決於格式種類和所需的輸出品質,尤其是在效能不佳的設備上。)

圖片

在維基共享資源上,我們建議的文件類型為:SVGPNGJPEG

維基共享資源不允許BMP檔案,這些檔案可以無損轉換成PNG,且轉換後的大小總會比轉換前小。

大小與尺寸

参见:共享資源:最大檔案大小

請注意,在撰写了以下文字之後,新的PNG調整大小軟體就已被安裝。

很遺憾的是,圖像縮放系統仍然受到限制。當前,(PNG、GIF、JPEG)縮略圖以與原始圖像相同的格式生成,並且始終為24位元色彩(除非圖像為GIF格式,在這種情況下,結果圖像將具有256色)。這意味著縮放PNG圖像會生成相當大的文件,即使原始圖像包含調色板或灰度格式也是如此。這也意味著,如果您要上傳照片的無損PNG以進行編輯和存檔,但要在文章中使用JPEG縮略圖,否則必須手動上傳(完整比例)JPEG版本。


請注意,如果圖像非常大且渲染需要太多時間或占用大量內存,則圖像的縮放可能會失敗(在這種情況下,要么沒有顯示縮放的圖像,要么將完整的圖像提供給瀏覽器,這通常會導致其鎖定)。對於GIF圖像,有效限制為1,000百万畫素。[Note 1] 大型JPEG通常只有在以漸進模式保存時才會出現問題。請改用基線模式(請參閱漸進JPEG)。

最高解析度

Shortcut

尽管如此,请上传高分辨率的图片,以确保共享资源的内容能够广泛地被再度使用--包括用于印刷媒体。萬一最高分辨率版本有上述的问题,可以用另一个名称(在描述中提及分辨率较高的图片)上传较小的版本,或者作为文件的較新版本。更多信息,请参阅Commons:Why we need high resolution media。与此相反的是,Special:AbuseFilter/153限制新用户跨维基上传较小(小於50,000字节或小於2,000,000像素)的jpg文件。

SVG

另見帮助:SVGWikipedia: Graphic Lab/Resources/SVG

SVG is an XML-based vector graphics format that can be scaled without getting blurry or “pixelated”. It is easy to edit and usually produces reasonably small files (see File:Bitmap VS SVG.svg). SVG is preferred when creating diagrams, flags, etc., while PNG works well for scanned images and print-quality photographs. See 帮助:SVG.

SVG works well for diagrams, charts, illustrations, maps, and any graphic that needs labels. SVG can store the labels as text strings, so an SVG graphic can be translated to other languages by editing the text strings. For example, the map File:Caucasus-ethnic en.svg below has been translated to several languages. Compare the better image quality of the SVG maps at various sizes compared to the JPG map. (The images shown below are actually in the PNG format. SVG images on Wikipedia are not served to browsers. Instead, MediaWiki converts the SVG image to a PNG image and serves the PNG image.)

PNG

PNG is a "lossless" format (which supports alpha transparency), meaning that the exact pixel color is preserved when saving, and can be used for any kind of drawings/diagrams that is not available in SVG format (SVG is preferred when creating diagrams etc.). PNG is good for practically anything except digital camera photographs. PNG is better for scanned graphics (though with a caveat – see the note on sharpening below), and low color depth images. (All this at a generally smaller size with more quality compared to JPEG.)

On Wikipedia (and all other MediaWiki installations, as discussed in phab:T192744), PNG thumbnails are not sharpened, but JPEG thumbnails are. For more complicated images, such as photographs, engravings, and such, PNG displays an inferior thumbnail. However, the major problem with JPEG is that, as a lossy file format, it cannot be repeatedly edited, even at the best quality settings. As such, even where the PNG thumbnail is inferior, it’s recommended to upload a PNG as well, and link between the PNG and JPEG copies using {{PNG with JPEG version}}. An exception is where the original image is already in JPEG; in such cases, there’s no reason to provide a PNG copy. However, if you edit the JPEG, it’s not a bad idea to save a PNG copy before closing the program used to edit it; this provides a copy that someone else can edit without causing progressive degradation. As well, for simpler images, see Wikipedia:How to reduce colors for saving a JPEG as PNG – simple images usually have smaller filesize than JPEG when the image is relatively simple.

Exif資料

请记住,PNG文件中没有适当的exif数据,这一点非常重要,[Note 2]因此,如果您想上传以原始图像格式拍摄的照片,请将原始图像文件保存为 JPEG 格式,如果您喜欢,也可以上传原始图像文件的 PNG 格式。但是,如果您想修饰照片并保留 exif 数据,专业的方法是编辑原始图像文件或 PNG 版本,将其保存为 JPEG 格式,然后将原始图像文件中的 exif 数据复制到最终的 JPEG 文件中。“没有一個单一的标准方法可以把这件事做好,如果您的工具产生了严重错误(UTF-8 在 iTXT 块之外或类似情况),其他贡献者会帮助您。”

另見共享资源:准备上传图像,其中的PNG tips
 
2017年9月止維基共享資源的檔案類型比例

JPEG

JPEG(包括JPG)適合照片,尤其適合一開始就是JPEG格式的照片。JPEG使用「有損壓縮」,犧牲精確度來縮減檔案大小。

If you have a choice of file formats in which to save a graphic, scan, or other such thing, save it as PNG (or save it as another lossless format, such as TIFF, and convert to PNG), and upload it as such. However, if the original file is in JPEG, it generally makes no sense to convert it to PNG: converting a lossy compression into a “lossless” format doesn't buy you anything since the “loss” already occurred in the original, and doing so will only increase the file size (any edits, however, should probably be saved as PNG as well as JPEG). An exception is high resolution JPEGs that have no visible compression artifacts. Conversion to PNG will avoid the thumbnails having additional compression artifacts.

Note that currently, JPEG thumbnails receive extra sharpening, while PNG thumbnails don't. Hence, uploading in both formats may be a good idea if the PNG thumbnails look a bit blurry. Use {{JPEG version of PNG}} on the JPEG versions of a PNG flagged as {{PNG with JPEG version}}.

PNG is a lossless full-color format. JPEG is always a lossy format, even at the highest quality settings. Lossless formats do not degrade after being saved repeatedly, but lossy ones do; hence, having a lossless version of the file allows the file to be tweaked for various purposes—cropping, levels adjustment, and so on—without a loss in quality.

GIF

 
The thumbnail of this GIF file is problematic due to handling of transparency
 
PNG resizing does not have this problem

PNG is almost always superior to GIF for still images (smaller size, more colors, better transparency). If you are creating or editing a graphic (not a photograph), and have a choice of file formats to save it in, the preferences for Wikipedia/Wikimedia use is SVG first, then PNG. Never save an image with more than 256 colors in the GIF format. GIF always saves images as 256 colors or less. Converting higher-color images to the GIF format will degrade those images.

Editing of GIF files can be unwieldy because GIF only supports an 8-bit palette and most filters only function on the full palette. And PNG supports 8-bit transparency (alpha channel) in contrast to GIF's 1-bit transparency. There are also certain idiosyncracies in GIF resizing; notably, when a GIF with background transparency is thumbnailed, the transparent area eats into the non-transparent area, which can create problems.

If you find some quality freely licensed GIF graphics, diagrams, charts, maps, illustrations, etc. that you think would be useful for Wikipedia or one of its sister projects, feel free to upload them to Commons as-is. You or others can convert them to SVG format later if need be.

See Commons:Chart and graph resources for tools and help.

GIF動畫

GIF is a lossless, 8-bit color format (maximum of 256 colors) and should be used mainly for animated images on Wikimedia Commons. For animated images GIF uses lossless compression of images up to 256 colors per frame. Animated GIF files sometimes have problems when thumbnailed. If you find your animation corrupted or distorted when scaled down, try re-saving it with every frame the same size: A common optimization method in animated gif crunchers is to write variable-sized frames, sometimes labeled as: “Save only the portions of frames that have changed”. Wikimedia’s current version of ImageMagick does not seem to support this. There is currently a 100 megapixel restriction in our software; please see the description in Category:Animated GIF files affected by MediaWiki restrictions for details.

Inline animations should be used sparingly; a static image with a link to the animation is preferred unless the animation has a very small file size. Keep in mind the problems with print compatibility mentioned above.

TIFF

Only some TIFF files can, at this time, be displayed in resized (thumbnailed) form within Wikipedia or on Commons, and TIFF files are not supported by most Internet browsers. They are an archival format, and should never be used for images intended to be displayed.

TIFF generally serves as a lossless format, similar to PNG, but with much less compression. However, its standard compression algorithm is very fast to apply (which was a benefit on older computers) and most scanner software supports TIFF, making it a popular choice for archives.

PNG is not supported by most scanner software, but files saved in PNG can generally be made much smaller than TIFF files. For instance, one 33 MB TIFF reduced to 17 MB when saved as a PNG.

Overall, PNG is a preferred format; however, the ability to upload TIFF files is offered as a courtesy. For instance, if you were batch scanning files in order to upload them to Commons for others to edit and prepare, you would want to use a lossless format (editing a non-lossless format causes an increase in artifacts every time it is saved). Your scanner software may not support saving directly to PNG, but allow TIFF. In such cases, uploading the image as a TIFF file is acceptable, as it helps you donate material to Commons much more easily (in that specific case, it would be appropriate to inform the regulars on the Village Pump noticeboard so that your batch upload can be prepared for more widespread use and possibly to discuss things beforehand briefly). There are many image editors (free and commercial) that can handle conversion from TIFF to other formats. See: en:Comparison of raster graphics editors #File support.

The statements above apply to the vast majority of TIFF files; however, note that TIFF is a somewhat odd format – the specifications are loose, and can, in theory, support a wide variety of compression schemes and file storage (though most programs that open TIFFs only recognise the most common). This makes it difficult to make definite statements about TIFFs: For instance, TIFFs can contain JPEGs, which are not a lossless format. Generally, only TIFFs of the standard types should be uploaded to Commons.

WebP

維基共享資源支援WebP圖像格式。其支援基於VP8的有損圖像壓縮,以及基於新算法的無損圖像壓縮。無損模式比PNG更加緊密。

XCF

XCF can be useful if you are working on an image with GIMP. Unlike PNG and similar files, XCF files support text and multiple layers. It may be useful to upload the XCF file, so that other editors can continue working with it directly, while retaining the layering information. Please note that a thumbnail of a XCF can only be generated by the MediaWiki software if the file format is compatible with GIMP 2.6 or 2.8 and the color mode is RGB or grayscale. In other words, images with indexed colors are not supported by the MediaWiki thumbnailer; neither are files created with GIMP 2.10 (see T196054).

聲音

参见:Commons:Free media resources/Sound 維基共享資源上可接受的檔案類型包含:MP3Ogg(使用FLACSpeexOpusVorbis編碼)、WebM(使用Vorbis)、FLACWAVEMIDI

Non-free formats and lesser-known free formats must be converted before uploading—there is currently no legitimate way to store pristine original data for conversion to future formats or for use when patents expire, even if the license of a given work requires distributing such pristine original data (as is often the case for works distributed under the GNU Free Documentation License or other copyleft licenses).

The Commons does not accept tracker formats, even formats written by free trackers. Nor does it accept sound fonts for use with MIDI files, even sound fonts designed for use with free MIDI players. If it is important that a musical passage be heard with specific instrument definitions that General MIDI does not provide for, and the license allows it, use your tracker software to render the passage to RIFF WAVE, and then encode it to Ogg Vorbis.

截止2023年6月,很多瀏覽器支援播放MP3、Ogg Vorbis和Opus,但不支援MIDI、FLAC或Speex。在上傳後,瀏覽器會自動轉換FLAC及Speex為Vorbis和MP3編碼以便播放。

MP3

MP3 is a widely supported audio format and is highly recommended if an ogg or lossless version can't be found. Commons currently only accepts MP3 uploads by users with Autopatrol or higher rights, due to concerns about the capacity of the community to monitor for copyright violations.

MIDI

維基共享資源接受MIDI檔案,但尚未完整支援;這類檔案的副檔名應為.mid

Ogg(音訊)

Opus is the preferred audio codec for the Ogg container. Please use the file type opus or oga to upload audio files in Ogg Opus format.[Note 4]

Opus is supported by MediaWiki (phab:T42193, phab:T53313) since 2014. The format has excellent quality and low algorithmic delay.It automatically switches between speech and music-optimized modes and is able to combine the two. FLAC is for general audio and is lossless (quality is preserved), but current file size caps prevent its use for anything but short clips. In most cases, Opus should be used, using Xiph recommended settings.[Note 5]

Existing audio in other free codecs (such as Speex and Vorbis), but present in an Ogg container, should not be converted to Opus or FLAC to avoid generation loss.

Note that with FLAC, a native container format exists (see below). If your output file has the extension .flac, it is likely using the native container format. If you like to embed it into an ogg container, this can be done with ffmpeg using the command line ffmpeg -i InputFile.ext -acodec flac out.oga or flac ./input.wav -8 --ogg -f ./output.oga.[Note 4]

It is also useless to put data in a non-free format into a free container like Ogg: you get a file, which, while requiring that a player support the free container, still requires that it support the non-free codec.

WebM(音訊)

WebM容器可以存放音訊(Vorbis或Opus),以及伴隨或不伴隨影片。

FLAC

The Free Lossless Audio Codec is supported with or without encapsulation into ogg-containers. TimedMediaHandler will automatically offer transcoded variants in ogg format. File extension without encapsulation: .flac. (The related phab:T51505 was resolved in 2013 and closed in 2014.)

WAVE

Wave容器通常可容納不壓縮的無損音訊(PCM)。如果可以的話,請在上傳前轉換成FLAC。副檔名:.wav

影片

影片必須為使用Theora視訊編碼格式Ogg檔案(副檔名為.ogv[Note 4])、WebM檔案(副檔名.webm)或MPEG-1/MPEG-2檔案(副檔名.mpg.mpeg)。非自由格式必須在上傳前轉換。參見共享資源:視頻——上傳視頻了解教程。參見Video2Commons,這是一個更快更容易的工具。

The recommendation of MDN Web Docs is WebM containg VP9 video with Opus audio. Can I use reports that some 80% of 2023 users are able to directly use this combination, much more than Ogg Theora (~30%).[Note 6]

WebM(影片)

WebM supports the VP8, VP9, and AV1 video coding formats, and the Vorbis and Opus audio coding formats. The container format WebM is a subset of Matroska.

VP8 is a lossy compression format which has better quality than Theora does. Of course, there is no need to transcode existing Theora videos to VP8, because it won't fix the damage by a prior more lossy compression. While WebM is more widely supported by browsers, such compatibility issues are to be fixed by automatic transcoding in MediaWiki software, not by manual re-upload.

VP9 is a successor to VP8, having better compression efficiency.

AV1 is a successor to VP9 and offers better compression efficiency. It's slated to have much wider industry support both in software and hardware than previous free video formats. As of 2023, 70% of users are able to play this format.

Ogg Theora(影片)

Theora is a lossy video coding format released in 2004. It is based on VP3 in the line leading to Flash VP6/VP7 and WebM VP8/VP9. (Note: Most software mentioned at 共享资源:软件 should also be able to play Ogg Vorbis audio.)

As of 2023. Theora is poorly supported by modern browsers' HTML5 video players. Avoid converting to this format.

MPEG-1 (video)

MPEG-1 is the VCD standard, which includes MP2 and MP1 standards, for lossy compression of video and audio released in 1993. It was designed to compress VHS-quality raw digital video and CD audio down to about 1.5 Mbit/s (26:1 and 6:1 compression ratios respectively) without excessive quality loss.

MPEG-2 (video)

MPEG-2 is the DVD standard, which includes MP2, for "the generic coding of moving pictures and associated audio information" first released in 1996. It describes a combination of lossy video compression and lossy audio data compression methods, which permit storage and transmission of movies using currently available storage media and transmission bandwidth. Both of MPEG-2 and MPEG-1 are standards of digital cable/satellite TV and digital audio broadcasting (DAB).

文本格式

掃描文本文件(DjVu、PDF)

 
This PDF gets a {{BadPDF}} flag placed on the file page because it looks mottled (from JPEG compression) if used as an article graphic, while File:Amsterdam Museum logo.svg is much better suited.

雖然共享資源一般不存放文本,但可因為合理原因而將文本上傳至此(如用於維基文庫轉錄用途的存檔版本)。

  • 有關DjVu及PDF檔案的說明,請參閱Help:DjVu
  • 共享資源允許PDF格式文本。不建議上傳該格式之圖形,如右方範例所示,該圖是一份清晰的向量圖形。有關允許PDF及DjVu格式的原因,請參閱Project Scope, PDF and DjVu formats

Note that any page from a PDF currently gets rendered as JPG by thumbnails, but this could as well be rendered as PNG. This only depends on the implementation of the PDF renderer used on the image thumbnail server and it is not a limitation of the PDF format vs. DejaVu. The only limitation is the existence of various proprietary extensions of the PDF format which could sometimes require a specific PDF viewer. PDF files in Commons should not depend on these extensions and should use only the core specifications, used by the thumbnail renderer of Commons. The issue may exist only when PDFs are downloaded in native format from the "Media:" namespace instead of being rendered as a single image from a selectable page number in the PDF (because these extensions may embed some active scripting, form handlers, and active links to external sites).

For single image rendering, PDF files rendered with the core PDF profile (from its standard specifications) are functionally equivalent to DejaVu files, but typically render photographs and graphics with higher fidelity and more accurate color profiles than DejaVu files which use a more basic model. PDFs also offer better quality in some cases as they can embed scalable vector graphics, instead of just highly compressed bitmaps at a fixed resolution. So the difference is basically on the compression level for bitmaps: for scanned text documents, DejaVu is often smaller than PDF, but this does not make a difference when these files are rendered as a single bitmap image instead of being downloaded.

For documents containing colorful graphics and photos, PDFs frequently offer better fidelity and accuracy. However, image thumbnail renderers currently used by Commons do not render them clearly because they generate JPEG thumbnails instead of more accurate PNG thumbnails: this could change in the future when an agreement is reached at phab:T38597.

See also Help:扫描 for advice on scanning non-text items.

時間戳文本

TimedText是維基共享資源自訂的命名空間,用來存放「時間戳文本」,也就是字幕、隱藏式字幕或其文本。這些內容需為純文字且不能有任何標記。

数据文件

目前沒有資料庫檔案格式可以用於上傳至共享資源。(請參閱下面不支援的檔案格式部份。)

However, tabular data can be stored in the dedicated Data: namespace. For example, data in this namespace can include:

  • Map data, allowing users to store GeoJSON data.
  • Tabular data, allowing users to create CSV-like tables of data.

This also supports the creation of dynamic text (via Lua modules) and graphs using data in JSON format.

Data files in Commons have to be set under one of these license: CC0-1.0, CC-BY-1.0, CC-BY-2.0, CC-BY-2.5, CC-BY-3.0, CC-BY-4.0, CC-BY-4.0+, CC-BY-SA-1.0, CC-BY-SA-2.0, CC-BY-SA-2.5, CC-BY-SA-3.0, CC-BY-SA-4.0, CC-BY-SA-4.0+, ODbL-1.0, dl-de-zero-2.0, or dl-de-by-2.0.

Feel free to experiment by creating pages with the Data:Sandbox/<username>/ prefix. For now, page content can only be edited in the raw JSON format unless, each field have the type 'number' or 'string'. To categorise Data files, categories can only be added to their corresponding Data talk pages.

地圖資料

See more details in mw:Help:Map Data.

Map data allows users to store GeoJSON data, similar to images. Other wikis may use this data to draw on top of the maps, together with other map customizations, using Kartographer.

To create a new map data, create a new page in the Data: namespace with the .map suffix, such as Data:Sandbox/Example user/Example.map.

表格資料

See more detail in mw:Help:Tabular Data.

Tabular data allows users to create CSV-like tables of data, and use them from other wikis to create automatic tables, lists, and graphs.

To create a new table, create a new page in the Data: namespace with a .tab suffix, such as Data:Sandbox/Example user/Example.tab.

Design and CAD formats

3D structures
STL for 3D files, the file format most commonly used for 3D-printing. Other 3D formats and Other CAD_file_formats are unsupported. See also mw:Help:Extension:3D.


其他格式

Chemical and biological molecular structures
None supported yet. See unsupported file types below.
Map routes and GPS data
See Map data. See also unsupported file types below.

申請支援新的檔案類型

As of 2021, there is no standard process for requesting support for new file types. Discussion on MediaWiki.org

The MediaWiki manual includes a description of how to add support for a new file type, which mentions some considerations when adding support on Wikimedia websites.

As a first step, read that manual page + file a ticket requesting support linking to this umbrella tracking ticket: Multimedia file format support (tracking). You can find examples of past requests, open and closed, linked to it already; and a summary below of past requests that remain unsupported.

不支援的檔案格式

不支援的自由檔案類型

以下格式曾經有被提出請求開放,但目前無法支援;請協助我們能夠支援這些格式。:-)

Any format for 3D except STL (which is already supported)
Any other CAD design patterns
Any format for data
Any format for chemical or biological molecules
Any map route/GPS format
Image formats
Audio/video formats
圖形格式:
多媒體與動畫格式:
  • SWF2009年止可被視為自由格式?但還需要自由製作與播放工具 – phab:T28269討論串中被拒絕。
科學格式:
  • FITS – 彈性影像傳送系統
Font formats

非自由檔案格式

曾經被提起討論至少一次,希望這些檔案格式在上傳時能自動轉換為自由格式。

Most of the above issues are tracked as “Multimedia and file format support” issues in phab:T44725.

受到支援的替代選項

Source materials for files uploaded to Commons, such as camera raw files and bigger FLAC audio, can be uploaded to Commons Archive, an unofficial companion website that accepts all file formats. Note that all Commons users can log in to Commons Archive with OAuth.

註解

  1. 百万畫素(幀數 × 寬度 × 高度),降采样公式(对于维基媒体限制,保留SAR):底部 (√百万畫素限制 × 寬度 ÷ 高度) ≥ 寬度,对于动画(而且还有更少的SAR):底部 (百万畫素限制 ÷ 幀 ÷ 高度) ≥ 寬度
  2. MediaWiki 在“元数据”下显示了一些PNG数据,如分辨率 pHYs和时间戳tIME以及其他文本数据(注释),但这些数据不属于Exif范围。
  3. For JPEG also see A few scanning tips, scantips.com, 2010 by Wayne Fulton.
  4. a b c Our Ogg convention differs from the upstream Xiph convention in that we only care about differentiating audio .oga from video .ogv. The Xiph.Org Foundation recommends using .ogg as the extension for Ogg Vorbis audio files, .oga for Ogg FLAC audio, .ogv for Ogg Theora video, and .opus for Ogg Opus audio per RFC 5334 and RFC 7845. See also MIME Types and File Extensions - XiphWiki.
  5. See Opus Recommended Settings.
  6. See MDN page: Web video codec guide. See Can I use webm and ogv. You will find Safari lagging behind, but that is what transcoding is for.
  7. For JPEG2000 some developers have been concerned about submarine patents (LoC digitalpreservation), and in 2009 Mozilla tagged it as WONTFIX.
  8. Decoding of JPEG 2000 images in PDFs is fully supported, so uploaders of PDF files need not worry about the format being unsupported in this use case

參見