WO2015085785A1 - Method and apparatus for automatic page graying - Google Patents

Method and apparatus for automatic page graying Download PDF

Info

Publication number
WO2015085785A1
WO2015085785A1 PCT/CN2014/084370 CN2014084370W WO2015085785A1 WO 2015085785 A1 WO2015085785 A1 WO 2015085785A1 CN 2014084370 W CN2014084370 W CN 2014084370W WO 2015085785 A1 WO2015085785 A1 WO 2015085785A1
Authority
WO
WIPO (PCT)
Prior art keywords
picture
page
color
grayscale
path information
Prior art date
Application number
PCT/CN2014/084370
Other languages
French (fr)
Chinese (zh)
Inventor
李成银
Original Assignee
北京奇虎科技有限公司
奇智软件(北京)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 北京奇虎科技有限公司, 奇智软件(北京)有限公司 filed Critical 北京奇虎科技有限公司
Publication of WO2015085785A1 publication Critical patent/WO2015085785A1/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/451Execution arrangements for user interfaces
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/957Browsing optimisation, e.g. caching or content distillation
    • G06F16/9577Optimising the visualization of content, e.g. distillation of HTML documents

Abstract

A method and apparatus for automatic page graying. The method comprises: obtaining the source program codes of a page; from the source program codes of the page, identifying and obtaining the name and storage path information of a picture in the page and a color value corresponding to a color variable; obtaining the picture according to the name and storage path information of the picture, converting the picture to a gray-level picture, and correspondingly setting the storage information of the gray-level picture and the storage information of the picture in the source program codes of the page; converting the color value corresponding to the color variable to a gray-level value, and by virtue of the gray-level value, updating the color value corresponding to the color variable in the source program codes of the page. The updated source program codes of the page are used for a website server which sends a message carrying corresponding page content to a browser client according to a page request from the browser client.

Description

