去除视频缩略图上的黑条 [英] Removing black bars off video thumbnail

查看:38
本文介绍了去除视频缩略图上的黑条的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有画廊,用户可以在其中提交指向视频的 Youtube 链接,服务器会自动从 Youtube 获取缩略图.但是,许多视频在图像的顶部和底部都包含黑条.我知道黑条的来源,但是当我将缩略图调整为正方形时,黑条会干扰设计.

I have gallery where user can submit Youtube links to videos and server fetches the thumbnail from Youtube automatically. However, lots of videos contain black bars on top and bottom of the image. I know the origin of the black bars, but as i resize thumbnail to square, the black bars interfere with the design.

我尝试从上到下分析像素颜色,直到找不到黑色为止 (imagecolorat()),但它仍然留下一些接近黑色的颜色,因此小条仍然存在于图像.

I have tried to analyze pixel color from top to bottom until no black color is found (imagecolorat()), but it still leaves some near-black color so the small bars still reside in the image.

有什么更有效的算法可以检查?

What can be more effective algorythm to check for?

推荐答案

如果你想看颜色,wideimage图书馆(基于GD)已经实现了这个.该方法称为 autoCrop,一个 存在在线演示.

If you want to go by the color, the wideimage library (GD based) has this implemented already. The method is called autoCrop, an online demonstration exists.

这可能已经满足您的需求.

This might already fulfil your needs.

这篇关于去除视频缩略图上的黑条的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