How do you find the “main” picture of a website, given the URL?

后端 未结 4 1884
眼角桃花
眼角桃花 2021-02-05 13:59

Let\'s say you\'re given http://nytimes.com How would you pull out the \"main\" image?

The reason I\'m asking is because Flipboard is able to grab the main image from a

4条回答
  •  说谎
    说谎 (楼主)
    2021-02-05 14:13

    Facebook allows the user to pick one of several images that it has deemed to be a "main" image. As far as automatically determining a "main" image, I would judge it based on page position, size, relation to text, and (if you wanted to be more sophisticated) its visual content.

    For example, you could use a simple face detection program, or look at color breakdowns to determine if the picture was "interesting" to you or not.

    EDIT: In the case of www.nytimes.com, I would probably just look at the page structure, because a large carousel of images is located right underneath an H1 tag.

提交回复
热议问题