我們正在更新 Data API,以符合 YouTube 計算 Shorts 觀看次數的方式。
瞭解詳情
Thumbnails
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
thumbnail
資源會識別與資源相關聯的不同縮圖大小。請注意縮圖的下列特性:
- 資源的
snippet.thumbnails
屬性是物件,可識別該資源可用的縮圖。 thumbnail
資源包含一系列物件。每個物件的名稱 (default
、medium
、high
等) 是指縮圖大小。- 不同類型的資源可能支援不同大小的縮圖。
- 不同類型的資源可能會為同名縮圖定義不同大小。舉例來說,
default
video
資源的縮圖通常為 120 x 90 像素,default
channel
資源的縮圖通常為 88 x 88 像素。 - 視上傳至 YouTube 的原始圖片或內容解析度而定,相同類型的資源仍可能出現不同大小的縮圖。舉例來說,HD 影片支援的縮圖解析度可能比非 HD 影片更高。
- 每個包含縮圖大小資訊的物件都有
width
屬性和 height
屬性。不過,系統可能不會傳回該圖片的寬度和高度屬性。 - 如果上傳的縮圖不符合規定尺寸,系統會調整圖片大小,使其符合正確尺寸,但不會變更顯示比例。圖片不會經過裁剪,但可能包含黑邊,以確保大小正確。
方法
這個 API 支援 thumbnails
資源的下列方法:
- 設定
- 將自訂影片縮圖上傳至 YouTube,並設為影片縮圖。
資源表示法
下列 JSON 結構顯示 thumbnails
資源的格式:
{
"default": {
"url": string,
"width": unsigned integer,
"height": unsigned integer
},
"medium": {
"url": string,
"width": unsigned integer,
"height": unsigned integer
},
"high": {
"url": string,
"width": unsigned integer,
"height": unsigned integer
},
"standard": {
"url": string,
"width": unsigned integer,
"height": unsigned integer
},
"maxres": {
"url": string,
"width": unsigned integer,
"height": unsigned integer
}
}
屬性
下表定義這個資源中顯示的屬性:
屬性 |
default |
object
預設縮圖。影片的預設縮圖 (或參照影片的資源,例如播放清單項目或搜尋結果) 寬度為 120 像素,高度為 90 像素。頻道的預設縮圖寬度和高度皆為 88 像素。 |
default.url |
string
圖片的網址。 |
default.width |
unsigned integer
圖片寬度。 |
default.height |
unsigned integer
圖片的高度。 |
medium |
object
縮圖圖片的高解析度版本。如果是影片 (或參照影片的資源),這張圖片的寬度為 320 像素,高度為 180 像素。如果是頻道,這張圖片的寬度和高度都是 240 像素。 |
medium.url |
string
圖片的網址。 |
medium.width |
unsigned integer
圖片寬度。 |
medium.height |
unsigned integer
圖片的高度。 |
high |
object
縮圖圖片的高解析度版本。如果是影片 (或參照影片的資源),這張圖片的寬度為 480 像素,高度為 360 像素。如果是頻道,這張圖片的寬度和高度都是 800 像素。 |
high.url |
string
圖片的網址。 |
high.width |
unsigned integer
圖片寬度。 |
high.height |
unsigned integer
圖片的高度。 |
standard |
object
比 high 解析度圖片更高的縮圖版本。這張圖片適用於部分影片,以及參照影片的其他資源,例如播放清單項目或搜尋結果。這張圖片的寬度為 640 像素,高度為 480 像素。 |
standard.url |
string
圖片的網址。 |
standard.width |
unsigned integer
圖片寬度。 |
standard.height |
unsigned integer
圖片的高度。 |
maxres |
object
縮圖圖片的最高解析度版本。部分影片和其他參照影片的資源 (例如播放清單項目或搜尋結果) 會顯示這個尺寸的圖片。這張圖片的寬度為 1280 像素,高度為 720 像素。 |
maxres.url |
string
圖片的網址。 |
maxres.width |
unsigned integer
圖片寬度。 |
maxres.height |
unsigned integer
圖片的高度。 |
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-08-21 (世界標準時間)。
[null,null,["上次更新時間:2025-08-21 (世界標準時間)。"],[[["\u003cp\u003eA resource's \u003ccode\u003esnippet.thumbnails\u003c/code\u003e property contains an object, and each of these objects has properties such as \u003ccode\u003edefault\u003c/code\u003e, \u003ccode\u003emedium\u003c/code\u003e, and \u003ccode\u003ehigh\u003c/code\u003e, which identify the different available thumbnail image sizes for that specific resource.\u003c/p\u003e\n"],["\u003cp\u003eThumbnail image sizes can vary significantly between different resource types (e.g., videos vs. channels), and even among resources of the same type, based on the resolution of the original uploaded content.\u003c/p\u003e\n"],["\u003cp\u003eEach thumbnail image size object contains a \u003ccode\u003eurl\u003c/code\u003e, \u003ccode\u003ewidth\u003c/code\u003e, and \u003ccode\u003eheight\u003c/code\u003e property, but the width and height may not always be returned.\u003c/p\u003e\n"],["\u003cp\u003eWhen a custom thumbnail image is uploaded, it's resized to match the required dimensions without changing its aspect ratio, which may result in black bars being added.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003ethumbnails\u003c/code\u003e resource offers various image size options, such as \u003ccode\u003edefault\u003c/code\u003e, \u003ccode\u003emedium\u003c/code\u003e, \u003ccode\u003ehigh\u003c/code\u003e, \u003ccode\u003estandard\u003c/code\u003e, and \u003ccode\u003emaxres\u003c/code\u003e, each with distinct resolutions to accommodate different display needs.\u003c/p\u003e\n"]]],["Thumbnail resources define various image sizes (`default`, `medium`, `high`, etc.) for different resource types. Image dimensions vary by resource type and resolution. The `thumbnails` resource is an object within `snippet.thumbnails` that holds size-specific objects, each with `url`, `width`, and `height` properties. The `set` method allows uploading a custom video thumbnail. When the dimensions don't match, the image is resized, maintaining its aspect ratio, with possible added black bars.\n"],null,["# Thumbnails\n\nA **thumbnail** resource identifies different thumbnail image sizes associated with a resource. Please note the following characteristics of thumbnail images:\n\n- A resource's `snippet.thumbnails` property is an object that identifies the thumbnail images available for that resource.\n- A `thumbnail` resource contains a series of objects. The name of each object (`default`, `medium`, `high`, etc.) refers to the thumbnail image size.\n- Different types of resources may support different thumbnail image sizes.\n- Different types of resources may define different sizes for thumbnail images with the same name. For example, the `default` thumbnail image for a `video` resource is typically 120px by 90px, and the `default` thumbnail image for a `channel` resource is typically 88px by 88px.\n- Resources of the same type may still have different thumbnail image sizes for certain images depending on the resolution of the original image or content uploaded to YouTube. For example, an HD video may support higher resolution thumbnails than non-HD videos.\n- Each object that contains information about a thumbnail image size has a `width` property and a `height` property. However, the width and height properties may not be returned for that image.\n- If an uploaded thumbnail image does not match the required dimensions, the image is resized to match the correct size without changing its aspect ratio. The image is not cropped, but may include black bars so that the size is correct.\n\n\u003cbr /\u003e\n\nMethods\n-------\n\nThe API supports the following methods for `thumbnails` resources:\n\n[set](/youtube/v3/docs/thumbnails/set)\n: Uploads a custom video thumbnail to YouTube and sets it for a video.\n\nResource representation\n-----------------------\n\nThe following JSON structure shows the format of a `thumbnails` resource: \n\n```text\n{\n \"default\": {\n \"url\": string,\n \"width\": unsigned integer,\n \"height\": unsigned integer\n },\n \"medium\": {\n \"url\": string,\n \"width\": unsigned integer,\n \"height\": unsigned integer\n },\n \"high\": {\n \"url\": string,\n \"width\": unsigned integer,\n \"height\": unsigned integer\n },\n \"standard\": {\n \"url\": string,\n \"width\": unsigned integer,\n \"height\": unsigned integer\n },\n \"maxres\": {\n \"url\": string,\n \"width\": unsigned integer,\n \"height\": unsigned integer\n }\n}\n```\n\n### Properties\n\nThe following table defines the properties that appear in this resource:\n\n| Properties ||\n|-------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `default` | `object` The default thumbnail image. The default thumbnail for a video -- or a resource that refers to a video, such as a playlist item or search result -- is 120px wide and 90px tall. The default thumbnail for a channel is 88px wide and 88px tall. |\n| default.`url` | `string` The image's URL. |\n| default.`width` | `unsigned integer` The image's width. |\n| default.`height` | `unsigned integer` The image's height. |\n| `medium` | `object` A higher resolution version of the thumbnail image. For a video (or a resource that refers to a video), this image is 320px wide and 180px tall. For a channel, this image is 240px wide and 240px tall. |\n| medium.`url` | `string` The image's URL. |\n| medium.`width` | `unsigned integer` The image's width. |\n| medium.`height` | `unsigned integer` The image's height. |\n| `high` | `object` A high resolution version of the thumbnail image. For a video (or a resource that refers to a video), this image is 480px wide and 360px tall. For a channel, this image is 800px wide and 800px tall. |\n| high.`url` | `string` The image's URL. |\n| high.`width` | `unsigned integer` The image's width. |\n| high.`height` | `unsigned integer` The image's height. |\n| `standard` | `object` An even higher resolution version of the thumbnail image than the `high` resolution image. This image is available for some videos and other resources that refer to videos, like playlist items or search results. This image is 640px wide and 480px tall. |\n| standard.`url` | `string` The image's URL. |\n| standard.`width` | `unsigned integer` The image's width. |\n| standard.`height` | `unsigned integer` The image's height. |\n| `maxres` | `object` The highest resolution version of the thumbnail image. This image size is available for some videos and other resources that refer to videos, like playlist items or search results. This image is 1280px wide and 720px tall. |\n| maxres.`url` | `string` The image's URL. |\n| maxres.`width` | `unsigned integer` The image's width. |\n| maxres.`height` | `unsigned integer` The image's height. |"]]