页面自动变灰的方法和装置  Method and device for automatically graying pages
技术领域 Technical field
本发明涉及网络通讯技术,具体涉及一种页面自动变灰的方法以及页面自 动变灰的装置。 背景技术  The present invention relates to network communication technologies, and in particular, to a method for automatically graying a page and a device for automatically graying a page. Background technique
网站有时会有将其页面变灰的需求, 例如, 在国家遇到重大灾难或者到某 些纪念日时, 为了表示哀悼或者缅怀等情感, 很多网站都会将其页面变成灰度 页面。  Websites sometimes have the need to gray out their pages. For example, in the event of a major disaster in the country or on certain anniversaries, many websites turn their pages into grayscale pages in order to express feelings of mourning or memory.
现有的将页面变灰的方式通常为:网站服务器在接收到浏览器客户端通过 其所在的终端设备发送来的请求消息后, 在其向浏览器客户端下发的消息(如 HTTP消息) 的消息内容中插入滤镜属性或者 GSS3 gray参数等, 并向浏览器客 户端所在的终端设备下发该消息;浏览器客户端在终端设备接收到服务器下发 的消息后, 对该消息进行解析和渲染处理, 且浏览器客户端会在解析和渲染处 理过程中根据消息中的滤镜属性或者 GSS3 gray参数对该消息中的图片或者字 体或者背景等的颜色进行相应的处理,从而浏览器客户端为用户呈现出灰度页 面。  The existing method of graying out a page is usually: a message (such as an HTTP message) sent by the website server to the browser client after receiving the request message sent by the browser client through the terminal device where the browser client is located. The message content is inserted into the filter attribute or the GSS3 gray parameter, and the message is sent to the terminal device where the browser client is located; the browser client parses the message after the terminal device receives the message sent by the server. And rendering processing, and the browser client will process the image or the color of the font or the background in the message according to the filter property or the GSS3 gray parameter in the parsing and rendering process, so that the browser client The end presents a grayscale page for the user.
发明人在实现本发明过程中发现,利用上述方式将页面变灰由于需要浏览 器客户端在页面解析和渲染过程中进行变色处理, 因此, 浏览器客户端向用户 显示页面的速度会受到很大的影响, 在页面内容较多的情况下, 会出现浏览器 客户端无法向用户正常显示页面的情况。 另外, 为了避免页面显示速度问题, 网站服务器通常仅会在网站首页内容下发时,在消息的消息内容中插入滤镜属 性或者 GSS3 gray参数等, 这样, 除了网站首页之外的网页往往不会被显示为 灰度页面。 发明内容  In the process of implementing the present invention, the inventor has found that graying out a page by using the above method requires a browser client to perform color change processing during page parsing and rendering, so that the speed of the browser client displaying the page to the user is greatly affected. The effect, in the case of more page content, there will be a situation where the browser client cannot display the page to the user normally. In addition, in order to avoid the problem of page display speed, the web server usually only inserts the filter attribute or the GSS3 gray parameter in the message content of the message when the content of the website home page is delivered, so that the webpage other than the homepage of the website often does not Displayed as a grayscale page. Summary of the invention
鉴于上述问题,提出了本发明以便提供一种克服上述问题或者至少部分地 解决上述问题的页面自动变灰的方法以及相应的页面自动变灰的装置。  In view of the above problems, the present invention has been made in order to provide a method of automatically graying a page that overcomes the above problems or at least partially solves the above problems, and a corresponding apparatus for automatically graying a page.
依据本发明的一个方面,提供了一种页面自动变灰的方法,所述方法包括: 获取页面的源程序代码; 从页面的源程序代码中识别并获取页面中图片的名 称、 图片的存储路径信息以及颜色变量对应的颜色值; 根据所述图片的名称和 存储路径信息获取图片, 将所述图片转换为灰度图片, 并将所述灰度图片的存 储信息与所述图片在所述页面的源程序代码中的存储信息对应设置;将该颜色 变量对应的颜色值转换为灰度值,并利用所述灰度值更新所述页面的源程序代 码中颜色变量对应的颜色值;所述更新后的页面的源程序代码用于网站服务器 根据浏览器客户端的页面请求向浏览器客户端下发承载有相应页面内容的消 息。 According to an aspect of the present invention, a method for automatically graying a page is provided, the method comprising: acquiring source code of a page; identifying and obtaining a name of a picture in the page, and a storage path of the image from source code of the page. Information and a color value corresponding to the color variable; acquiring a picture according to the name of the picture and the storage path information, converting the picture into a grayscale picture, and storing the information of the grayscale picture and the picture on the page The stored information in the source code corresponds to the setting; the color Converting a color value corresponding to the variable into a gray value, and updating the color value corresponding to the color variable in the source code of the page by using the gray value; the source code of the updated page is used by the website server according to browsing The page request of the client sends a message carrying the content of the corresponding page to the browser client.
根据本发明的另一方面, 提供了一种页面自动变灰的装置, 其中, 所述装 置包括: 获取模块, 适于获取页面的源程序代码; 识别模块, 适于从页面的源 程序代码中识别并获取页面中图片的名称、图片的存储路径信息以及颜色变量 对应的颜色值; 第一转换模块, 适于根据所述图片的名称和存储路径信息获取 图片, 将所述图片转换为灰度图片, 并将所述灰度图片的存储与所述图片在所 述页面的源程序代码中的存储信息对应设置; 第二转换模块, 适于将所述颜色 变量对应的颜色值转换为灰度值,并利用所述灰度值更新所述页面的源程序代 码中颜色变量对应的颜色值;所述更新后的页面的源程序代码用于网站服务器 根据浏览器客户端的页面请求向浏览器客户端下发承载有相应页面内容的消 息。  According to another aspect of the present invention, an apparatus for automatically graying out a page is provided, wherein the apparatus includes: an acquisition module adapted to acquire source code of a page; and an identification module adapted to be from source code of the page Identifying and acquiring the name of the picture in the page, the storage path information of the picture, and the color value corresponding to the color variable; the first conversion module is adapted to acquire a picture according to the name of the picture and the storage path information, and convert the picture into a grayscale a picture, and the storage of the grayscale picture is corresponding to the storage information of the picture in the source code of the page; the second conversion module is adapted to convert the color value corresponding to the color variable into a grayscale And using the gray value to update a color value corresponding to the color variable in the source code of the page; the source code of the updated page is used by the website server to request a browser client according to a page request of the browser client The terminal sends a message carrying the content of the corresponding page.
根据本发明的又一个方面, 提供了一种计算机程序, 其包括计算机可读代 码,当所述计算机可读代码在服务器上运行时,导致所述服务器执行上述方法。  According to still another aspect of the present invention, a computer program comprising computer readable code causing the server to perform the above method when the computer readable code is run on a server is provided.
根据本发明的再一个方面, 提供了一种计算机可读介^, 其中存储了上述 计算机程序。  According to still another aspect of the present invention, a computer readable medium is provided in which the above computer program is stored.
本发明的页面自动变灰的方法以及装置通过对页面的源程序代码进行识 别,可以方便快捷准确的获得页面中的图片的存储路径信息以及颜色变量对应 的颜色值, 通过将存储路径信息对应的图片转换为灰度图片, 将颜色值转换为 灰度值,并将灰度图片的存储位置与图片在页面的源程序代码中的存储路径信 息对应设置,将灰度值更新页面的源程序代码中颜色变量对应的颜色值,这样, 利用更新后的源程序代码向浏览器客户端下发的页面内容即为基于灰度页面 的页面内容, 从而本发明在不需要浏览器客户端执行变色处理的情况下, 即可 为用户呈现出灰度页面; 而且, 为用户呈现的灰度页面不仅可以是网站首页, 还可以是其他页面; 另外, 由于向用户下发的页面内容中的图片为灰度图片, 而不是彩色图片, 因此, 本发明还可以提高页面访问速度。  The method and device for automatically graying out the page of the present invention can obtain the storage path information of the picture in the page and the color value corresponding to the color variable conveniently, quickly and accurately by identifying the source code of the page, by corresponding to the storage path information. The image is converted into a grayscale image, the color value is converted into a grayscale value, and the storage location of the grayscale image is set corresponding to the storage path information of the image in the source code of the page, and the grayscale value is updated to the source code of the page. The color value corresponding to the color variable, so that the page content delivered to the browser client by using the updated source code is the page content based on the grayscale page, so that the present invention does not require the browser client to perform the color changing process. In the case of the user, the grayscale page can be presented to the user; and the grayscale page presented to the user can be not only the homepage of the website but also other pages; in addition, the image in the content of the page delivered to the user is grayed out. Degree picture, not color picture, therefore, the present invention can also improve page access speed degree.
上述说明仅是本发明技术方案的概述,为了能够更清楚了解本发明的技术 手段,而可依照说明书的内容予以实施,并且为了让本发明的上述和其它目的、 特征和优点能够更明显易懂, 以下特举本发明的具体实施方式。 附图说明  The above description is only an overview of the technical solutions of the present invention, and the above-described and other objects, features and advantages of the present invention can be more clearly understood. Specific embodiments of the invention are set forth below. DRAWINGS
通过阅读下文优选实施方式的详细描述,各种其他的优点和益处对于本领 域普通技术人员将变得清楚明了。 说明书附图仅用于示出优选实施方式的目 的, 而并不认为是对本发明的限制。 而且在整个附图中, 用相同的参考符号表 示相同的部件。 在附图中: Various other advantages and benefits are obtained by reading the detailed description of the preferred embodiments below. The person skilled in the art will become clear to the skilled person. The drawings are only for the purpose of illustrating the preferred embodiments and are not intended to limit the invention. Throughout the drawings, the same reference numerals are used to refer to the same parts. In the drawing:
图 1示出了根据本发明实施例一的页面自动变灰的方法流程图;  1 is a flow chart showing a method for automatically graying a page according to a first embodiment of the present invention;
图 2示出了根据本发明实施例二的页面自动变灰的装置示意图;  2 is a schematic diagram of an apparatus for automatically graying a page according to Embodiment 2 of the present invention;
图 3示出了用于执行本发明的方法的通信设备的框图; 以及  Figure 3 shows a block diagram of a communication device for performing the method of the present invention;
图 4示出了用于保持或者携带实现根据本发明的方法的程序代码的存储单 元示意图。 具体实施方式  Figure 4 shows a schematic diagram of a memory unit for holding or carrying program code implementing a method in accordance with the present invention. detailed description
下面将参照附图更详细地描述本公开的示例性实施例。虽然附图中显示了 本公开的示例性实施例, 然而应当理解, 可以以各种形式实现本公开而不应被 这里阐述的实施例所限制。相反, 提供这些实施例是为了能够更透彻地理解本 公开, 并且能够将本公开的范围完整的传达给本领域的技术人员。  Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While the exemplary embodiments of the present invention are shown in the drawings, it is understood that the invention may be embodied in various forms and not limited by the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be more fully understood, and the scope of the disclosure will be fully disclosed to those skilled in the art.
实施例一、 页面自动变灰的方法。 下面结合图 1对本实施例的方法进行详 细说明。  Embodiment 1 A method for automatically graying a page. The method of this embodiment will be described in detail below with reference to FIG.
图 1中, S1 00、 获取页面的源程序代码。  In Figure 1, S1 00, get the source code of the page.
具体的, 本实施例中的页面也可以称为 WEB页面, 且该 WEB页面可以是网站 首页的 WEB页面, 也可以是网站首页下的子链接对应的 WEB页面。  Specifically, the page in this embodiment may also be referred to as a WEB page, and the WEB page may be a WEB page of a website homepage, or may be a WEB page corresponding to a sub-link under the website homepage.
WEB页面通常会引用 Javascr i pt、 CSS (Cascad i ng Sty l e Sheets , 级联样 式表) 、 图片、 F l ash以及视频等资源。 WEB页面的源程序代码主要用于设计网 等 M 、 ― 、 一 本步骤中的获取页面的源程序代码可以包括:获取需要进行页面变灰处理 的页面所对应的源程序代码的文件名称等,进而根据该文件名称获取到页面的 源程序代码。 WEB pages typically reference resources such as Javascr i pt, CSS (Cascad i ng Sty le Sheets), images, F ash, and video. WEB page source code is mainly used to design nets M, -, obtaining a page of the source code may include the step of: obtaining the file name, etc. Page required page dimmed process corresponding source code, The source code of the page is obtained according to the file name.
S1 1 0、从页面的源程序代码中识别并获取页面中图片的名称、 图片的存储 路径信息以及颜色变量对应的颜色值, 之后, 分别到 S1 20以及 S1 30。  S1 1 0. Identify and obtain the name of the picture in the page, the storage path information of the picture, and the color value corresponding to the color variable from the source code of the page, and then go to S1 20 and S1 30 respectively.
具体的,本步骤需要在页面的源程序代码中查找需要进行颜色变灰处理的 内容 (也即对象或者颜色转换对象) 。 在通常情况下, WEB网页中需要将颜色 变为灰色的内容主要是图片以及 GSS中所使用的颜色 (如背景颜色以及字体颜 色等) , 也就是说, 本发明实施例需要针对图片以及 GSS中所使用的颜色进行 识别, 识别过程中所使用到的关键词 (也可以称为特定字符) 可以包括图片标 签如 " i mg" 等, 也可以包括图片名称后缀, 如 " . png" 或者 " . jpg" 等; 还 可以包括颜色变量的名称, 如 " color: " 等。 Specifically, in this step, the content of the source code of the page needs to be searched for content that needs to be grayed out (that is, an object or a color conversion object). In the normal case, the content that needs to be grayed out in the WEB webpage is mainly the image and the color used in the GSS (such as the background color and the font color, etc.), that is, the embodiment of the present invention needs to be directed to the image and the GSS. the colors used for the identification, the identification process is used to keywords (also referred to as a specific character) may comprise tags such as image "i mg" and the like, may also include a picture name suffixes, such as ". pn g" or ".jpg"etc; also You can include the name of the color variable, such as " color: " and so on.
一个具体的例子, 设定一页面的源程序代码既包含有 HTML代码, 还包含有 GSS代码, 且 HTML代码和 GSS代码分别如下:  A specific example, the source code of a page is set to contain both HTML code and GSS code, and the HTML code and GSS code are as follows:
HTML代码:  HTML code:
< I i nk re I ="sty I esheet" type="text/css" href= ".. /.. /resources/css/gray. css"> <header> < I i nk re I ="sty I esheet" type="text/css" href= ".. /.. /resources/css/gray. css"> <header>
<img src=".. /. / resources/ img/ logo. png">  <img src=".. /. / resources/ img/ logo. png">
</header> </header>
<d i v c I ass="c I s"> <d i v c I ass="c I s">
新一代安全上网导航  A new generation of secure Internet navigation
</div>  </div>
<div> <div>
<img src=".. /.. / resources/ img/ 1. jpg">  <img src=".. /.. / resources/ img/ 1. jpg">
</div> </div>
CSS代码: CSS code:
. c I s { . c I s {
background - co I or : #888;  Background - co I or : #888;
padding: 1 Opx 0;  Padding: 1 Opx 0;
color: #00ff00;  Color: #00ff00;
}  }
header { Header {
color :#ff 0000 ; Color :#ff 0000 ;
background- i mage: ur I (.. /img/2. jpg);  Background- i mage: ur I (.. /img/2. jpg);
padding: 10px 0;  Padding: 10px 0;
}  }
在上述 HTML代码中, 涉及到的图片包括 " logo, png"和 " 1. jpg" ; 其中, 图片 "logo, png"的存储路径信息为" .././resources/ img〃,, 而图片 "1. jpg" 的存储路径信息为 "../../resources/img/"。 通过利用正则表达式 (如包括 "img" 、 ". jpg" 以及 ".png" 在内的正则表达式) 等方式对上述 HTML代码 进行识别 , 可以准确定位出 图 片 " logo, png " 的存储路径信息 " .././resources/ img/ " 以 及 图 片 " 1. jpg " 的 存 储路 径 信 息 "../../ resources/ img/" 。  In the above HTML code, the images involved include "logo, png" and "1.jpg"; wherein the storage path information of the image "logo, png" is ".././resources/img〃," and the image The storage path information for "1. jpg" is "../../resources/img/". By using regular expressions (such as regular expressions including "img", ".jpg", and ".png" ) By identifying the above HTML code, you can accurately locate the storage path information ".././resources/ img/ " of the image " logo, png " and the storage path information of the image " 1. jpg "../ ../ resources/ img/" .
在上述 GSS代码中,所使用到的颜色值包括: .cls中的" #888"和" #00ff00" 以及 header中的 "#ff0000" , 且上述 GSS代码中还涉及到图片 "2. jpg" 。 通 过利用正则表达式 (如包括 " color: "在内的正则表达式) 等方式对上述 GSS 代码进行识别, 可以准确定位出颜色值" #888"、 "#00ff00"以及" #ff0000"; 通过正则表达式 (如包括 " img" 、 ". jpg" 以及 " .png"在内的正则表达式) 等方式对上述 GSS代码进行识别, 可以准确定位出图片 "2. jpg"的存储路径信 息 "../img〃, 。 In the above GSS code, the color values used include: #888" and "#00ff00" in .cls And "#ff0000" in the header, and the picture "2. jpg" is also involved in the above GSS code. By using regular expressions (such as regular expressions including "color: ") to identify the above GSS code, you can accurately locate the color values "#888", "#00ff00", and "#ff0000"; Regular expressions (such as regular expressions including "img", ".jpg", and ".png") identify the above GSS code, and can accurately locate the storage path information of the image "2.jpg". ../im g 〃, .
本步骤利用正则表达式(如利用 " img"、 ". jpg"、 ". png"、 "color: " 以及 "/" 等特定字符形成的正则表达式) 等方式从源程序代码中识别并获取 图片的存储路径信息以及颜色变量对应的颜色值的具体实现过程在此不再详 细说明。  This step uses regular expressions (such as regular expressions formed by specific characters such as "img", ".jpg", ".png", "color:", and "/" to identify and retrieve from source code. The specific implementation process of the storage path information of the picture and the color value corresponding to the color variable will not be described in detail herein.
S120、根据识别获取到的图片的名称以及存储路径信息获取图片, 之后到 S121。  S120. Acquire a picture according to the name of the captured image and the storage path information, and then go to S121.
具体的,根据上述识别而获取到的图片的名称以及图片的存储路径信息可 以准确的定位到唯一的一张图片, 从而可以获取到唯一的一张图片。  Specifically, the name of the picture obtained according to the above identification and the storage path information of the picture can be accurately located to a unique picture, so that a unique picture can be obtained.
S121、 将该图片转换为灰度图片, 之后, 到 S122。  S121. Convert the picture into a grayscale picture, and then go to S122.
具体的,本实施例可以采用现有的图片转换工具将获取到的图片转换为灰 度图片, 例如, 本实施例可以通过调用 Imagemagic函数库中的图像过滤器函数 将上述获取到的图片转换为灰度图片; 再例如, 通过调用 Phpgd函数库中的图 像过滤器函数将上述获取到的图片转换为灰度图片。  Specifically, in this embodiment, the acquired image can be converted into a grayscale image by using an existing image conversion tool. For example, in this embodiment, the acquired image can be converted into an image filter function in the Imagemagic function library. Grayscale picture; For example, the above acquired image is converted into a grayscale image by calling an image filter function in the Phpgd function library.
一个具体的例子, 在使用 Phpgd函数库中的图像过滤器函数将图片转换为 灰度图片可以使用下述程序代码实现:  A specific example, using the image filter function in the Phpgd library to convert a picture to a grayscale image can be implemented using the following program code:
$ img = i magecreatef rompng ( $f i lePath );  $ img = i magecreatef rompng ( $f i lePath );
i magef i Iter ( $img, I MG—F I LTER—GRAYSGALE );  i magef i Iter ( $img, I MG—F I LTER—GRAYSGALE );
i magea I phab I end i ng ( $ img, false );  i magea I phab I end i ng ( $ img, false );
imagesavea Ipha ( $ img, true );  Imagesavea Ipha ( $ img, true );
imagepng ( $ i mg, $f i lePath );  Imagepng ( $ i mg, $f i lePath );
imagedestroy ( $ img );  Imagedestroy ( $ img );
其中, ^口果上述 fi lePath被设置为.. /. /resources/ img/ logo. png, 贝' J图 片 " logo, png" 被转换为灰度图片; 如果上述程序代码中的 fi lePath被设置 为.. /../resources/img/1. jpg, 则图片 "1. jpg"被转换为灰度图片; 如果上 述程序代码中的 f i lePath被设置为.. /img/2. jpg, 则图片 "2. jpg" 被转换为 灰度图片。  Among them, ^ mouth fruit above fi lePath is set to .. /. /resources/ img/ logo. png, Bay 'J picture " logo, png" is converted to grayscale picture; if the above code f fiPath is set For .. /../resources/img/1. jpg, the picture "1. jpg" is converted to grayscale image; if fi lePath in the above program code is set to .. /img/2. jpg, then The picture "2. jpg" is converted to a grayscale image.
S122、将该灰度图片的存储信息与图片在上述页面的源程序代码中的存储 信息对应设置。 具体的, 本步骤的主要目的是: 将页面的源程序代码中的图片的存储信息 与灰度图片的实际存储信息相对应,以便于在利用源程序代码形成具体的页面 时, 所提取到的图片为转换后的灰度图片, 而不是原来的图片 (如彩色图片)。 S122. The storage information of the grayscale picture is set corresponding to the storage information of the picture in the source program code of the page. Specifically, the main purpose of the step is to: corresponding to the storage information of the picture in the source code of the page and the actual storage information of the gray picture, so as to be extracted when the specific code is formed by using the source code. The picture is a converted grayscale image, not the original image (such as a color image).
上述存储信息可以为图片的存储路径信息以及图片名称,本实施例可以采 用下述四种方式实现上述对应设置:  The foregoing storage information may be the storage path information of the picture and the picture name. In this embodiment, the foregoing corresponding manner may be implemented in the following four manners:
方式一、将转换后的灰度图片按照页面的源程序代码中的相应图片 (即原 图片)的存储路径信息进行存储,且该灰度图片的图片名称与原图片的图片名 称相同, 从而使对应上述存储路径信息的原图片被转换后的灰度图片所覆盖; 即利用页面的源程序代码中的原图片的存储路径信息以及原图片的图片名称 可以获取到转换后的灰度图片。 该方式不需要对页面的源程序代码进行修改, 是一种较好的实现方式。  In the first method, the converted grayscale image is stored according to the storage path information of the corresponding image (ie, the original image) in the source code of the page, and the image name of the grayscale image is the same as the image name of the original image, thereby The original picture corresponding to the storage path information is overwritten by the converted grayscale picture; that is, the converted grayscale picture can be obtained by using the storage path information of the original picture in the source code of the page and the picture name of the original picture. This method does not need to modify the source code of the page, which is a better implementation.
方式二、将转换后的灰度图片按照页面的源程序代码中的相应图片 (即原 图片)的存储路径信息进行存储,且该灰度图片的图片名称与原图片的图片名 称不相同, 从而使转换后的灰度图片不会覆盖上述原图片; 本方式需要修改页 面的源程序代码中的原图片的图片名称,使修改后的源程序代码中的原图片的 存储路径信息和新的图片名称与灰度图片的实际存储路径信息和图片名称相 对应,即利用修改后的源程序代码中的原图片的存储路径信息以及转换后的灰 度图片的图片名称可以获取到转换后的灰度图片。 该方式保留了原图片。  In the second method, the converted grayscale image is stored according to the storage path information of the corresponding image (ie, the original image) in the source code of the page, and the image name of the grayscale image is different from the image name of the original image, thereby The converted grayscale image does not cover the original image; the method needs to modify the image name of the original image in the source code of the page, so that the storage path information and the new image of the original image in the modified source code are modified. The name corresponds to the actual storage path information of the grayscale picture and the picture name, that is, the converted gray level can be obtained by using the storage path information of the original picture in the modified source code and the picture name of the converted gray picture. image. This method retains the original picture.
方式三、转换后的灰度图片不再按照页面的源程序代码中的相应图片 (即 原图片) 的存储路径信息进行存储, 而是存储于其他地方, 从而使该灰度图片 对应一条不同于原图片的存储路径信息的新的存储路径信息, 但是, 该灰度图 片的图片名称可以与原图片的图片名称相同;本方式需要修改源程序代码中的 原图片的存储路径信息但不需要修改原图片的图片名称,使修改后的源程序代 码中的新的存储路径信息和原图片的图片名称与灰度图片的实际存储路径信 息和灰度图片的图片名称相对应,即利用修改后的源程序代码中的新的存储路 径信息以及原图片的图片名称可获取到转换后的灰度图片。该方式保留了原图 片。  In the third mode, the converted grayscale image is no longer stored according to the storage path information of the corresponding image (ie, the original image) in the source code of the page, but is stored in another place, so that the grayscale image corresponds to a different one. The new storage path information of the storage path information of the original picture, however, the picture name of the gray picture may be the same as the picture name of the original picture; this method needs to modify the storage path information of the original picture in the source code but does not need to be modified. The picture name of the original picture, so that the new storage path information in the modified source code and the picture name of the original picture correspond to the actual storage path information of the grayscale picture and the picture name of the grayscale picture, that is, the modified The new storage path information in the source code and the picture name of the original picture can obtain the converted grayscale picture. This method retains the original picture.
方式四、转换后的灰度图片不再按照页面的源程序代码中的相应图片 (即 原图片) 的存储路径信息进行存储, 而是存储于其他地方, 从而使该灰度图片 对应一条不同于原图片的存储路径信息的新的存储路径信息, 而且, 该灰度图 片的图片名称与原图片的图片名称不相同;本方式需要修改源程序代码中的原 图片的存储路径信息以及原图片的图片名称,使修改后的源程序代码中的新的 存储路径信息和新的图片名称与灰度图片的实际存储路径信息和灰度图片的 图片名称相对应,即利用修改后的源程序代码中的新的存储路径信息以及新的 图片名称可以获取到转换后的灰度图片。 该方式保留了原图片。 In the fourth method, the converted grayscale image is no longer stored according to the storage path information of the corresponding image (ie, the original image) in the source code of the page, but stored in another place, so that the grayscale image corresponds to a different one. The new storage path information of the storage path information of the original picture, and the picture name of the gray picture is different from the picture name of the original picture; this method needs to modify the storage path information of the original picture in the source code and the original picture. The picture name, so that the new storage path information and the new picture name in the modified source code correspond to the actual storage path information of the grayscale picture and the picture name of the grayscale picture, that is, using the modified source code New storage path information as well as new The image name can be obtained from the converted grayscale image. This method retains the original picture.
S130、 将颜色变量对应的颜色值转换为灰度值, 之后, 到 S131。  S130. Convert the color value corresponding to the color variable into a gray value, and then go to S131.
具体的, 本步骤的执行与上述 S120的执行没有必然的先后顺序限制, 如在 查找到一个需要进行颜色变灰处理的内容就执行一次转换的情况下, S120和 S130执行转换搡作的先后顺序取决于从网页的源程序代码中获取到的需要进 行颜色变灰处理的内容的先后顺序; 再例如, 在从网页的源程序代码中查找到 所有的需要进行颜色变灰处理的内容之后再执行转换的情况下, S120和 S130 在通常情况下会同时执行转换搡作。  Specifically, the execution of this step and the execution of the above S120 are not limited by a certain order. For example, in the case that a conversion is performed after finding a content that needs to be subjected to color graying processing, S120 and S130 perform the sequence of conversion operations. Depending on the order of the content that needs to be color-grayed from the source code of the webpage; for example, after finding all the content that needs to be grayed out from the source code of the webpage, execute In the case of conversion, S120 and S130 will perform conversion operations under normal conditions.
针对采用十六进制颜色值的背景颜色以及字体颜色等,将其颜色值转换为 灰度值时, 应先将该十六进制颜色值转换为 RGB颜色值, 然后, 再将 RGB颜色值 转换为灰度值。  When converting a color value to a gray value for a background color and a font color using a hexadecimal color value, the hexadecimal color value should be converted to an RGB color value first, and then the RGB color value Convert to grayscale values.
将十六进制颜色值转换为 RGB颜色值的一个具体例子如下所示:  A specific example of converting a hexadecimal color value to an RGB color value is as follows:
If (substr ($color,0, 1) =='#') {  If (substr ($color,0, 1) =='#') {
$co I or = substr ($color, 1);  $co I or = substr ($color, 1);
If (str len ($color) ==3) {  If (str len ($color) ==3) {
$co I or=$co I or {0} . $co I or {0} . $color {1} . $color {1} . $co I or {2} . $co I or {2}; $co I or=$co I or {0} . $co I or {0} . $color {1} . $color {1} . $co I or {2} . $co I or {2};
}  }
$co I or=hexdec ($color) ;  $co I or=hexdec ($color) ;
$R=0xFF& ($color»0x10) ;  $R=0xFF&($color»0x10);
$G=0xFF& ($color»0x8) ;  $G=0xFF&($color»0x8);
$B=0xFF&$color ;  $B=0xFF&$color ;
$co I or=ar ray (  $co I or=ar ray (
'R'=> $R,  'R'=> $R,
'G'=> $G,  'G'=> $G,
'B'=> $B  'B'=> $B
) ;  ) ;
}  }
在将十六进制的颜色值转换为 RGB颜色值后, 可以通过下面的公式 (1) 将 RGB颜色转换为灰度值:  After converting a hexadecimal color value to an RGB color value, the RGB color can be converted to a gray value by the following formula (1):
$gray=intval ($color['R'] X 0.299+$color [' G' ] X 0.587+$color [' B' ] X0.114 ); 公式 (1) $gray=intval ($color['R'] X 0.299+$color [' G' ] X 0.587+$color [' B' ] X0.114 ); Formula (1)
S131、利用上述转换后的灰度值更新页面的源程序代码中颜色变量对应的 颜色值。 S131. Using the converted gray value to update the color code corresponding to the source code of the page. Color value.
具体的, 针对 S1 10中例举的 GSS代码, 在将其所包含的十六进制的颜色 值 (即. c l s中的 "#888"和 "#00ff00" 以及 header中的 "#ff0000" ) 转换 为灰度值,并利用该灰度值替换页面的源程序代码中的颜色变量对应的颜色值 之后, GSS代码如下所示:  Specifically, for the GSS code exemplified in S1 10, the hexadecimal color value (ie, "#888" and "#00ff00" in the .cls and "#ff0000" in the header) are included. After converting to a gray value and replacing the color value corresponding to the color variable in the source code of the page with the gray value, the GSS code is as follows:
CSS代码: CSS code:
. c I s { . c I s {
background-co I or: #888888;  Background-co I or: #888888;
padd i ng : 10px 0 ;  Padd i ng : 10px 0 ;
co I or : #959595 ;  Co I or : #959595 ;
}  }
Header {  Header {
co I or : 4c4c4c;  Co I or : 4c4c4c;
background- i mage: ur I ( . . / i mg/2. jpg) ;  Background- i mage: ur I ( . . / i mg/2. jpg) ;
padd i ng : 10px 0 ;  Padd i ng : 10px 0 ;
}  }
经过上述处理后而形成的更新后的页面的源程序代码主要用于网站服务 器根据浏览器客户端的页面请求向浏览器客户端下发承载有相应页面内容的 消息。也就是说, 本实施例的方法还可以将经过上述处理后而形成的更新后的 页面的源程序代码上线, 使更新后的页面的源程序代码设置于网站服务器中。 一个具体的例子,在针对页面的源程序代码中的所有图片以及所有颜色变量均 处理完成后, 将页面的源程序代码上线, 之后, 网站服务器在接收到浏览器客 户端传输来的页面请求后,根据该页面对应的源程序代码向浏览器客户端下发 承载有基于灰度图片以及灰度值的页面内容的消息,从而浏览器客户端在接收 到该消息后, 直接对该消息进行解析和渲染, 即可为用户呈现出灰度页面。  The source code of the updated page formed after the above processing is mainly used by the website server to send a message carrying the content of the corresponding page to the browser client according to the page request of the browser client. That is to say, the method of this embodiment can also upload the source code of the updated page formed after the above processing, and set the source code of the updated page to the web server. A specific example, after all the images in the source code of the page and all the color variables are processed, the source code of the page is brought online, after which the web server receives the page request transmitted by the browser client. And sending, according to the source code corresponding to the page, a message carrying the page content based on the grayscale image and the grayscale value to the browser client, so that the browser client directly parses the message after receiving the message. And rendering, you can render the grayscale page for the user.
由上述描述可知, 在将彩色图片转换为灰度图片后, 可以大大减少图片的 文件大小, 如图片 1 . jpg的文件大小会从 1 10K减小到 38K, 从而本发明实施 例可以提升页面的访问速度, 使用户浏览页面更快捷。  It can be seen from the above description that after the color picture is converted into a gray picture, the file size of the picture can be greatly reduced, for example, the file size of the picture 1.jpg can be reduced from 1 10K to 38K, so that the embodiment of the present invention can improve the page. Access speed makes it faster for users to browse the page.
实施例二、 页面自动变灰的装置。该页面自动变灰的装置可以设置于开发 网页的设备中, 也可以设置于网站的服务器中。 下面结合图 2对本实施例的装 置进行详细说明。  Embodiment 2: A device for automatically graying a page. The device that is automatically grayed out on the page can be set in the device of the development webpage or in the server of the website. The apparatus of this embodiment will be described in detail below with reference to FIG.
图 2中示出的装置主要包括: 获取模块 200、 识别模块 210、 第一转换模 块 220以及第二转换模块 230。  The apparatus shown in FIG. 2 mainly includes: an acquisition module 200, an identification module 210, a first conversion module 220, and a second conversion module 230.
获取模块 200与识别模块 210连接;获取模块 200主要适于获取页面的源 程序代码。 The obtaining module 200 is connected to the identification module 210; the obtaining module 200 is mainly adapted to obtain the source of the page code.
具体的, 获取模块 200所获取的网页的源程序代码通常会包括 HTML程序 代码以及 GSS程序代码等。获取模块 200可以先获取需要进行页面变灰处理的 页面所对应的源程序代码的文件名称,进而可以根据该文件名称获得该页面的 源程序代码。  Specifically, the source code of the webpage acquired by the obtaining module 200 usually includes an HTML program code, a GSS program code, and the like. The obtaining module 200 may first obtain the file name of the source program code corresponding to the page that needs to be grayed out by the page, and further obtain the source code of the page according to the file name.
识别模块 210除了与获取模块 200连接之外,还与第一转换模块 220以及 第二转换模块 230分别连接;识别模块 210主要适于从页面的源程序代码中获 取页面中图片的名称、 图片的存储路径信息以及颜色变量对应的颜色值。  The identification module 210 is connected to the first conversion module 220 and the second conversion module 230 respectively in addition to the acquisition module 200. The identification module 210 is mainly adapted to obtain the name and picture of the picture in the page from the source code of the page. Stores path information and color values corresponding to color variables.
具体的,识别模块 210需要在页面的源程序代码中查找需要进行颜色变灰 处理的内容 (也即对象或者颜色转换对象) 。 在通常情况下, WEB网页中需要 将颜色变为灰色的内容主要是图片以及 GSS中所使用的颜色(如背景颜色以及 字体颜色等) , 也就是说, 识别模块 210需要针对图片以及 GSS中所使用的颜 色进行识别, 识别过程中所使用到的关键词 (也可以称为特定字符) 可以包括 图片标签如 "img" 等, 也可以包括图片名称后缀, 如 ". png" 或者 ". jpg" 等; 还可以包括颜色变量的名称, 如 " color: " 等。  Specifically, the identification module 210 needs to find the content (ie, the object or the color conversion object) that needs to be grayed out in the source code of the page. Under normal circumstances, the content of the WEB webpage that needs to change the color to gray is mainly the image and the color used in the GSS (such as the background color and the font color, etc.), that is, the identification module 210 needs to be targeted for the image and the GSS. The color used for recognition, the keywords used in the recognition process (also called specific characters) may include image tags such as "img", etc., and may also include image name suffixes, such as ". png" or ". jpg" Etc;; can also include the name of the color variable, such as "color:" and so on.
一个具体的例子, 设定一页面的源程序代码既包含有 HTML代码, 还包含 有 GSS代码, 且 HTML代码和 GSS代码分别如下:  A specific example, the source code of a page is set to contain both HTML code and GSS code, and the HTML code and GSS code are as follows:
HTML代码:  HTML code:
< I i nk re I ="sty I esheet" type="text/css" href= ".. /.. /resources/css/gray. css"> <header>  < I i nk re I ="sty I esheet" type="text/css" href= ".. /.. /resources/css/gray. css"> <header>
<img src=".. /. /resources/ img/ logo. png">  <img src=".. /. /resources/ img/ logo. png">
</header> </header>
<d i v c I ass="c I s"> <d i v c I ass="c I s">
新一代安全上网导航  A new generation of secure Internet navigation
</d i v> </d i v>
<div> <div>
<img src=".. /.. / resources/ i mg/1. jpg">  <img src=".. /.. / resources/ i mg/1. jpg">
</div> CSS代码: </div> CSS code:
. c I s { . c I s {
background - co I or : #888;  Background - co I or : #888;
padding: 1 Opx 0;  Padding: 1 Opx 0;
color: #00ff00; } Color: #00ff00 ; }
header { Header {
color :#ff 0000 ; Color :#ff 0000 ;
background- i mage: ur I (.. /img/2. jpg);  Background- i mage: ur I (.. /img/2. jpg);
padding: 1 Opx 0;  Padding: 1 Opx 0;
}  }
在上述 HTML代码中, 涉及到的图片包括" logo, png"和" 1. jpg"; 其中, 图片 "logo, png"的存储路径信息为" .././resources/ img〃,, 而图片 "1. jpg" 的存储路径信息为 "../../resources/img/"。 识别模块 210通过利用正则表 达式 (如包括 "img" 、 ". jpg" 以及 ".png" 在内的正则表达式) 等方式对 上述 HTML代码进行识别, 可以准确定位出图片 "logo, png" 的存储路径信息 " .././resources/ img/ " 以 及 图 片 " 1. jpg " 的 存 储路 径 信 息 "../../ resources/ img/" 。 In the above HTML code, the images involved include "logo, png" and "1.jpg"; wherein the storage path information of the image "logo, png" is ".././resources/img〃," and the image The storage path information of "1. jpg" is "../../resources/img/". The recognition module 210 utilizes regular expressions (such as including "im g " , ". jpg" and ".pn g " in The regular HTML expression identifies the above HTML code, and can accurately locate the storage path of the image "logo, png"" .././resources/ img/ " and the storage path of the image "1.jpg" Information "../../ resources/ img/".
在上述 GSS代码中,所使用到的颜色值包括: . c I s中的" #888"和" #00f f 00" 以及 header 中的 "#ff0000" , 且上述 GSS代码中还涉及到图片 "2. jpg" 。 识别模块 210通过利用正则表达式 (如包括 " color: " 在内的正则表达式) 等方式对上述 GSS代码进行识别, 可以准确定位出颜色值" #888"、 "#00ff00" 以及 "#ff0000" ; 识别模块 210通过正则表达式 (如包括 "img" 、 ". jpg" 以及 " . png"在内的正则表达式) 等方式对上述 GSS代码进行识别, 可以准确 定位出图片 "2. jpg" 的存储路径信息 "../img/" 。  In the above GSS code, the color values used include: "#888" and "#00f f 00" in the c I s and "#ff0000" in the header, and the image is also involved in the above GSS code" 2. jpg". The recognition module 210 can accurately identify the color values "#888", "#00ff00", and "#ff0000" by using a regular expression (such as a regular expression including "color:") to identify the GSS code. The recognition module 210 recognizes the above GSS code by means of a regular expression (such as a regular expression including "img", ".jpg", and ".png", and can accurately locate the picture "2. jpg "The storage path information"../img/" .
识别模块 210利用正则表达式 (如利用 "img" 、 ". jpg" 、 ".png" 、 "color: " 以及 " /"等特定字符形成的正则表达式) 等方式从源程序代码中 识别并获取图片的存储路径信息以及颜色变量对应的颜色值的具体实现过程 在此不再详细说明。  The recognition module 210 recognizes and recognizes from the source code by using regular expressions (such as regular expressions formed by specific characters such as "img", ".jpg", ".png", "color:", and "/"). The specific implementation process of obtaining the storage path information of the picture and the color value corresponding to the color variable is not described in detail herein.
第一转换模块 220与识别模块 210连接;第一转换模块 220主要适于根据 图片的名称和存储路径信息获取图片, 将图片转换为灰度图片, 并将该灰度图 片的存储与上述图片在页面的源程序代码中的存储信息对应设置。  The first conversion module 220 is connected to the identification module 210. The first conversion module 220 is mainly adapted to acquire a picture according to the name of the picture and the storage path information, convert the picture into a grayscale picture, and store the gray picture with the picture. The storage information in the source code of the page corresponds to the setting.
具体的,第一转换模块 220根据识别模块 210识别而获取到的图片的名称 以及图片的存储路径信息可以准确的定位到唯一的一张图片,从而第一转换模 块 220可以获取到唯一的一张图片。  Specifically, the name of the picture acquired by the first conversion module 220 according to the identification module 210 and the storage path information of the picture can be accurately located to a unique picture, so that the first conversion module 220 can obtain a unique one. image.
第一转换模块 220 可以采用现有的图片转换工具将其获取到的图片转换 为灰度图片, 例如, 第一转换模块 220可以通过调用 Imagemagic函数库中的 图像过滤器函数将上述获取到的图片转换为灰度图片; 再例如, 第一转换模块 220 可以通过调用 Php gd 函数库中的图像过滤器函数将上述获取到的图片转 换为灰度图片。 The first conversion module 220 may convert the acquired image into a grayscale image by using an existing image conversion tool. For example, the first conversion module 220 may use the image filter function in the Imagemagic function library to retrieve the acquired image. Converting to a grayscale picture; for example, the first conversion module 220 can convert the acquired image by calling an image filter function in the Php gd function library. Change to grayscale image.
一个具体的例子, 在使用 Php gd函数库中的图像过滤器函数将图片转换 为灰度图片的情况下, 第一转换模块 220可以利用下述程序代码实现(即第一 转换模块 220包括下述程序代码) :  In a specific example, in a case where an image filter function in the Php gd function library is used to convert a picture into a grayscale picture, the first conversion module 220 can be implemented by using the following program code (ie, the first conversion module 220 includes the following code) :
$img = i magecreatef rompng ( $f i lePath );  $img = i magecreatef rompng ( $f i lePath );
i magef i Iter ( $img, I MG—F I LTER—GRAYSGALE );  i magef i Iter ( $img, I MG—F I LTER—GRAYSGALE );
i magea I phab I end i ng ( $ img, false );  i magea I phab I end i ng ( $ img, false );
imagesavea Ipha ( $ img, true );  Imagesavea Ipha ( $ img, true );
imagepng ( $ i mg, $f i lePath );  Imagepng ( $ i mg, $f i lePath );
imagedestroy ( $ img );  Imagedestroy ( $ img );
其 中 , 如 果 上 述 f i lePath 被 第 一 转 换 模 块 220 设 置 为.. /. /resources/ img/ logo. png, 贝' J图片 " logo, png,, 被转换为灰度图片; 如果上述程序代码 中 的 f i lePath 被 第 一转换模块 220 设置 为.. /../resources/img/1. jpg, 则图片 "1. jpg"被转换为灰度图片; 如果上 述程序代码中的 f i lePath被第一转换模块 220设置为 ../img/2. jpg, 则图片 "2. jpg" 被转换为灰度图片。  Wherein, if the above fi lePath is set by the first conversion module 220 as .. /. /resources/ img/ logo. png, the shell 'J picture" logo, png, is converted into a grayscale picture; if in the above program code Fi lePath is set to .. /../resources/img/1. jpg by the first conversion module 220, then the picture "1. jpg" is converted into a grayscale picture; if the fi lePath in the above program code is first converted The module 220 is set to ../img/2. jpg, and the picture "2. jpg" is converted to a grayscale picture.
第一转换模块 220 可以采用下述四种方式实现上述灰度图片的存储与上 述图片在页面的源程序代码中的存储信息的对应设置:  The first conversion module 220 can implement the corresponding setting of the storage of the grayscale picture and the storage information of the picture in the source code of the page in the following four ways:
方式一、第一转换模块 220将转换后的灰度图片按照页面的源程序代码中 的相应图片 (即原图片) 的存储路径信息进行存储, 且该灰度图片的图片名称 与原图片的图片名称相同,从而第一转换模块 220使对应上述存储路径信息的 原图片被转换后的灰度图片所覆盖;即利用页面的源程序代码中的原图片的存 储路径信息和原图片的图片名称可以获取到第一转换模块 220 转换后的灰度 图片。该方式不需要第一转换模块 220对页面的源程序代码进行修改, 是一种 较好的实现方式。  The first conversion module 220 stores the converted grayscale image according to the storage path information of the corresponding image (ie, the original image) in the source code of the page, and the image name of the grayscale image and the image of the original image. The name is the same, so that the first conversion module 220 covers the original image corresponding to the storage path information by the converted grayscale image; that is, the storage path information of the original image in the source code of the page and the image name of the original image may be used. The grayscale picture converted by the first conversion module 220 is obtained. This method does not require the first conversion module 220 to modify the source code of the page, which is a better implementation.
方式二、第一转换模块 220将转换后的灰度图片按照页面的源程序代码中 的相应图片 (即原图片) 的存储路径信息进行存储, 且该灰度图片的图片名称 与原图片的图片名称不相同,从而第一转换模块 220使转换后的灰度图片不会 覆盖上述原图片;第一转换模块 220需要修改页面的源程序代码中的原图片的 图片名称,使修改后的源程序代码中的原图片的存储路径信息和新的图片名称 与灰度图片的实际存储路径信息和图片名称相对应,即利用修改后的源程序代 码中的原图片的存储路径信息以及转换后的灰度图片的图片名称可以获取到 转换后的灰度图片。 该方式保留了原图片。  In the second mode, the first conversion module 220 stores the converted grayscale image according to the storage path information of the corresponding image (ie, the original image) in the source code of the page, and the image name of the grayscale image and the image of the original image. The name is not the same, so that the first conversion module 220 does not cover the original picture; the first conversion module 220 needs to modify the picture name of the original picture in the source code of the page, so that the modified source program The storage path information of the original picture in the code and the new picture name correspond to the actual storage path information and the picture name of the grayscale picture, that is, the storage path information of the original picture in the modified source code and the converted gray The image name of the degree image can be obtained as a converted grayscale image. This method retains the original picture.
方式三、 第一转换模块 220不再按照页面的源程序代码中的相应图片 (即 原图片)的存储路径信息来对转换后的灰度图片进行存储, 而是将转换后的灰 度图片存储于其他地方,从而第一转换模块 220使该灰度图片对应一条不同于 原图片的存储路径信息的新的存储路径信息, 但是, 该灰度图片的图片名称可 以与原图片的图片名称相同;第一转换模块 220需要修改源程序代码中的原图 片的存储路径信息但不需要修改原图片的图片名称,使修改后的源程序代码中 的新的存储路径信息和原图片的图片名称与灰度图片的实际存储路径信息和 灰度图片的图片名称相对应,即利用修改后的源程序代码中的新的存储路径信 息以及原图片的图片名称可获取到转换后的灰度图片。 该方式保留了原图片。 In a third manner, the first conversion module 220 no longer follows the corresponding picture in the source code of the page (ie, The storage path information of the original picture is used to store the converted grayscale picture, but the converted grayscale picture is stored elsewhere, so that the first conversion module 220 makes the grayscale picture correspond to a different picture from the original picture. The new storage path information of the path information is stored, but the picture name of the gray picture may be the same as the picture name of the original picture; the first conversion module 220 needs to modify the storage path information of the original picture in the source code but does not need to be modified. The picture name of the original picture, so that the new storage path information in the modified source code and the picture name of the original picture correspond to the actual storage path information of the grayscale picture and the picture name of the grayscale picture, that is, the modified The new storage path information in the source code and the picture name of the original picture can obtain the converted grayscale picture. This method retains the original picture.
方式四、 第一转换模块 220不再按照页面的源程序代码中的相应图片 (即 原图片)的存储路径信息来对转换后的灰度图片进行存储, 而是将转换后的灰 度图片存储于其他地方,从而第一转换模块 220使该灰度图片对应一条不同于 原图片的存储路径信息的新的存储路径信息, 而且, 该灰度图片的图片名称与 原图片的图片名称不相同;第一转换模块 220需要修改源程序代码中的原图片 的存储路径信息以及原图片的图片名称,使修改后的源程序代码中的新的存储 路径信息和新的图片名称与灰度图片的实际存储路径信息和灰度图片的图片 名称相对应,即利用修改后的源程序代码中的新的存储路径信息以及新的图片 名称可以获取到转换后的灰度图片。 该方式保留了原图片。  In a fourth manner, the first conversion module 220 does not store the converted grayscale image according to the storage path information of the corresponding image (ie, the original image) in the source code of the page, but stores the converted grayscale image. In other places, the first conversion module 220 causes the grayscale picture to correspond to a new storage path information different from the storage path information of the original picture, and the picture name of the gray picture is different from the picture name of the original picture; The first conversion module 220 needs to modify the storage path information of the original picture in the source code and the picture name of the original picture, so that the new storage path information in the modified source code and the new picture name and the actual picture of the gray picture The storage path information corresponds to the picture name of the grayscale picture, that is, the converted grayscale picture can be obtained by using the new storage path information in the modified source code and the new picture name. This method retains the original picture.
第二转换模块 230与识别模块 210连接,第二转换模块 230主要适于将颜 色变量对应的颜色值转换为灰度值,并利用灰度值更新页面的源程序代码中颜 色变量对应的颜色值。  The second conversion module 230 is connected to the identification module 210. The second conversion module 230 is mainly adapted to convert the color value corresponding to the color variable into a gray value, and update the color value corresponding to the color variable in the source code of the page by using the gray value. .
具体的,第二转换模块 230所执行的搡作与上述第一转换模块 230所执行 的搡作没有必然的先后顺序限制, 例如, 在查找到一个需要进行颜色变灰处理 的内容就执行一次转换的情况下,第二转换模块 230和第一转换模块 230所执 行的转换搡作的先后顺序取决于识别模块 210 从网页的源程序代码中查找到 需要进行颜色变灰处理的内容的先后顺序; 再例如, 在识别模块 210从网页的 源程序代码中查找到所有需要进行颜色变灰处理的内容之后再执行转换的情 况下,第二转换模块 230和第一转换模块 230在通常情况下会同时执行转换搡 作。  Specifically, the operation performed by the second conversion module 230 and the execution performed by the first conversion module 230 are not limited by a sequence, for example, performing a conversion after finding a content that needs to be color grayed out. The sequence of the conversion operations performed by the second conversion module 230 and the first conversion module 230 depends on the order in which the identification module 210 searches for the content that needs to be color-grayed from the source code of the web page; For another example, in a case where the identification module 210 searches for the content that needs to be subjected to the color graying process from the source code of the webpage, and then performs the conversion, the second conversion module 230 and the first conversion module 230 are normally simultaneously Perform a conversion operation.
针对采用十六进制颜色值的背景颜色以及字体颜色等,在将其颜色值转换 为灰度值时, 第二转换模块 230应先将该十六进制颜色值转换为 RGB颜色值, 然后, 第二转换模块 230再将 RGB颜色值转换为灰度值。  For the background color using the hexadecimal color value, the font color, etc., when converting the color value to the gray value, the second conversion module 230 should first convert the hexadecimal color value to the RGB color value, and then The second conversion module 230 then converts the RGB color values into grayscale values.
第二转换模块 230将十六进制颜色值转换为 RGB颜色值的一个具体例子如 下所示 (第二转换模块 230包含有下述程序代码) :  A specific example in which the second conversion module 230 converts the hexadecimal color value into the RGB color value is as follows (the second conversion module 230 includes the following program code):
I f ( substr ($co l or, 0, 1 ) == ' # ' ) { $co I or = substr ($color, 1); I f ( substr ($co l or, 0, 1 ) == '#' ) { $co I or = substr ($color, 1);
If (str len ($color) ==3) {  If (str len ($color) ==3) {
$co I or=$co I or {0} . $co I or {0} . $color {1} . $color {1} . $co I or {2} . $co I or {2}; $co I or=$co I or {0} . $co I or {0} . $color {1} . $color {1} . $co I or {2} . $co I or {2};
}  }
$co I or=hexdec ($color) ;  $co I or=hexdec ($color) ;
$R=0xFF& ($color»0x10) ;  $R=0xFF&($color»0x10);
$G=0xFF& ($color»0x8) ;  $G=0xFF&($color»0x8);
$B=0xFF&$color ;  $B=0xFF&$color ;
$co I or=ar ray (  $co I or=ar ray (
'R'=> $R,  'R'=> $R,
'G'=> $G,  'G'=> $G,
'B'=> $B  'B'=> $B
) ;  ) ;
}  }
在将十六进制的颜色值转换为 RGB颜色值后,第二转换模块 230可以通过 下面的公式 (1) 将 RGB颜色转换为灰度值:  After converting the hexadecimal color value to the RGB color value, the second conversion module 230 can convert the RGB color to a gray value by the following formula (1):
$gray=intval ($color['R'] X 0.299+$color [' G' ] X 0.587+$color [' B' ] X0.114 ); 公式 (1) 针对在识别模块 210描述中所例举的 GSS代码,在第二转换模块 230将其 所包含的十六进制的颜色值 (即. cls中的 "#888"和 "#00ff00" 以及 header 中的 "#ff0000" ) 转换为灰度值, 并利用该灰度值替换页面的源程序代码中 的颜色变量对应的颜色值之后, GSS代码如下所示:  $gray=intval ($color['R'] X 0.299+$color [' G' ] X 0.587+$color [' B' ] X0.114 ); Equation (1) is for the example described in the identification module 210 The GSS code in the second conversion module 230 converts the hexadecimal color values it contains (ie, "#888" and "#00ff00" in the .cls and "#ff0000" in the header) to gray. After the degree value, and replacing the color value corresponding to the color variable in the source code of the page with the gray value, the GSS code is as follows:
CSS代码: CSS code:
. c I s { . c I s {
background-co I or: #888888;  Background-co I or: #888888;
padd i ng: 10px 0;  Padd i ng: 10px 0;
color :#959595;  Color :#959595;
} }
Header {  Header {
co I or : 4c4c4c;  Co I or : 4c4c4c;
background- i mage: ur I (.. /img/2. jpg) ;  Background- i mage: ur I (.. /img/2. jpg) ;
padd i ng: 10px 0; } Padd i ng: 10px 0; }
经过上述第一转换模块 220和第二转换模块 230处理后而形成的更新后的 页面的源程序代码主要用于网站服务器根据浏览器客户端的页面请求向浏览 器客户端下发承载有相应页面内容的消息。也就是说, 本装置还可以将经过上 述处理后而形成的更新后的页面的源程序代码上线,使更新后的页面的源程序 代码设置于网站服务器中。  The source code of the updated page formed by the processing by the first conversion module 220 and the second conversion module 230 is mainly used by the website server to deliver the corresponding page content to the browser client according to the page request of the browser client. Message. That is to say, the device can also bring up the source code of the updated page formed by the above processing, and set the source code of the updated page to the web server.
在此提供的算法和显示不与任何特定计算机、虚拟系统或者其它设备固有 相关。 各种通用系统也可以与基于在此的示教一起使用。 根据上面的描述, 构 造这类系统所要求的结构是显而易见的。 此外, 本发明也不针对任何特定编程 语言。 应当明白, 可以利用各种编程语言实现在此描述的本发明的内容, 并且 上面对特定语言所做的描述是为了披露本发明的最佳实施方式。  The algorithms and displays provided herein are not inherently related to any particular computer, virtual system, or other device. Various general purpose systems can also be used with the teaching based on the teachings herein. According to the above description, the structure required to construct such a system is obvious. Moreover, the invention is not directed to any particular programming language. It is to be understood that the invention may be embodied in a variety of programming language, and the description of the specific language is described above for the preferred embodiments of the invention.
在此处所提供的说明书中, 说明了大量具体细节。 然而, 能够理解, 本发 明的实施例可以在没有这些具体细节的情况下实践。在一些实例中, 并未详细 示出公知的方法、 结构和技术, 以便不模糊对本说明书的理解。  Numerous specific details are set forth in the description provided herein. However, it is understood that the embodiments of the invention may be practiced without these specific details. In some instances, well known methods, structures, and techniques have not been shown in detail so as not to obscure the description.
类似地, 应当理解, 为了精简本公开并帮助理解各个发明方面中的一个或 多个, 在上面对本发明的示例性实施例的描述中, 本发明的各个特征有时被一 起分组到单个实施例、 图、 或者对其的描述中。 然而, 并不应将该公开的方法 解释成反映如下意图:即所要求保护的本发明要求比在每个权利要求中所明确 记载的特征更多的特征。 更确切地说, 如下面的权利要求书所反映的那样, 发 明方面在于少于前面公开的单个实施例的所有特征。 因此, 遵循具体实施方式 的权利要求书由此明确地并入该具体实施方式,其中每个权利要求本身都作为 本发明的单独实施例。  Similarly, the various features of the present invention are sometimes grouped together into a single embodiment, in the above description of the exemplary embodiments of the invention, Figure, or a description of it. However, the method of the disclosure should not be construed as reflecting the intention that the claimed invention requires more features than those recited in the claims. Rather, as the following claims reflect, inventive aspects lie in less than all features of the single embodiments disclosed. Therefore, the claims following the specific embodiments are hereby explicitly incorporated into the specific embodiments, and each of the claims as a separate embodiment of the invention.
本领域那些技术人员可以理解,可以对实施例中的设备中的模块进行自适 应性地改变并且把它们设置在与该实施例不同的一个或多个设备中。可以把实 施例中的模块或单元或组件组合成一个模块或单元或组件,以及此外可以把它 们分成多个子模块或子单元或子组件。 除了这样的特征和 /或过程或者单元中 的至少一些是相互排斥之外, 可以采用任何组合对本说明书 (包括伴随的权利 要求、摘要和附图) 中公开的所有特征以及如此公开的任何方法或者设备的所 有过程或单元进行组合。除非另外明确陈述, 本说明书(包括伴随的权利要求、 摘要和附图) 中公开的每个特征可以由提供相同、 等同或相似目的的替代特征 来代替。  Those skilled in the art will appreciate that the modules in the devices of the embodiments can be adaptively changed and placed in one or more devices different from the embodiment. The modules or units or components of the embodiments may be combined into one module or unit or component, and further they may be divided into a plurality of sub-modules or sub-units or sub-components. In addition to such features and/or at least some of the processes or units being mutually exclusive, any combination of the features disclosed in the specification, including the accompanying claims, the abstract and the drawings, and any methods so disclosed or All processes or units of the device are combined. Each feature disclosed in the specification (including the accompanying claims, the abstract and the drawings) may be replaced by an alternative feature that provides the same, equivalent or similar purpose.
此外, 本领域的技术人员能够理解, 尽管在此所述的一些实施例包括其它 实施例中所包括的某些特征而不是其它特征,但是不同实施例的特征的组合意 味着处于本发明的范围之内并且形成不同的实施例。例如, 在下面的权利要求 书中, 所要求保护的实施例的任意之一都可以以任意的组合方式来使用。 In addition, those skilled in the art will appreciate that, although some embodiments described herein include certain features that are included in other embodiments and not in other features, combinations of features of different embodiments are intended to be within the scope of the present invention. Different embodiments are formed and formed. For example, in the following claims Any one of the claimed embodiments can be used in any combination.
本发明的各个部件实施例可以以硬件实现,或者以在一个或者多个处理器 上运行的软件模块实现,或者以它们的组合实现。本领域的技术人员应当理解, 可以在实践中使用微处理器或者数字信号处理器 (DSP) 来实现根据本发明实 施例的页面自动变灰的装置中的一些或者全部部件的一些或者全部功能。本发 明还可以实现为用于执行这里所描述的方法的一部分或者全部的设备或者装 置程序 (例如, 计算机程序和计算机程序产品) 。 这样的实现本发明的程序可 以存储在计算机可读介^上, 或者可以具有一个或者多个信号的形式。这样的 信号可以从因特网网站上下载得到, 或者在载体信号上提供, 或者以任何其他 形式提供。  The various component embodiments of the present invention may be implemented in hardware, or in a software module running on one or more processors, or in a combination thereof. Those skilled in the art will appreciate that a microprocessor or digital signal processor (DSP) may be used in practice to implement some or all of the functionality of some or all of the components of the apparatus for automatic graying of pages in accordance with embodiments of the present invention. The invention can also be implemented as a device or device program (e.g., a computer program and a computer program product) for performing some or all of the methods described herein. Such a program implementing the present invention may be stored on a computer readable medium or may have the form of one or more signals. Such signals may be downloaded from an Internet website, provided on a carrier signal, or provided in any other form.
例如, 图 3示出了可以实现本发明的页面自动变灰的方法的通信设备。 该 通信设备传统上包括处理器 310和以存储器 320形式的计算机程序产品或者计 算机可读介^。 存储器 320可以是诸如闪存、 EEPROM (电可擦除可编程只读 存储器) 、 EPROM、 硬盘或者 ROM之类的电子存储器。 存储器 320具有用于 执行上述方法中的任何方法步骤的程序代码 331的存储空间 330。例如, 用于程 程序代码 331。 这些程序代码可以从一个或者多个计算机程序产品中读出或者 写入到这一个或者多个计算机程序产品中。 这些计算机程序产品包括诸如硬 盘, 紧致盘 (CD) 、 存储卡或者软盘之类的程序代码载体。 这样的计算机程 序产品通常为如参考图 4所述的便携式或者固定存储单元。 该存储单元可以具 有与图 3的通信设备中的存储器 320类似布置的存储段或者存储空间等。程序代 码可以例如以适当形式进行压縮。通常, 存储单元包括用于执行根据本发明的 方法步骤的程序 331 ', 即可以由例如诸如 310之类的处理器读取的代码, 这些 代码当由通信设备运行时,导致该通信设备执行上面所描述的方法中的各个步 骤。  For example, Figure 3 illustrates a communication device that can implement the method of automatic graying of pages of the present invention. The communication device conventionally includes a processor 310 and a computer program product or computer readable medium in the form of a memory 320. Memory 320 can be an electronic memory such as flash memory, EEPROM (Electrically Erasable Programmable Read Only Memory), EPROM, hard disk or ROM. Memory 320 has a memory space 330 for program code 331 for performing any of the method steps described above. For example, it is used in program code 331. The program code can be read from or written to one or more computer program products. These computer program products include program code carriers such as hard disks, compact disks (CDs), memory cards or floppy disks. Such computer program products are typically portable or fixed storage units as described with reference to Figure 4. The storage unit may have a storage section or a storage space or the like arranged similarly to the storage 320 in the communication device of Fig. 3. The program code can be compressed, for example, in an appropriate form. In general, the storage unit comprises a program 331' for performing the steps of the method according to the invention, ie a code readable by a processor such as 310, which when executed by the communication device causes the communication device to perform the above Each step in the described method.
应该注意的是, 上述实施例对本发明进行说明而不是对本发明进行限制, 并且本领域技术人员在不脱离所附权利要求的范围的情况下可设计出替换实 施例。在权利要求中, 不应将位于括号之间的任何参考符号构造成对权利要求 的限制。 单词 "包含"不排除存在未列在权利要求中的元件或步骤。 位于元件 之前的单词 "一"或 "一个"不排除存在多个这样的元件。 本发明可以借助于 包括有若干不同元件的硬件以及借助于适当编程的计算机来实现。在列举了若 干装置的单元权利要求中,这些装置中的若干个可以是通过同一个硬件项来具 体体现。 单词第一、 第二以及第三等的使用不表示任何顺序。 可将这些单词解 释为名称。  It is to be noted that the above-described embodiments are illustrative of the invention and are not intended to limit the invention, and those skilled in the art can devise alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as a limitation. The word "comprising" does not exclude the presence of the elements or the steps that are not listed in the claims. The word "a" or "an" preceding a component does not exclude the presence of a plurality of such elements. The invention can be implemented by means of hardware comprising several distinct elements and by means of a suitably programmed computer. In the unit claims listing several devices, several of these devices may be embodied by the same hardware item. The use of the words first, second, third, etc. does not indicate any order. These words can be interpreted as names.

Claims

权 利 要 求 Rights request
1、 一种页面自动变灰的方法, 其包括: 1. A method for automatically graying out a page, which includes:
获取页面的源程序代码; Get the source code of the page;
从所述页面的源程序代码中识别并获取页面中图片的名称、图片的存储路 径信息以及颜色变量对应的颜色值; Identify and obtain the name of the picture in the page, the storage path information of the picture, and the color value corresponding to the color variable from the source code of the page;
根据所述图片的名称和存储路径信息获取图片,将所述图片转换为灰度图 片,并将所述灰度图片的存储信息与所述图片在所述页面的源程序代码中的存 储信息对应设置; Obtain the picture according to the name and storage path information of the picture, convert the picture into a grayscale picture, and correspond the storage information of the grayscale picture with the storage information of the picture in the source program code of the page. set up;
将所述颜色变量对应的颜色值转换为灰度值,并利用所述灰度值更新所述 页面的源程序代码中颜色变量对应的颜色值; Convert the color value corresponding to the color variable into a grayscale value, and use the grayscale value to update the color value corresponding to the color variable in the source program code of the page;
所述更新后的页面的源程序代码用于网站服务器根据浏览器客户端的页 面请求向浏览器客户端下发承载有相应页面内容的消息。 The source program code of the updated page is used by the website server to send a message carrying the corresponding page content to the browser client according to the browser client's page request.
2、 如权利要求 1所述的方法, 其中, 所述从所述页面的源程序代码中识别 并获取页面中图片的名称、图片的存储路径信息以及颜色变量对应的颜色值包 括: 2. The method of claim 1, wherein identifying and obtaining the name of the picture in the page, the storage path information of the picture, and the color value corresponding to the color variable from the source program code of the page includes:
根据图片标签、图片名称后缀以及颜色变量的名称从所述页面的源程序代 码中识别并获取页面中图片的名称、图片的存储路径信息以及颜色变量对应的 颜色值。 Identify and obtain the name of the picture in the page, the storage path information of the picture, and the color value corresponding to the color variable from the source code of the page based on the picture tag, picture name suffix, and name of the color variable.
3、如权利要求 1所述的方法,其中,所述将所述图片转换为灰度图片包括: 调用 Imagemagic函数库中的图像过滤器函数将所述图片转换为灰度图片; 或者 3. The method of claim 1, wherein converting the picture into a grayscale picture includes: calling an image filter function in the Imagemagic function library to convert the picture into a grayscale picture; or
调用 Php gd函数库中的图像过滤器函数将所述图片转换为灰度图片。 Call the image filter function in the Php gd function library to convert the image into a grayscale image.
4、 如权利要求 1所述的方法, 其中, 所述将所述灰度图片的存储位置与所 述图片在所述页面的源程序代码中的存储路径信息对应设置包括: 4. The method of claim 1, wherein the corresponding setting of the storage location of the grayscale picture and the storage path information of the picture in the source program code of the page includes:
根据所述页面的源程序代码中的图片的存储路径信息存储所述灰度图片, 使所述灰度图片覆盖原存储于所述存储路径信息中的图片。 The grayscale picture is stored according to the storage path information of the picture in the source program code of the page, so that the grayscale picture covers the picture originally stored in the storage path information.
5、 如权利要求 1所述的方法, 其中, 所述将所述颜色变量对应的颜色值转 换为灰度值包括: 5. The method of claim 1, wherein converting the color value corresponding to the color variable into a grayscale value includes:
将所述颜色变量对应的颜色值转换为 RGB颜色值,再将所述 RGB颜色值转换 为灰度值。 Convert the color value corresponding to the color variable into an RGB color value, and then convert the RGB color value into a grayscale value.
6、 如权利要求 5所述的方法, 其中, 所述将所述 RGB颜色值转换为灰度值 包括: 6. The method of claim 5, wherein said converting the RGB color values into grayscale values includes:
利用下述公式将所述 RGB颜色值转换为灰度值: Convert the RGB color values to grayscale values using the following formula:
$gray=intval ($color ['R'] XO.299+$color ['G'] XO.587+$color [' B' ] X0.114 )。 $gray=intval ($color ['R'] XO.299+$color ['G'] XO.587+$color ['B' ] X0.114).
7、 如权利要求 1至 6中任一权利要求所述的方法, 其中, 所述方法还包括: 将所述更新后的页面的源程序代码上线,使所述更新后的页面的源程序代 码设置于网站服务器中。 7. The method according to any one of claims 1 to 6, wherein the method further includes: putting the source program code of the updated page online, so that the source program code of the updated page Set in the website server.
8、 一种页面自动变灰的装置, 其包括: 8. A device for automatically turning gray pages, which includes:
获取模块, 适于获取页面的源程序代码; Obtain module, suitable for obtaining the source code of the page;
识别模块, 适于从所述页面的源程序代码中识别并获取页面中图片的名 称、 图片的存储路径信息以及颜色变量对应的颜色值; An identification module, adapted to identify and obtain the name of the picture in the page, the storage path information of the picture, and the color value corresponding to the color variable from the source program code of the page;
第一转换模块, 适于根据所述图片的名称和存储路径信息获取图片, 将所 述图片转换为灰度图片,并将所述灰度图片的存储与所述图片在所述页面的源 程序代码中的存储信息对应设置; The first conversion module is adapted to obtain a picture according to the name and storage path information of the picture, convert the picture into a grayscale picture, and combine the storage of the grayscale picture with the source program of the picture on the page. The storage information in the code corresponds to the settings;
第二转换模块, 适于将所述颜色变量对应的颜色值转换为灰度值, 并利用 所述灰度值更新所述页面的源程序代码中颜色变量对应的颜色值; The second conversion module is adapted to convert the color value corresponding to the color variable into a grayscale value, and use the grayscale value to update the color value corresponding to the color variable in the source program code of the page;
所述更新后的页面的源程序代码用于网站服务器根据浏览器客户端的页 面请求向浏览器客户端下发承载有相应页面内容的消息。 The source program code of the updated page is used by the website server to send a message carrying the corresponding page content to the browser client according to the browser client's page request.
9、 如权利要求 8所述的装置, 其中, 所述识别模块还适于: 9. The device of claim 8, wherein the identification module is further adapted to:
根据图片标签、图片名称后缀以及颜色变量的名称从所述页面的源程序代 码中识别并获取页面中图片的名称、图片的存储路径信息以及颜色变量对应的 颜色值。 Identify and obtain the name of the picture in the page, the storage path information of the picture, and the color value corresponding to the color variable from the source code of the page based on the picture tag, picture name suffix, and name of the color variable.
10、 如权利要求 8所述的装置, 其中, 所述第一转换模块还适于: 调用 I magemag i c函数库中的图像过滤器函数将所述图片转换为灰度图片; 或者 10. The device of claim 8, wherein the first conversion module is further adapted to: call the image filter function in the Imagemagic function library to convert the picture into a grayscale picture; or
调用 Php gd函数库中的图像过滤器函数将所述图片转换为灰度图片。 Call the image filter function in the Php gd function library to convert the image into a grayscale image.
11、 如权利要求 8所述的装置, 其中, 所述第一转换模块还适于: 根据所述页面的源程序代码中的图片的存储路径信息存储所述灰度图片, 使所述灰度图片覆盖原存储于所述存储路径信息中的图片。 11. The device of claim 8, wherein the first conversion module is further adapted to: store the grayscale picture according to the storage path information of the picture in the source program code of the page, so that the grayscale The picture overwrites the picture originally stored in the storage path information.
12、 如权利要求 8所述的装置, 其中, 所述第二转换模块还适于: 将所述颜色变量对应的颜色值转换为 RGB颜色值,再将所述 RGB颜色值转 换为灰度值。 12. The device of claim 8, wherein the second conversion module is further adapted to: convert the color value corresponding to the color variable into an RGB color value, and then convert the RGB color value into a grayscale value. .
13、 如权利要求 12所述的装置, 其中, 所述第二转换模块还适于: 利用下述公式将所述 RGB颜色值转换为灰度值: 13. The device of claim 12, wherein the second conversion module is further adapted to: convert the RGB color value into a grayscale value using the following formula:
$gray=intval ($color ['R'] X0.299+$color ['G'] X0.587+$color [' B' ] XO.114 )。 $gray=intval ($color ['R'] X0.299+$color ['G'] X0.587+$color [' B' ] XO.114 ).
14、 如权利要求 8至 13中任一权利要求所述的装置, 其中, 所述装置还 包括: 14. The device according to any one of claims 8 to 13, wherein the device further include:
将所述更新后的页面的源程序代码上线,使所述更新后的页面的源程序代 码设置于网站服务器中。 The source program code of the updated page is put online, so that the source program code of the updated page is set in the website server.
15、 一种计算机程序, 包括计算机可读代码, 当通信设备运行所述计算机 可读代码时, 导致权利要求 1 -7中的任一项权利要求所述的方法被执行。 15. A computer program, including computer readable code, which when the communication device runs the computer readable code, causes the method described in any one of claims 1 to 7 to be executed.
16、 一种计算机可读介^, 其中存储了如权利要求 15所述的计算机程序。 16. A computer-readable medium in which the computer program according to claim 15 is stored.
PCT/CN2014/084370 2013-12-12 2014-08-14 Method and apparatus for automatic page graying WO2015085785A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201310680693.9 2013-12-12
CN201310680693.9A CN103761079B (en) 2013-12-12 2013-12-12 Method and device for automatically graying page

Publications (1)

Publication Number Publication Date
WO2015085785A1 true WO2015085785A1 (en) 2015-06-18

Family

ID=50528323

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2014/084370 WO2015085785A1 (en) 2013-12-12 2014-08-14 Method and apparatus for automatic page graying

Country Status (2)

Country Link
CN (1) CN103761079B (en)
WO (1) WO2015085785A1 (en)

Families Citing this family (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103761079B (en) * 2013-12-12 2017-01-18 北京奇虎科技有限公司 Method and device for automatically graying page
CN105786896A (en) * 2014-12-24 2016-07-20 阿里巴巴集团控股有限公司 Color rendering method and device of page sidebar
CN105096242A (en) * 2015-08-18 2015-11-25 耿懿超 Picture processing method and picture processing device
CN106126650A (en) * 2016-06-24 2016-11-16 武汉斗鱼网络科技有限公司 A kind of Web page picture based on PHP extension supports system
CN109918065B (en) * 2019-02-18 2022-05-17 广州视源电子科技股份有限公司 Picture code editing method and device, computer equipment and storage medium
CN110838086B (en) * 2019-11-07 2021-07-16 上海大学 Outdoor image splicing method based on correlation template matching
CN111930461B (en) * 2020-08-13 2023-09-15 中国工商银行股份有限公司 Mobile terminal APP full page graying method and device based on Android
CN111930462A (en) * 2020-08-13 2020-11-13 中国工商银行股份有限公司 PC (personal computer) end full page graying method and device
CN113569169A (en) * 2021-07-29 2021-10-29 北京奇艺世纪科技有限公司 Page display method and device
CN114968466A (en) * 2022-07-14 2022-08-30 深圳市明源云空间电子商务有限公司 Page color matching adjustment method and device, electronic equipment and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102662672A (en) * 2012-04-05 2012-09-12 广州市动景计算机科技有限公司 Method and device for conducting skin changing process to webpages as well as mobile terminal
WO2012149855A1 (en) * 2011-09-30 2012-11-08 华为技术有限公司 Webpage colour setting method, web browser and webpage server
CN103761079A (en) * 2013-12-12 2014-04-30 北京奇虎科技有限公司 Method and device for automatically graying page

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6581109B1 (en) * 1999-06-24 2003-06-17 International Business Machines Corporation System to dynamically adjust image colors in client/server environment to assure accurate color reproduction
US7400334B1 (en) * 2000-09-29 2008-07-15 809, L.L.C. Use of vector graphics in paper printing and website development
US7383498B1 (en) * 2002-12-27 2008-06-03 Sap Ag Editing styles for markup documents using parametrized styles sheets
CN100551079C (en) * 2007-09-06 2009-10-14 中兴通讯股份有限公司 A kind of method of on set-top box, text focus being carried out self-adaption paint
CN102004784A (en) * 2010-11-25 2011-04-06 北京播思软件技术有限公司 Electricity-saving method of handheld terminal browser
CN103399764A (en) * 2013-07-24 2013-11-20 北京小米科技有限责任公司 Method, device and terminal for setting interface colors

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2012149855A1 (en) * 2011-09-30 2012-11-08 华为技术有限公司 Webpage colour setting method, web browser and webpage server
CN102662672A (en) * 2012-04-05 2012-09-12 广州市动景计算机科技有限公司 Method and device for conducting skin changing process to webpages as well as mobile terminal
CN103761079A (en) * 2013-12-12 2014-04-30 北京奇虎科技有限公司 Method and device for automatically graying page

Also Published As

Publication number Publication date
CN103761079A (en) 2014-04-30
CN103761079B (en) 2017-01-18

Similar Documents

Publication Publication Date Title
WO2015085785A1 (en) Method and apparatus for automatic page graying
CN107274884B (en) Information acquisition method based on text analysis and voice synthesis
CN110096660B (en) Method and device for loading page pictures and electronic equipment
US20140344707A1 (en) Information Distribution Method and Device
US10515142B2 (en) Method and apparatus for extracting webpage information
JP5887025B2 (en) Information transmission method, apparatus, and system, terminal, and server
WO2016070718A1 (en) Method, device, and browser for file downloading
US9633049B2 (en) Searching apparatus, searching method, and searching system
WO2014200853A2 (en) Determining message data to present
CN107040584B (en) Method and device for downloading picture by client
WO2014000519A1 (en) System and method for keyword filtering
WO2014108040A1 (en) Method and apparatus for presenting content on electronic device
WO2014056352A1 (en) Method, device and system for web page transcoding
WO2016101732A1 (en) Cross-page information transmission method and page browsing apparatus
US10482393B2 (en) Machine-based learning systems, methods, and apparatus for interactively mapping raw data objects to recognized data objects
WO2017000613A1 (en) Method and device for generating indication information in search result page
WO2015154682A1 (en) Network request processing method, network server, and network system
US20110035394A1 (en) System for perfoming instrurtions that are dependent upon received media- based messages and associated methods and components
US20140085486A1 (en) Information processing terminal, information processing method, and apparatus control system
JPWO2015140922A1 (en) Information processing system, information processing method, and information processing program
WO2016107309A1 (en) File scanning method, device and system
CN111988405B (en) Message rewriting method of load balancing device and load balancing device
CN110636105B (en) Tree graph obtaining method and device, storage medium and electronic equipment
WO2015154681A1 (en) Link address generation method, device, and server
WO2015154678A1 (en) File processing method, device, and network system

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 14869512

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 14869512

Country of ref document: EP

Kind code of ref document: A1