4

I don't understand at all why the YouTube API's thumbnails seem to include letter boxing for videos. If I want the thumbnail for this video, and use the methods shown here I can get the mqdefault version that is a little too small (but thankfully doesn't have letterboxing), but if I jump up to say the sddefault, which is a good size, I get:

enter image description here (http://img.youtube.com/vi/12fR9neVnS8/sddefault.jpg)

I really just want it without the letter-boxing. Do I have to crop it out myself programmatically? Is there a way to get decent-sized YouTube thumbnails without letter-boxing?

Community
  • 1
  • 1
Doug Smith
  • 29,668
  • 57
  • 204
  • 388

2 Answers2

3

Uploaded videos create three thumbnails in a 4:3 aspect ratio (default, medium and standard).

High definition videos also create another two thumbnails in 16:9 aspect ratio (high and maxres) as well as the 4:3 thumbs, which gives letter boxing on those.

For that video, these are the available thumbnails:

"thumbnails": {
 "default": {
  "url": "https://i.ytimg.com/vi/12fR9neVnS8/default.jpg",
  "width": 120,
  "height": 90
 },
 "medium": {
  "url": "https://i.ytimg.com/vi/12fR9neVnS8/mqdefault.jpg",
  "width": 320,
  "height": 180
 },
 "high": {
  "url": "https://i.ytimg.com/vi/12fR9neVnS8/hqdefault.jpg",
  "width": 480,
  "height": 360
 },
 "standard": {
  "url": "https://i.ytimg.com/vi/12fR9neVnS8/sddefault.jpg",
  "width": 640,
  "height": 480
 },
 "maxres": {
  "url": "https://i.ytimg.com/vi/12fR9neVnS8/maxresdefault.jpg",
  "width": 1280,
  "height": 720
 }

Sounds like you want https://i.ytimg.com/vi/12fR9neVnS8/maxresdefault.jpg

johnh10
  • 4,047
  • 1
  • 18
  • 30
-2

Doug... I have to do it programmatically (in my case, in C#).

Rather than styling with CSS, I am autocropping the thumbnail. I could not find a good way of detecting whether I had to style for fullscreen versions of thumbnails vs. widescreen (most solutions I found had to do with style the image as a background to get a cropping effect in the browser). My tool lets users put in whatever Youtube keys they want, so I have no control over what they pick.

I start by calling:

https://www.youtube.com/oembed?url=https://www.youtube.com/watch?v=VIDEOKEY&format=xml

and then I use the thumbnail property it returns to populate my video record (usually hqdefault.jpg). The c# function I found is linked below.

How to auto crop an image?

Community
  • 1
  • 1
Frog Pr1nce
  • 730
  • 9
  • 8