I think I understand what you mean now, but processing images on core does not really fit with our use case for them. We don’t store the thumbnails for these embeds, we fetch them directly from YouTube when we need them.
That being said, identifying which images should be cropped shouldn’t be that difficult. You can look at the URL for this:
https://img.youtube.com/vi/dsVAzSG6SbM/hqdefault.jpg
maxresdefault
- It’s always 16:9.
- It’s the highest resolution.
- Not always available.
hqdefault
- It’s always 4:3.
- If the original video is 16:9, it adds black bars.
mqdefault
- It’s always 16:9.
- It’s even lower resolution than
hqdefault.
While a tad weird, they are predictable. My guess is that the 4:3 format is a legacy size they still use for the sake of compatibility.
For displaying 16:9 images, it’s as simple as fixing the aspect ratio. If you need other aspect ratios, I think you should be good passing a flag and compensating the scale with CSS.
It’s true that the composer preview can be improved, but this could be done with a similar approach as described above.
The only edge case I can see with this approach is with vertical videos with low-res thumbnails. In that case, the black bars are not shown. ![]()
