CN114998455A - Method for generating PSD file independent of PS software and storage medium - Google Patents

Method for generating PSD file independent of PS software and storage medium Download PDF

Info

Publication number
CN114998455A
CN114998455A CN202210535442.0A CN202210535442A CN114998455A CN 114998455 A CN114998455 A CN 114998455A CN 202210535442 A CN202210535442 A CN 202210535442A CN 114998455 A CN114998455 A CN 114998455A
Authority
CN
China
Prior art keywords
data
file
psd file
psd
layer
Prior art date
Legal status (The legal status 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 status listed.)
Pending
Application number
CN202210535442.0A
Other languages
Chinese (zh)
Inventor
林鸣鹤
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Xiamen Draft Co ltd
Gaoding Xiamen Technology Co Ltd
Original Assignee
Xiamen Draft Co ltd
Gaoding Xiamen Technology Co Ltd
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 Xiamen Draft Co ltd, Gaoding Xiamen Technology Co Ltd filed Critical Xiamen Draft Co ltd
Priority to CN202210535442.0A priority Critical patent/CN114998455A/en
Publication of CN114998455A publication Critical patent/CN114998455A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T9/00Image coding
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/001Texturing; Colouring; Generation of texture or colour
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/60Editing figures and text; Combining figures or text

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Multimedia (AREA)
  • Processing Or Creating Images (AREA)

Abstract

The invention discloses a method for generating a PSD file independent of PS software and a storage medium, relating to the technical field of picture processing. Therefore, the method can generate the PSD file on the electronic terminal without the Adobe Photoshop software, can run on any operating system or platform (mobile phone, PC, Pad browser and the like), and has wide applicability.

Description

Method for generating PSD file independent of PS software and storage medium
Technical Field
The invention relates to the technical field of picture processing, in particular to a method for generating a PSD file without depending on PS software and a storage medium.
Background
At present, an Adobe Photoshop format file needs to be generated (or stored), and a conventional approach is to purchase Adobe Photoshop software (PS software for short) and install the Adobe Photoshop software on a computer, then create a PSD format file by using the Adobe Photoshop, edit (add content), and finally store the file. Therefore, a file in the PSD format cannot be generated on a computer without installing corresponding software, which is limited to a use environment, and it is difficult to smoothly operate even if corresponding software is installed in a computer environment with a low performance configuration, which causes inconvenience to operation.
Disclosure of Invention
The invention provides a method for generating a PSD file without depending on PS software and a storage medium, and aims to solve the problems in the prior art.
The invention adopts the following technical scheme:
a method of generating a PSD file independent of specific software, comprising:
(1) representing the content to be written into the PSD file in the form of data;
(2) converting the data in the step (1) into layer data corresponding to the PSD file according to a PSD file format specification;
(3) according to the data in the step (1), setting file header data and color mode data according to PSD file format specifications;
(4) and writing the file header data, the color mode data and the layer data into a file in a binary mode according to the sequence to obtain a PSD file.
Further, if the content to be written into the PSD file in step (1) is a text, in step (2), the data is directly mapped into a drawing layer data to form at least one text drawing layer corresponding to the PSD file.
If the content to be written into the PSD file in step (1) is a picture, mapping data other than the pixel data into layer data in step (2) to form at least one picture layer corresponding to the PSD file, then storing the pixel data into a pixel data mapping table, and associating the ID of the pixel data mapping table with the layer data; in the step (4), the file header data, the color mode data, the layer data and the pixel data mapping table are written into a file in a binary manner according to the sequence, so as to obtain a PSD file.
If the content to be written into the PSD file in the step (1) includes characters and pictures, in the step (2),
for characters, directly mapping the data of the characters into graph layer data to form at least one character layer corresponding to the PSD file;
for a picture, mapping data except pixel data into picture layer data to form at least one picture layer corresponding to a PSD file, then storing the pixel data into a pixel data mapping table, and associating an ID of the pixel data mapping table with the layer data;
in the step (4), the file header data, the color mode data, the layer data and the pixel data mapping table are written into a file in a binary manner in sequence to obtain a PSD file.
Specifically, the header data and the color pattern data specifically include a width, a height, a color pattern, and a background color.
In particular, said data of a text comprises font, font color, font size, text content, distance to the canvas edge.
In particular, the data for a picture includes distance to the left of the canvas, distance to the top of the canvas, width, height, and pixel data.
A computer readable storage medium having computer readable instructions stored thereon which, when executed, implement any of the described methods for generating PSD files independent of specific software.
From the above description of the structure of the present invention, it can be seen that the present invention has the following advantages:
the invention can realize the generation of the PSD file on the electronic terminals such as computers, panels, mobile phones and the like without Adobe Photoshop software by representing the content to be written in the PSD file in a data form, then carrying out processing such as file header data mapping, layer data mapping, pixel data mapping table, ID association and the like on the data and directly outputting the PSD file, can run on any operating system or platform (mobile phones, PCs, Pad browsers and the like), and can better cross-device and cross-platform.
Drawings
FIG. 1 is a block flow diagram of an embodiment of the present invention.
FIG. 2 is a diagram of an embodiment of writing content according to the present invention.
FIG. 3 is a simplified diagram of PSD file format specification. Wherein, File Header is File Header Data, Color Mode Data is Color Mode Data, Image Resources is content including additional Information of the PSD File (this part does not belong to the Data that needs attention in the present invention), Layer and Mask Information is Layer Data and Image Data is pixel Data mapping table.
Detailed Description
The following describes embodiments of the present invention with reference to the drawings.
Example one
As shown in fig. 1, 2 and 3, a method for generating a PSD file without depending on specific software includes the following:
(1) the content to be written to the PSD file is represented in the form of data.
The data includes canvas data including, but not limited to, width, height, color pattern, and background color.
The contents to be written into the PSD file are mainly divided into two types, text and graphics. If the content to be written into the PSD file is a text, the data to be provided includes, but is not limited to, a font color, a font size, a text content, and a distance from an edge of the canvas; if the content to be written to the PSD file is a picture, the data to be provided includes, but is not limited to, the distance from the edge of the canvas, the width, the height, and the pixel data.
The manner of providing the above data includes, but is not limited to, employing manual editing.
Taking the content to be written into the PSD file as an example shown in fig. 2, the data format specifically indicates that:
firstly, canvas:
width of 400px
Height of 400px
Color pattern RGB
Background color transparent
Secondly, content:
layer 1:
type of character layer
Font, Alibap Heavy
Font color red
Font size 40px
Text content i am a cat
Distance from left side of canvas 40px
Distance from canvas top 40px
And (3) layer 2:
type picture layer
Distance to left of canvas 100px
Distance from canvas top 100px
Width of 200px
Height of 200px
Pixel data [ binary image data ].
Since it is prior art to generate a pixel picture from binary image data, the detailed binary image data corresponding to the picture shown in fig. 2 is omitted here.
(2) And (3) converting the data in the step (1) into layer data corresponding to the PSD file according to a PSD file format specification.
Specifically, for data of a text part, the data of the text is directly mapped into a map layer data to form a text map layer corresponding to the PSD file.
And for data of the picture part, mapping data except the pixel data into picture layer data to form a picture layer corresponding to the PSD file, then storing the pixel data into a pixel data mapping table, and associating the ID of the pixel data mapping table with the layer data.
(3) And (3) setting file header data and color mode data according to the canvas data in the step (1) and PSD file format specifications.
(4) As shown in fig. 3, the file header data, the color pattern data, the layer data, and the pixel data mapping table are written into a file in a binary manner in sequence, so as to obtain a PSD file.
Since the content shown in fig. 2 only includes a group of texts and a picture, in the first embodiment, the mapping is finally performed to form a text layer and a picture layer, and if the content includes multiple groups of texts or multiple pictures, the mapping may be correspondingly performed to form multiple text layers or multiple picture layers.
Example two
A method of generating a PSD file independent of specific software, comprising:
(a) the content to be written to the PSD file is represented in the form of data.
The data includes canvas data including, but not limited to, width, height, color pattern, and background color.
In particular, the content written to the PSD file is simply text, and the data that needs to be provided includes, but is not limited to, font color, font size, text content, distance from the canvas edge, and the like. The distance from the edge of the canvas, which is used to determine where the text content is located within the canvas, typically includes the distance to the left of the canvas and the distance to the top of the canvas.
The manner of providing the above data includes, but is not limited to, employing manual editing.
(b) And (c) converting the data in the step (a) into layer data corresponding to the PSD file according to a PSD file format specification.
Specifically, the data representing the text is directly mapped into the image layer data to form at least one text layer corresponding to the PSD file.
(c) And (b) setting file header data and color mode data according to the canvas data in the step (a) and PSD file format specifications.
(d) And writing the file header data, the color mode data and the layer data into a file in a binary mode according to the sequence to obtain a PSD file.
EXAMPLE III
A method of generating a PSD file independent of specific software, comprising:
pictures to be written to a PSD file are represented in the form of data.
The data also includes canvas data including, but not limited to, width, height, color pattern, and background color.
The content written into the PSD file is simply a picture, and the data that needs to be provided includes, but is not limited to, font color, font size, text content, distance from the canvas edge, etc. The distance from the edge of the canvas, which is used to determine where the picture content is located in the canvas, typically includes the distance from the left side of the canvas and the distance from the top of the canvas.
The manner of providing the above data includes, but is not limited to, employing manual editing.
And (II) converting the data in the step (I) into layer data corresponding to the PSD file according to the format specification of the PSD file.
Specifically, mapping data except for pixel data into image layer data to form at least one image layer corresponding to the PSD file, storing the pixel data into a pixel data mapping table, and associating an ID of the pixel data mapping table with the image layer data.
And (III) according to the canvas data in the step (I), setting file header data and color mode data according to PSD file format specification.
And (IV) writing the file header data, the color mode data, the layer data and the pixel data mapping table into a file in a binary mode according to the sequence to obtain a PSD file.
Also disclosed is a computer readable storage medium having computer readable instructions stored thereon which, when executed, implement any of the above-described methods of generating PSD files independent of specific software.
The above description is only an embodiment of the present invention, but the design concept of the present invention is not limited thereto, and any insubstantial modifications made by using the design concept should fall within the scope of infringing the present invention.

Claims (8)

1. A method of generating a PSD file independent of specific software, comprising:
(1) representing the content to be written into the PSD file in the form of data;
(2) converting the data in the step (1) into layer data corresponding to the PSD file according to PSD file format specifications;
(3) according to the data in the step (1), setting file header data and color mode data according to PSD file format specifications;
(4) and writing the file header data, the color mode data and the layer data into a file in a binary mode according to the sequence to obtain a PSD file.
2. The method of claim 1, wherein the PSD file is generated without depending on specific software, wherein: if the content to be written into the PSD file in the step (1) is a text, in the step (2), the data is directly mapped into a graphic layer data to form at least one text layer corresponding to the PSD file.
3. The method of claim 1, wherein the PSD file is generated without depending on specific software, wherein: if the content to be written into the PSD file in step (1) is a picture, mapping data other than the pixel data into layer data in step (2) to form at least one picture layer corresponding to the PSD file, then storing the pixel data into a pixel data mapping table, and associating the ID of the pixel data mapping table with the layer data; in the step (4), the file header data, the color mode data, the layer data and the pixel data mapping table are written into a file in a binary manner according to the sequence, so as to obtain a PSD file.
4. The method of claim 1, wherein the PSD file is generated without depending on specific software, wherein: if the content to be written into the PSD file in the step (1) includes characters and pictures, in the step (2),
for the characters, directly mapping the data of the characters into graph layer data to form at least one character layer corresponding to the PSD file;
for a picture, mapping data except pixel data into picture layer data to form at least one picture layer corresponding to a PSD file, then storing the pixel data into a pixel data mapping table, and associating an ID of the pixel data mapping table with the layer data;
in the step (4), the file header data, the color mode data, the layer data and the pixel data mapping table are written into a file in a binary manner according to the sequence, so as to obtain a PSD file.
5. The method of claim 1, wherein the PSD file is generated without depending on specific software, wherein: the header data and the color pattern data specifically include width, height, color pattern, and background color.
6. A method of generating a PSD file independent of specific software as claimed in any one of claims 2 to 4, wherein: said data of the text comprises font, font color, font size, text content, distance to canvas edge.
7. A method of generating a PSD file independent of specific software as claimed in any one of claims 3 or 4, wherein: the data for a picture includes distance to the left of the canvas, distance to the top of the canvas, width, height, and pixel data.
8. A storage medium having computer-readable instructions stored therein, the storage medium characterized by: the computer readable instructions when executed perform the method of generating a PSD file independent of specific software as claimed in any one of claims 1 to 7.
CN202210535442.0A 2022-05-17 2022-05-17 Method for generating PSD file independent of PS software and storage medium Pending CN114998455A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210535442.0A CN114998455A (en) 2022-05-17 2022-05-17 Method for generating PSD file independent of PS software and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210535442.0A CN114998455A (en) 2022-05-17 2022-05-17 Method for generating PSD file independent of PS software and storage medium

Publications (1)

Publication Number Publication Date
CN114998455A true CN114998455A (en) 2022-09-02

Family

ID=83027926

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210535442.0A Pending CN114998455A (en) 2022-05-17 2022-05-17 Method for generating PSD file independent of PS software and storage medium

Country Status (1)

Country Link
CN (1) CN114998455A (en)

Similar Documents

Publication Publication Date Title
CN109801347B (en) Method, device, equipment and medium for generating editable image template
CN100356372C (en) Generating method of computer format document and opening method
JP4700423B2 (en) Common charting using shapes
EP1422632A2 (en) Method and apparatus to process portable document format data containing transparency
US20130191732A1 (en) Fixed Format Document Conversion Engine
RU2406142C2 (en) System and method of storing documents in serial binary format
CN108897541B (en) Visual restoration method and device of application program, storage medium and terminal
MXPA03002793A (en) Mixed raster content files.
US20060170685A1 (en) System and method for using device dependent fonts in a graphical display interface
CN104966311A (en) Vector graph storage method used for handwriting signing system
WO2023098448A1 (en) Method for converting ofd file
CN111768461A (en) Picture generation method based on electronic price tags
US7453594B2 (en) Document filing apparatus for storing information added to a document file
US6590674B1 (en) Method and apparatus for creating and maintaining graphic representations of documents under a universal format
CN110474836A (en) A kind of email template generation method, calculates equipment and medium at device
US9977771B2 (en) System and method for printable document viewer optimization
CN104424174B (en) Document processing system and document processing method
CN111444452B (en) Webpage conversion method and device and storage medium
CN112395529B (en) Page loading method, device, equipment and storage medium
CN114998455A (en) Method for generating PSD file independent of PS software and storage medium
US20030210834A1 (en) Displaying static images using spatially displaced sampling with semantic data
CN115424569A (en) Display control method, electronic equipment and display system
CN101853244A (en) Method and device for generating page file
CN103136171A (en) E-book making method based on shock wave flash (SWF)
JPH1186017A (en) Apparatus and method for information processing

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination