PSD file analysis method, device, equipment and readable storage medium

文档序号:1242911 发布日期:2020-08-18 浏览:18次 中文

阅读说明:本技术 Psd文件解析方法、装置、设备及可读存储介质 (PSD file analysis method, device, equipment and readable storage medium ) 是由 朱奕腾 黄勇尤 凌飞 王蕾 贺诗洁 张逸芙 于 2019-01-24 设计创作,主要内容包括:本发明公开一种PSD文件解析方法、装置、设备及可读存储介质。该方法包括:获取按照预设的图层标注规则对各图层进行标注后的PSD文件;其中,图层标注规则用于为各图层设置图层名称及分组;根据PSD文件格式,解析标注后的PSD文件,以获取PSD文件的文件信息;其中,文件信息包括:基本信息及各图层的图层信息,图层信息包括:图层名称、图层属性信息及分组信息;根据各图层的分组信息,将文件信息构建为PSD文件的结构化数据;其中,结构化数据包括:基本信息与图层树信息;以及获取PSD文件的结构化数据。该方法能够根据预先定义的图层标注规则,将PSD文件解析为对应的结构化数据。(The invention discloses a PSD file analyzing method, device and equipment and a readable storage medium. The method comprises the following steps: acquiring a PSD file after labeling each layer according to a preset layer labeling rule; the layer marking rule is used for setting layer names and groups for all layers; analyzing the marked PSD file according to the PSD file format to obtain file information of the PSD file; wherein the file information includes: basic information and layer information of each layer, wherein the layer information comprises: layer names, layer attribute information and grouping information; according to the grouping information of each layer, file information is constructed into structured data of a PSD file; wherein the structured data comprises: basic information and layer tree information; and acquiring the structured data of the PSD file. The method can analyze the PSD file into corresponding structured data according to predefined layer marking rules.)

1. A PSD file parsing method is characterized by comprising the following steps:

acquiring a PSD file after labeling each layer according to a preset layer labeling rule; the layer marking rule is used for setting layer names and groups for the layers;

analyzing the marked PSD file according to the format of the PSD file to acquire the file information of the PSD file; wherein the file information includes: basic information and layer information of each layer, wherein the layer information comprises: layer names, layer attribute information and grouping information;

according to the grouping information of each image layer, the file information is constructed into the structural data of the PSD file; wherein the structured data comprises: basic information and layer tree information; and

and acquiring the structured data of the PSD file.

2. The method of claim 1, further comprising, prior to obtaining the structured data:

processing each layer belonging to a background group in the PSD file so as to enable the size of each layer to be adapted to the size of the canvas of the PSD file; and

and updating the processed data of each layer into the structured data.

3. The method of claim 1, further comprising, prior to constructing the file information as structured data for the PSD file:

and converting the layer attribute information of each text and pattern layer in the file information of the PSD file into corresponding CSS attribute information.

4. The method according to claim 1, wherein constructing the file information as the structured data of the PSD file according to the grouping information of the image layers comprises:

determining whether the layer names and grouping information of the layers are correct or not according to the layer marking rule; and

and if the layer names and the grouping information of the layers are determined to be correct, constructing the file information into the structured data of the PSD file according to the grouping information of the layers.

5. The method of claim 1, further comprising, before parsing the annotated PSD file: and grouping the PSD files into corresponding template groups according to a preset template group classification rule.

6. The method of claim 4, wherein the set of templates comprises: a fixed position template set; wherein the template group classification rule of the fixed position template group comprises: the PSD files are the same in size, the text pattern layer number and the layer name of each PSD file are the same, the commodity layer number and the layer name of each PSD file are the same, and the icon layer number and the layer name of each PSD file are the same.

7. The method according to any of claims 1-6, wherein the grouping comprises: a text pattern layer group, a commodity pattern layer group, an icon and picture layer group and a background picture layer group.

8. A PSD file parsing apparatus, comprising:

the file acquisition module is used for acquiring a PSD file after each layer is labeled according to a preset layer labeling rule; the layer marking rule is used for setting names and groups for the layers;

the information acquisition module is used for analyzing the marked PSD file according to the format of the PSD file so as to acquire the file information of the PSD file; wherein the file information includes: basic information and layer information of each layer, wherein the layer information comprises: layer names, layer attribute information and grouping information;

the data construction module is used for constructing the file information into the structural data of the PSD file according to the grouping information of each image layer; wherein the structured data comprises: basic information and layer tree information; and

and the data acquisition module is used for acquiring the structured data of the PSD file.

9. A computer device, comprising: memory, processor and executable instructions stored in the memory and executable in the processor, characterized in that the processor implements the method according to any of claims 1-7 when executing the executable instructions.

10. A computer-readable storage medium having stored thereon computer-executable instructions, which when executed by a processor, implement the method of any one of claims 1-7.

Technical Field

The invention relates to the technical field of data processing, in particular to a PSD file analysis method, a device, equipment and a readable storage medium.

Background

The PSD (Photoshop document) file is a special format file of the image processing software Photoshop. The format file can store meta information of all layers in Photoshop software, including data such as coordinates, sizes and colors.

In order to display and edit a PSD file on a browser or an intelligent terminal device (such as a smart phone) and realize online design of advertisement image visualization, layer data of the PSD file is usually derived into a picture, meta-information of each layer is recorded, and then restored on the browser or the intelligent terminal device. However, there are several disadvantages to doing so: 1) when the number of layers of the PSD file is large, the exporting of the picture is time-consuming and labor-consuming; 2) the PSD file layer has some special attributes, such as layer pattern, mixed pattern and the like, which cannot be exported in a picture form; 3) the PSD file layers have no incidence relation, need to be manually marked, and lack marking rules; 4) the PSD file is large, requires much storage space, and is not favorable for on-line storage.

The above information disclosed in this background section is only for enhancement of understanding of the background of the invention and therefore it may contain information that does not constitute prior art that is already known to a person of ordinary skill in the art.

Disclosure of Invention

The invention provides a PSD file analyzing method, a PSD file analyzing device and a readable storage medium, which can analyze a PSD file into corresponding structured data according to predefined layer marking rules.

Additional features and advantages of the invention will be set forth in the detailed description which follows, or may be learned by practice of the invention.

According to an aspect of the present invention, a PSD file parsing method is provided, including: acquiring a PSD file after labeling each layer according to a preset layer labeling rule; the layer marking rule is used for setting layer names and groups for all layers; analyzing the marked PSD file according to the PSD file format to obtain file information of the PSD file; wherein the file information includes: basic information and layer information of each layer, wherein the layer information comprises: layer names, layer attribute information and grouping information; according to the grouping information of each layer, file information is constructed into structured data of a PSD file; wherein the structured data comprises: basic information and layer tree information; and acquiring the structured data of the PSD file.

According to an embodiment of the present invention, before acquiring the structured data, the method further includes: processing each layer belonging to the background group in the PSD file so as to enable the size of each layer to be adapted to the size of a canvas of the PSD file; and updating the processed data of each layer into the structured data.

According to an embodiment of the present invention, before constructing the file information as the structured data of the PSD file, the method further includes: and converting the layer attribute information of each text and pattern layer in the file information of the PSD file into corresponding CSS attribute information.

According to an embodiment of the present invention, constructing file information as structured data of a PSD file according to grouping information of each layer includes: determining whether the layer name and grouping information of each layer are correct or not according to the layer marking rule; and if the layer names and the grouping information of the layers are determined to be correct, constructing file information into the structured data of the PSD file according to the grouping information of the layers.

According to an embodiment of the present invention, before parsing the labeled PSD file, the method further includes: and grouping the PSD files into corresponding template groups according to a preset template group classification rule.

According to an embodiment of the invention, the set of templates comprises: a fixed position template set; wherein, the template group classification rule of the fixed position template group comprises: the PSD files are the same in size, the text pattern layer number and the layer name of each PSD file are the same, the commodity layer number and the layer name of each PSD file are the same, and the icon layer number and the layer name of each PSD file are the same.

According to an embodiment of the invention, the grouping comprises: a text pattern layer group, a commodity pattern layer group, an icon and picture layer group and a background picture layer group.

According to another aspect of the present invention, there is provided a PSD file resolving apparatus comprising: the file acquisition module is used for acquiring a PSD file after each layer is labeled according to a preset layer labeling rule; the layer marking rule is used for setting names and groups for each layer; the information acquisition module is used for analyzing the marked PSD file according to the PSD file format so as to acquire the file information of the PSD file; wherein the file information includes: basic information and layer information of each layer, wherein the layer information comprises: layer names, layer attribute information and grouping information; the data construction module is used for constructing file information into structured data of the PSD file according to the grouping information of each image layer; wherein the structured data comprises: basic information and layer tree information; and the data acquisition module is used for acquiring the structured data of the PSD file.

According to still another aspect of the present invention, there is provided a computer apparatus comprising: a memory, a processor, and executable instructions stored in the memory and executable in the processor, the processor implementing any of the methods described above when executing the executable instructions.

According to yet another aspect of the present invention, there is provided a computer-readable storage medium having stored thereon computer-executable instructions which, when executed by a processor, implement any of the methods described above.

The PSD file analyzing method directly analyzes special attributes such as basic information, corresponding information of layers, mixed patterns and the like of a PSD file subjected to layer labeling based on a standard layer labeling rule according to a PSD file format; and according to the labeled layer grouping information, structured data containing a layer tree structure is constructed. The structured data can enable the PSD file to be displayed and edited in a browser or intelligent terminal equipment, and meanwhile, the storage space is greatly reduced, and online storage is facilitated.

It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the invention, as claimed.

Drawings

The above and other objects, features and advantages of the present invention will become more apparent by describing in detail exemplary embodiments thereof with reference to the attached drawings.

FIG. 1 is a flow diagram illustrating a PSD file parsing method according to an exemplary embodiment.

FIG. 2 is a flow diagram illustrating another PSD file parsing method according to an example embodiment.

FIG. 3 is a block diagram illustrating a PSD file parsing apparatus according to an exemplary embodiment.

FIG. 4 is a block diagram illustrating a computer system in accordance with an exemplary embodiment.

Detailed Description

Example embodiments will now be described more fully with reference to the accompanying drawings. Example embodiments may, however, be embodied in many different forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of example embodiments to those skilled in the art. The drawings are merely schematic illustrations of the invention and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and thus their repetitive description will be omitted.

Furthermore, the described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to provide a thorough understanding of embodiments of the invention. One skilled in the relevant art will recognize, however, that the invention may be practiced without one or more of the specific details, or with other methods, components, devices, steps, and so forth. In other instances, well-known structures, methods, devices, implementations, or operations are not shown or described in detail to avoid obscuring aspects of the invention.

Further, in the description of the present invention, "a plurality" means at least two, e.g., two, three, etc., unless specifically limited otherwise.

FIG. 1 is a flow diagram illustrating a PSD file parsing method according to an exemplary embodiment.

Referring to fig. 1, a PSD file parsing method 10 includes:

in step S102, a PSD file obtained after labeling each layer according to a preset layer labeling rule is obtained.

And the layer marking rule is used for setting names and groups for each layer.

Without loss of generality, taking an advertisement graph as an example, the layer types in the PSD file corresponding to the advertisement graph may include: background map layer class, content information map layer class, montage map layer class, label map layer class and button map layer class. The content information layer class may include: commodity layer subclass, text and pattern layer subclass and icon (LOGO) layer subclass.

For some layers with associations, in order to facilitate the program to perform operations such as moving/scaling on the associated layers at the same time, the layers may be grouped to form different "layer groups" to represent the linkage relationship between the layers.

In some embodiments, the body content included according to the graph layer group may include, for example: a text pattern layer group, a commodity pattern layer group, an icon and picture layer group and a background picture layer group.

In some embodiments, the layer labeling rule may include (where n denotes a sequence number):

1) for a shape area layer which is superimposed on the screen content and can be filled with solid color, gradation, or pattern, the layer name can be labeled as "background n", and when there are a plurality of background layers, the layer names are labeled as "background 1", "background 2", "… …", and "background n" in this order.

2) For the product grade layer, the name of the layer is labeled as "product n", and when there are a plurality of product layers, the product is named "product 1", "product 2", "… …" and "product n" according to the importance of the product.

3) If a product graphic layer needs to be grouped with its necessary associated decorative graphic layer, the graphic layer group can be labeled as a "product graphic layer group"; the commodity picture layer group can not contain a text pattern layer and a background layer.

4) For the text and pattern layer, the name of the layer can be labeled as "text and pattern n", and when there are multiple text and pattern layers, the visual importance of the text and pattern can be labeled as "text and pattern 1", "text and pattern 2", "… …" and "text and pattern n", respectively; the degree of visual importance may depend on the font size, font weight, or prominent color.

5) The text pattern layers and associated layers may be grouped, and their group of layers may be labeled "text pattern layer group"; the pattern layer set can not contain a commodity layer and a background layer.

6) For the icon layer, the layer name can be labeled as "icon n", and when there are a plurality of background layers, the layer names are labeled as "icon 1", icon 2 ", … … and" icon n "in sequence; the icon layers can be associated into groups, and the layer groups can be labeled as 'icon layer groups'; the icon and graph layer set can not contain a text and graph layer, a commodity graph layer and a background graph layer.

7) For some shape region layers that are related to the content message layer or that are superimposed on the background and can only be filled in solid color or gradually, the layer name can be labeled as "mask n", one PSD can have 0 to multiple mask layers, and when there are multiple mask layers, the layer names are labeled as "mask 1", "mask 2", … … "and" mask n "in sequence.

8) For a pixel graphic layer associated with an independent non-subject document, its layer name can be labeled "tag n" (no associated document), or "tag n-document x" (associated document, where "document x" is the document on the tag); a PSD may have from 0 to multiple label layers.

9) For some button pixel layers that are intended to attract the user to click into, their layer names may be labeled "button n" (no associated text), or "button-text x" (associated text, where "text x" is the text on the button); a PSD may have 0 to multiple button layers.

The layer grouping rule in the layer labeling rule is shown in table 1 below.

TABLE 1

The layer labeling operation may be performed by manual labeling, for example. The PSD file after the layer marking is renamed for each layer, grouping information can be added to the layers according to the rules, and the layers with the linkage relation are grouped into one group.

For PSD files belonging to a series in design (i.e. designs with similar layer structure or similar design style), a "template set" may also be formed. Thus, in some embodiments, prior to performing step S104, the method 10 may further include: and grouping the PSD files into corresponding template groups according to a preset template group classification rule. The "template set" may include, for example: a fixed position template set and a common template set. The common template group has no special grouping limitation, and can be arbitrarily defined according to requirements in practical application. The "fixed location template set" grouping of classification rules may include: the PSD files are the same in size, the text pattern layer number and the layer name of each PSD file are the same, the commodity layer number and the layer name of each PSD file are the same, and the icon layer number and the layer name of each PSD file are the same.

In step S104, the labeled PSD file is analyzed according to the PSD file format to obtain file information of the PSD file.

The file information includes: basic information and layer information of each layer, wherein the layer information comprises: layer name, layer attribute information, and grouping information.

The developer document of Adobe Photoshop provides a specification of PSD file format, which includes the content structure of the PSD file, the information content contained in each piece of content, and the number of binary bytes that each piece of information needs to read. According to the file format, the marked PSD file can be analyzed to obtain the file information of the PSD file.

The file information may include, for example, basic information of the PSD file and layer information of each layer.

The basic information of the PSD file may include, for example: canvas size (e.g., height and width), color mode, number of channels, etc.

The layer information of each layer may include, for example: layer name, layer attribute information, and grouping information.

Wherein the layer attribute information may further include: the position, the size, the picture layer picture, the transparency, the visibility, the mixed mode, the picture layer style and the like of the picture layer. For the pattern layer, the attribute information may further include: text content, text color, text weight, text space, text line height, font style, case locking, text change matrix, and the like.

The grouping information may include a grouping name and a position of each layer in the group, etc.

In order to keep the PSD file having rendering effect consistent with Photoshop when displayed on the browser, it is further required to convert some layer attributes of the layers in the PSD file into a data format corresponding to CSS (Cascading Style Sheets) suitable for the browser through certain calculation and rules. CSS is a style sheet language used to describe the presentation of HTML documents. CSS describes the problem of how elements on a screen, paper, audio, etc. medium should be rendered.

Therefore, in some embodiments, before performing step S106, the method 10 may further include: and converting the layer attribute information of each text and pattern layer in the file information of the PSD file into corresponding CSS attribute information. Table 2 shows a conversion comparison table between PSD layer attribute information and CSS attribute information:

TABLE 2

In step S106, the file information is constructed as the structured data of the PSD file according to the grouping information of each layer.

The structured data may include: basic information and layer tree information. The basic information may be the basic information included in the file information. The layer tree information is a data structure reconstructed according to the grouping information of each layer and taking the layer group as a unit. In each graph layer group, related information of each graph layer, such as a graph layer name, graph layer attribute information and the like, is sequentially included, so that structured data about the PSD file is formed.

The image content of the background layer of the PSD file may be outside the range of the size of the PSD file canvas, or smaller than the size of the canvas. In order to make the background layer image consistent with the canvas size, the background layer image needs to be cropped or insufficient.

Thus, in some embodiments, prior to performing step S108, method 10 may further include: and processing each layer belonging to the background group in the PSD file so as to enable the size of each layer to be suitable for the size of a canvas of the PSD file, and updating the processed data of each layer into structured data.

For the background layer image to be cropped, the range of cropping, i.e., the start position and the cropping size, needs to be determined first. Determining the cropping range requires comparing the position and size relationship between the background layer image and the canvas, and specifically includes the following four conditions:

1) the width or height of the background layer image is smaller than that of the canvas size, and the image part of the background layer image exceeds the canvas range;

2) the width and the height of the background layer image are both smaller than those of the canvas size, and the image is within the canvas range and has no excess part;

3) the width or height of the background layer image is larger than that of the canvas size, and the image part of the background layer image exceeds the canvas range;

4) the width and height of the background layer image are both larger than the width and height of the canvas size, and the image of the background layer image completely exceeds the canvas range.

After the cutting range is calculated according to the four conditions, the part overlapped with the canvas can be cut. After the image is cut, if the width and the height of the image are smaller than the size of the canvas, empty pixels need to be complemented, and the size of the image is ensured to be consistent with the size of the canvas.

In step S108, structured data of the PSD file is acquired.

And reading out the structured data of the PSD file so that the PSD file can be displayed and edited in a browser or intelligent terminal equipment. The structured data can be reduced by more than 50% compared to the PSD format file, for example, the size of the source PSD format file is 600KB, and after being converted into the structured data, the size is only 250 KB.

According to the PSD file analysis method provided by the embodiment of the invention, the PSD file subjected to layer labeling according to the standard layer labeling rule is directly analyzed to obtain the special attributes such as basic information, corresponding information of layers, mixed patterns and the like according to the PSD file format; and according to the labeled layer grouping information, structured data containing a layer tree structure is constructed. The structured data can enable the PSD file to be displayed and edited in a browser or intelligent terminal equipment, and meanwhile, the storage space is greatly reduced, and online storage is facilitated.

It should be clearly understood that the present disclosure describes how to make and use particular examples, but the principles of the present disclosure are not limited to any details of these examples. Rather, these principles can be applied to many other embodiments based on the teachings of the present disclosure.

FIG. 2 is a flow diagram illustrating another PSD file parsing method according to an example embodiment.

Referring to fig. 2, the PSD file parsing method 20 includes:

in step S202, a PSD file obtained after labeling each layer according to a preset layer labeling rule is obtained.

And the layer marking rule is used for setting names and groups for each layer.

Without loss of generality, taking an advertisement graph as an example, the layer types in the PSD file corresponding to the advertisement graph may include: background map layer class, content information map layer class, montage map layer class, label map layer class and button map layer class. The content information layer class may include: commodity layer subclass, text and pattern layer subclass and icon (LOGO) layer subclass.

For some layers with associations, in order to facilitate the program to perform operations such as moving/scaling on the associated layers at the same time, the layers may be grouped to form different "layer groups" to represent the linkage relationship between the layers.

In some embodiments, the body content included according to the graph layer group may include, for example: a text pattern layer group, a commodity pattern layer group, an icon and picture layer group and a background picture layer group.

The specific layer labeling rule may refer to the layer labeling rule in the method 10, and is not described herein again.

The layer labeling operation can be performed by manual labeling, for example. The PSD file after the layer marking is renamed for each layer, grouping information can be added to the layers according to the rules, and the layers with the linkage relation are grouped into one group.

For PSD files belonging to a series in design (i.e. designs with similar layer structure or similar design style), a "template set" may also be formed. Thus, in some embodiments, prior to performing step S204, the method 20 may further include: and grouping the PSD files into corresponding template groups according to a preset template group classification rule. The "template set" may include, for example: a fixed position template set and a common template set. The common template group has no special grouping limitation, and can be arbitrarily defined according to requirements in practical application. The "fixed location template set" grouping of classification rules may include: the PSD files are the same in size, the text pattern layer number and the layer name of each PSD file are the same, the commodity layer number and the layer name of each PSD file are the same, and the icon layer number and the layer name of each PSD file are the same.

In step S204, the labeled PSD file is analyzed according to the PSD file format to obtain file information of the PSD file.

The file information includes: basic information and layer information of each layer, wherein the layer information comprises: layer name, layer attribute information, and grouping information.

The developer document of Adobe Photoshop provides a specification of PSD file format, which includes the content structure of the PSD file, the information content contained in each piece of content, and the number of binary bytes that each piece of information needs to read. According to the file format, the marked PSD file can be analyzed to obtain the file information of the PSD file.

The file information may include, for example, basic information of the PSD file and layer information of each layer.

The basic information of the PSD file may include, for example: canvas size (e.g., height and width), color mode, number of channels, etc.

The layer information of each layer may include, for example: layer name, layer attribute information, and grouping information.

Wherein the layer attribute information may further include: the position, the size, the picture layer picture, the transparency, the visibility, the mixed mode, the picture layer style and the like of the picture layer. For the pattern layer, the attribute information may further include: text content, text color, text weight, text space, text line height, font style, case locking, text change matrix, and the like.

The grouping information may include a grouping name and a position of each layer in the group, etc.

In order to keep the PSD file having rendering effect consistent with Photoshop when displayed on the browser, it is further required to convert some layer attributes of the layers in the PSD file into a data format corresponding to CSS (Cascading Style Sheets) suitable for the browser through certain calculation and rules. CSS is a style sheet language used to describe the presentation of HTML documents. CSS describes the problem of how elements on a screen, paper, audio, etc. medium should be rendered.

Therefore, in some embodiments, before performing step S206, the method 20 may further include: and converting the layer attribute information of each text and pattern layer in the file information of the PSD file into corresponding CSS attribute information. The conversion rule between the PSD layer attribute information and the CSS attribute information may refer to the conversion rule in method 10, and is not described herein again.

In step S206, it is determined whether the layer name and the grouping information of each layer are correct according to the layer labeling rule, and if so, the process goes to step S208.

Before the structured data is constructed, whether the layer names and grouping information of all layers are correct or not is checked according to the layer marking rule, and if the layer names and the grouping information are correct, the following operation of constructing the structured data is carried out.

If not, for example, manual labeling may be performed again, and step S202 is re-entered, which is not limited to this.

In step S208, the file information is constructed as the structured data of the PSD file according to the grouping information of each layer.

The structured data may include: basic information and layer tree information. The basic information may be the basic information included in the file information. The layer tree information is a data structure reconstructed according to the grouping information of each layer and taking the layer group as a unit. In each graph layer group, related information of each graph layer, such as a graph layer name, graph layer attribute information and the like, is sequentially included, so that structured data about the PSD file is formed.

The image content of the background layer of the PSD file may be outside the range of the size of the PSD file canvas, or smaller than the size of the canvas. In order to make the background layer image consistent with the canvas size, the background layer image needs to be cropped or insufficient.

Thus, in some embodiments, prior to performing step S210, the method 20 may further include: and processing each layer belonging to the background group in the PSD file so as to enable the size of each layer to be suitable for the size of a canvas of the PSD file, and updating the processed data of each layer into structured data. For the specific clipping and complementing operations, refer to method 10, and are not described again.

In step S210, structured data of the PSD file is acquired.

And reading out the structured data of the PSD file so that the PSD file can be displayed and edited in a browser or intelligent terminal equipment. The structured data can be reduced by more than 50% compared to the PSD format file, for example, the size of the source PSD format file is 600KB, and after being converted into the structured data, the size is only 250 KB.

Those skilled in the art will appreciate that all or part of the steps implementing the above embodiments are implemented as computer programs executed by a CPU. The computer program, when executed by the CPU, performs the functions defined by the method provided by the present invention. The program may be stored in a computer readable storage medium, which may be a read-only memory, a magnetic or optical disk, or the like.

Furthermore, it should be noted that the above-mentioned figures are only schematic illustrations of the processes involved in the method according to exemplary embodiments of the invention, and are not intended to be limiting. It will be readily understood that the processes shown in the above figures are not intended to indicate or limit the chronological order of the processes. In addition, it is also readily understood that these processes may be performed synchronously or asynchronously, e.g., in multiple modules.

The following are embodiments of the apparatus of the present invention that may be used to perform embodiments of the method of the present invention. For details which are not disclosed in the embodiments of the apparatus of the present invention, reference is made to the embodiments of the method of the present invention.

FIG. 3 is a block diagram illustrating a PSD file parsing apparatus according to an exemplary embodiment.

Referring to fig. 3, the PSD file parser 30 includes: a file acquisition module 302, an information acquisition module 304, a data construction module 306, and a data acquisition module 308.

The file obtaining module 302 is configured to obtain a PSD file obtained after labeling each layer according to a preset layer labeling rule; and the layer marking rule is used for setting names and groups for each layer.

The information obtaining module 304 is configured to analyze the labeled PSD file according to the PSD file format to obtain file information of the PSD file; wherein the file information includes: basic information and layer information of each layer, wherein the layer information comprises: layer name, layer attribute information, and grouping information.

The data construction module 306 is configured to construct file information into structured data of a PSD file according to the grouping information of each layer; wherein the structured data comprises: basic information and layer tree information.

The data obtaining module 308 is used for obtaining the structured data of the PSD file.

In some embodiments, the apparatus 30 further comprises: the device comprises an image processing module and a data updating module. The image processing module is configured to process each layer belonging to the background group in the PSD file before the data construction module 306 obtains the structured data of the PSD file, so that the size of each layer is adapted to the size of the canvas of the PSD file. And the data updating module is used for updating the processed data of each layer into the structured data.

In some embodiments, the apparatus 30 further comprises: an attribute conversion module, configured to convert, before the data construction module 306 constructs the file information as the structured data of the PSD file, the layer attribute information of each text pattern layer in the file information of the PSD file into corresponding CSS attribute information.

In some embodiments, the data construction module 306 may include: an information determining unit and a data constructing unit. The information determining unit is used for determining whether the layer names and the grouping information of each layer are correct according to the layer labeling rule. And the data construction unit is used for constructing the file information into the structured data of the PSD file according to the grouping information of each layer when the information determination unit determines that the layer name and the grouping information of each layer are correct.

In some embodiments, the apparatus 30 further comprises: and a template grouping module, configured to group the PSD files into corresponding template groups according to a preset template group classification rule before the information obtaining module 304 analyzes the labeled PSD files.

In some embodiments, the set of templates includes: a fixed position template set; wherein, the template group classification rule of the fixed position template group comprises: the PSD files are the same in size, the text pattern layer number and the layer name of each PSD file are the same, the commodity layer number and the layer name of each PSD file are the same, and the icon layer number and the layer name of each PSD file are the same.

In some embodiments, the packet includes: a text pattern layer group, a commodity pattern layer group, an icon and picture layer group and a background picture layer group.

According to the PSD file analysis device provided by the embodiment of the invention, the PSD file subjected to layer labeling according to the standard layer labeling rule is directly analyzed to obtain the special attributes such as basic information, corresponding information of layers, mixed patterns and the like according to the PSD file format; and according to the labeled layer grouping information, structured data containing a layer tree structure is constructed. The structured data can enable the PSD file to be displayed and edited in a browser or intelligent terminal equipment, and meanwhile, the storage space is greatly reduced, and online storage is facilitated.

It is noted that the block diagrams shown in the above figures are functional entities and do not necessarily correspond to physically or logically separate entities. These functional entities may be implemented in the form of software, or in one or more hardware modules or integrated circuits, or in different networks and/or processor devices and/or microcontroller devices.

FIG. 4 is a block diagram illustrating a computer system in accordance with an exemplary embodiment. It should be noted that the computer system shown in fig. 4 is only an example, and should not bring any limitation to the function and the scope of the application of the embodiment of the present invention.

As shown in fig. 4, the computer system 800 includes a Central Processing Unit (CPU)801 that can perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)802 or a program loaded from a storage section 808 into a Random Access Memory (RAM) 803. In the RAM 803, various programs and data necessary for the operation of the system 800 are also stored. The CPU 801, ROM 802, and RAM 803 are connected to each other via a bus 804. An input/output (I/O) interface 805 is also connected to bus 804.

The following components are connected to the I/O interface 805: an input portion 806 including a keyboard, a mouse, and the like; an output section 807 including a signal such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage portion 808 including a hard disk and the like; and a communication section 809 including a network interface card such as a LAN card, a modem, or the like. The communication section 809 performs communication processing via a network such as the internet. A drive 810 is also connected to the I/O interface 805 as necessary. A removable medium 811 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 810 as necessary, so that a computer program read out therefrom is mounted on the storage section 808 as necessary.

In particular, according to an embodiment of the present invention, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the invention include a computer program product comprising a computer program embodied on a computer-readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program can be downloaded and installed from a network through the communication section 809 and/or installed from the removable medium 811. The computer program executes the above-described functions defined in the system of the present invention when executed by the Central Processing Unit (CPU) 801.

It should be noted that the computer readable medium shown in the present invention can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present invention, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.

The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.

The units described in the embodiments of the present invention may be implemented by software or hardware. The described units may also be provided in a processor, and may be described as: a processor includes a transmitting unit, an obtaining unit, a determining unit, and a first processing unit. The names of these units do not in some cases constitute a limitation to the unit itself, and for example, the sending unit may also be described as a "unit sending a picture acquisition request to a connected server".

As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be separate and not incorporated into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to comprise:

acquiring a PSD file after labeling each layer according to a preset layer labeling rule; the layer marking rule is used for setting layer names and groups for all layers;

analyzing the marked PSD file according to the PSD file format to obtain file information of the PSD file; wherein the file information includes: basic information and layer information of each layer, wherein the layer information comprises: layer names, layer attribute information and grouping information;

according to the grouping information of each layer, file information is constructed into structured data of a PSD file; wherein the structured data comprises: basic information and layer tree information; and

and acquiring the structured data of the PSD file.

Exemplary embodiments of the present invention are specifically illustrated and described above. It is to be understood that the invention is not limited to the precise construction, arrangements, or instrumentalities described herein; on the contrary, the invention is intended to cover various modifications and equivalent arrangements included within the spirit and scope of the appended claims.

17页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:数据协同处理的方法、装置和系统

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!