繁体   English   中英

谁能建议启发式方法来获取 web 页面并确定使用的主要 colors 吗?

[英]Can anyone suggest heuristics to take a web page and identify the dominant colors used?

I want to write server-side software, to run on Google App Engine (so it must be pure-Java), that can identify the dominant colors used in a web page, particularly the foreground (text), header, and background colors.

The problem is that the colors used may be specified in CSS, the HTML, or possibly in image files linked to either from the CSS, or the HTML.

一种可能的方法是将 web 页面呈现为图像,然后执行类似操作,但是我需要一个纯 Java 库,它可以合理地将 web 页面呈现为图像。

另一种可能性是以某种方式分析 HTML、CSS 和任何链接图像以提取此信息。

由于无论如何您都必须进行一些图像处理才能从图片中获取 colors,因此我将尝试采用渲染页面的路线,然后确定占主导地位的 colors。

至于渲染,似乎 Java 上至少有 webkit 可用,所以它的 API 有你需要的吗?

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM