Method, device and storage medium for merging PSD files, and electronic device
Patent Information
- Application Number
- CN202510417198.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-02
- Publication Date
- 2026-10-16
AI Technical Summary
[0004]本申请实施例提供了一种PSD文件的合并方法、装置和存储介质及电子设备,以至少解决PSD文件的合并效率较低的技术问题
[0022] In this embodiment, a first PSD file and a second PSD file are obtained. In response to a file merging request, the hierarchical structure corresponding to the first PSD file and the hierarchical structure corresponding to the second PSD file are obtained, wherein the hierarchical structure is a standard organizational form of the elements within the PSD file. Based on the hierarchical structures corresponding to the first and second PSD files, the first and second PSD files are merged to obtain a merged PSD file. By obtaining the hierarchical structures of the two PSD files and merging them based on these hierarchical structures, the purpose of automated PSD file merging is achieved, thereby improving the technical effect of PSD file merging efficiency and solving the technical problem of low PSD file merging efficiency.
Smart Images

Figure CN122925313A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computers, and more specifically, to a method, apparatus, storage medium, and electronic device for merging PSD files. Background Technology
[0002] Engine tools can export and generate PSD files, but if modifications are made to an existing PSD file and the engine tool exports a new PSD file, these two PSD files will differ. Manually merging them would be a labor-intensive task for artists, resulting in low efficiency in merging PSD files. Therefore, there is a problem with the low efficiency of merging PSD files.
[0003] There is currently no effective solution to the above problems. Summary of the Invention
[0004] This application provides a method, apparatus, storage medium, and electronic device for merging PSD files, to at least solve the technical problem of low efficiency in merging PSD files.
[0005] According to one aspect of the embodiments of this application, a method for merging PSD files is provided, comprising: obtaining a first PSD file and a second PSD file; in response to a file merging request, obtaining the hierarchical structure corresponding to the first PSD file and the hierarchical structure corresponding to the second PSD file, wherein the hierarchical structure is a standard organizational form of the internal elements of the PSD file; and merging the first PSD file and the second PSD file based on the hierarchical structure corresponding to the first PSD file and the hierarchical structure corresponding to the second PSD file to obtain a merged PSD file.
[0006] According to another aspect of the embodiments of this application, a PSD file merging apparatus is also provided, comprising: a first acquisition unit, configured to acquire a first PSD file and a second PSD file; a second acquisition unit, configured to acquire, in response to a file merging request, the hierarchical structure corresponding to the first PSD file and the hierarchical structure corresponding to the second PSD file, wherein the hierarchical structure is a standard organizational form of the internal elements of the PSD file; and a merging unit, configured to merge the first PSD file and the second PSD file based on the hierarchical structure corresponding to the first PSD file and the hierarchical structure corresponding to the second PSD file to obtain a merged PSD file.
[0007] As an optional solution, when the first PSD file is a new PSD file and the second PSD file is an old PSD file, the apparatus further includes: a third acquisition unit, used to acquire a first internal element in the first PSD file during the process of merging the first PSD file and the second PSD file based on the hierarchical structure corresponding to the first PSD file and the hierarchical structure corresponding to the second PSD file to obtain a merged PSD file; and a first update unit, used to update the second PSD file based on the first internal element during the process of merging the first PSD file and the second PSD file based on the hierarchical structure corresponding to the first PSD file and the hierarchical structure corresponding to the second PSD file to obtain a merged PSD file.
[0008] As an optional solution, the first update unit includes: an update module, used to update the third internal element using the first internal element when the second PSD file has a third internal element with the same name as the first internal element.
[0009] As an optional solution, if the second PSD file has a layer with the same name as the first internal element, and the first internal element is a control type, the update module includes: a modification submodule, used to modify the layer and coordinates of the third internal element to be the same as the first internal element; and a copy submodule, used to copy the first internal element to cover the third internal element if the first internal element is an image or text.
[0010] As an optional solution, if the second PSD file lacks a layer with the same name as the first internal element, and the first internal element is a control type, the update module includes: a first addition submodule, used to mark the third internal element as deleted and add the first internal element to the second PSD file if both the first and third internal elements are folders, or if the first and third internal elements have different formats; or, a first update submodule, used to update the third internal element to the first internal element if neither the first nor the third internal element is a folder, or if the first and third internal elements have the same format.
[0011] As an optional solution, when the first internal element is an attribute type, the update module includes: a second update submodule, used to update the second attribute using the first attribute when the third internal element has a second attribute with the same name as the first attribute of the first internal element; or, a second add submodule, used to add the second attribute to the third internal element when the second attribute is missing in the third internal element.
[0012] As an optional solution, when the first internal element is an external link type, the update module includes: a third update submodule, used to update the second external link using the first external link when the third internal element has a second external link with the same name as the first external link of the first internal element; a fourth update submodule, used to update the layer order and coordinates of the third internal element based on the updated second external link; or, a third add submodule, used to add the second external link to the third internal element when the second external link is missing in the third internal element.
[0013] As an optional solution, the first update unit includes: a new module, used to add the first internal element to the second PSD file when the second PSD file lacks an internal element with the same name as the first internal element.
[0014] As an optional solution, when the first PSD file is a new PSD file and the second PSD file is an old PSD file, the apparatus further includes: a fourth acquisition unit, used to acquire a second internal element in the second PSD file during the process of merging the first PSD file and the second PSD file based on the hierarchical structure corresponding to the first PSD file and the hierarchical structure corresponding to the second PSD file to obtain a merged PSD file; and a second update unit, used to update the second PSD file based on the second internal element and the first PSD file during the process of merging the first PSD file and the second PSD file based on the hierarchical structure corresponding to the first PSD file and the hierarchical structure corresponding to the second PSD file to obtain a merged PSD file.
[0015] As an optional solution, the second update unit includes a deletion module, used to delete the second internal element in the second PSD file if the first PSD file lacks an internal element with the same name as the second internal element.
[0016] As an optional solution, the above deletion module includes: a deletion submodule, used to mark the second internal element as deleted if the first PSD file lacks a layer with the same name as the second internal element and the second internal element is a control type.
[0017] As an optional solution, when the first PSD file is a new PSD file and the second PSD file is an old PSD file, the merging unit includes: an acquisition module, used to acquire all element association information between each node in the hierarchical structure corresponding to the first PSD file and the second PSD file, wherein the nodes represent internal elements of the PSD file, and the element association information represents the association relationship between the internal elements of the first PSD file and the internal elements of the second PSD file; and a merging module, used to merge the first PSD file and the second PSD file based on the element association information to obtain the merged PSD file.
[0018] As an optional solution, the above-mentioned acquisition module includes: an execution submodule, used to perform the following steps until all the element association information is obtained: determining the current node set from the hierarchical structure corresponding to the first PSD file; determining the current node from the current node set; obtaining the current element association information between the current node and the second PSD file; if there are still nodes in the current node set whose element association information has not been obtained, obtaining the next node from the current node set and determining the next node as the current node; if the set element association information between each node in the current node set and the second PSD file has been obtained, but all the above-mentioned element association information has not been obtained, obtaining the next node set from the hierarchical structure corresponding to the first PSD file and determining the next node set as the current node set; if the set element association information corresponding to all node sets in the hierarchical structure corresponding to the first PSD file has been obtained, determining the set element association information corresponding to all node sets as all the above-mentioned element association information.
[0019] As an optional solution, the above-mentioned apparatus further includes at least one of the following: a first configuration unit, configured to configure a first symbol for internal elements of the control type in the hierarchical structure before obtaining the hierarchical structure corresponding to the first PSD file and the hierarchical structure corresponding to the second PSD file in response to the file merging request; a second configuration unit, configured to configure a second symbol for internal elements of the attribute type in the hierarchical structure before obtaining the hierarchical structure corresponding to the first PSD file and the hierarchical structure corresponding to the second PSD file in response to the file merging request; a third configuration unit, configured to configure a third symbol for internal elements of the external link type in the hierarchical structure before obtaining the hierarchical structure corresponding to the first PSD file and the hierarchical structure corresponding to the second PSD file in response to the file merging request; and a fourth configuration unit, configured to configure a fourth symbol for internal elements of other additional field types in the hierarchical structure before obtaining the hierarchical structure corresponding to the first PSD file and the hierarchical structure corresponding to the second PSD file in response to the file merging request.
[0020] According to another aspect of the embodiments of this application, a computer program product or computer program is provided, which includes computer instructions stored in a computer-readable storage medium. A processor of an electronic device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the electronic device to perform the PSD file merging method described above.
[0021] According to another aspect of the embodiments of this application, an electronic device is also provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the above-described method for merging PSD files through the computer program.
[0022] In this embodiment, a first PSD file and a second PSD file are obtained. In response to a file merging request, the hierarchical structure corresponding to the first PSD file and the hierarchical structure corresponding to the second PSD file are obtained, wherein the hierarchical structure is a standard organizational form of the elements within the PSD file. Based on the hierarchical structures corresponding to the first and second PSD files, the first and second PSD files are merged to obtain a merged PSD file. By obtaining the hierarchical structures of the two PSD files and merging them based on these hierarchical structures, the purpose of automated PSD file merging is achieved, thereby improving the technical effect of PSD file merging efficiency and solving the technical problem of low PSD file merging efficiency. Attached Figure Description
[0023] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:
[0024] Figure 1 This is a schematic diagram illustrating the application environment of an optional PSD file merging method according to an embodiment of this application;
[0025] Figure 2 This is a schematic diagram of the flow of an optional PSD file merging method according to an embodiment of this application;
[0026] Figure 3 This is a schematic diagram of an optional PSD file merging method according to an embodiment of this application;
[0027] Figure 4 This is a schematic diagram of another optional method for merging PSD files according to an embodiment of this application;
[0028] Figure 5 This is a schematic diagram of another optional method for merging PSD files according to an embodiment of this application;
[0029] Figure 6 This is a schematic diagram of another optional method for merging PSD files according to an embodiment of this application;
[0030] Figure 7 This is a schematic diagram of another optional method for merging PSD files according to an embodiment of this application;
[0031] Figure 8 This is a schematic diagram of another optional method for merging PSD files according to an embodiment of this application;
[0032] Figure 9 This is a schematic diagram of another optional method for merging PSD files according to an embodiment of this application;
[0033] Figure 10 This is a schematic diagram of another optional method for merging PSD files according to an embodiment of this application;
[0034] Figure 11 This is a schematic diagram of another optional method for merging PSD files according to an embodiment of this application;
[0035] Figure 12 This is a schematic diagram of another optional method for merging PSD files according to an embodiment of this application;
[0036] Figure 13 This is a schematic diagram of an optional PSD file merging apparatus according to an embodiment of this application;
[0037] Figure 14 This is a schematic diagram of the structure of an optional electronic device according to an embodiment of this application. Detailed Implementation
[0038] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.
[0039] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0040] According to one aspect of the embodiments of this application, a method for merging PSD files is provided. Optionally, as an optional implementation, the above-described method for merging PSD files can be applied to, but is not limited to, [examples of other methods]. Figure 1 The environment shown may include, but is not limited to, user equipment 102 and server 112. User equipment 102 may include, but is not limited to, a display 104, a processor 106 and a memory 108. Server 112 includes a database 114 and a processing engine 116.
[0041] The specific process can be summarized in the following steps:
[0042] In step S102, user equipment 102 obtains a file merge request triggered on the first PSD file (PSD file 1) and the second PSD file (PSD file 2);
[0043] Step S104: Send the file merge request to server 112 via network 110;
[0044] In steps S106-S110, server 112 obtains the first PSD file and the second PSD file through processing engine 116; further obtains the hierarchical structure corresponding to the first PSD file and the hierarchical structure corresponding to the second PSD file, wherein the hierarchical structure is the standard organization form of the internal elements of the PSD file; and based on the hierarchical structure corresponding to the first PSD file and the hierarchical structure corresponding to the second PSD file, merges the first PSD file and the second PSD file to obtain the merged PSD file.
[0045] In step S112, the merged PSD file is sent to user device 102 via network 110. User device 102 displays the merged PSD file on display 104 via processor 106 and stores the merged PSD file in memory 108.
[0046] remove Figure 1 Beyond the examples shown, the user equipment described above can be a terminal device configured with a target client, including but not limited to at least one of the following: mobile phones (such as Android phones, iOS phones, etc.), laptops, tablets, PDAs, MIDs (Mobile Internet Devices), PADs, desktop computers, smart TVs, etc. The target client can be a video client, instant messaging client, browser client, educational client, etc. The network described above can include, but is not limited to, wired networks and wireless networks. The wired network includes local area networks (LANs), metropolitan area networks (MANs), and wide area networks (WANs). The wireless network includes Bluetooth, Wi-Fi, and other networks that enable wireless communication. The server described above can be a single server, a server cluster consisting of multiple servers, or a cloud server. The above is merely an example, and no limitations are imposed in this embodiment.
[0047] As an example, the terminal device may include, but is not limited to, mobile phones, computers, smart voice interaction devices, smart home appliances, vehicle terminals, and aircraft. This embodiment can be applied to various scenarios, including but not limited to digital humans, virtual humans, games, virtual reality, and extended reality (XR).
[0048] For example, a server can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms.
[0049] Alternatively, as an alternative implementation method, such as Figure 2 As shown, the method for merging PSD files can be performed by an electronic device, such as... Figure 1The user equipment or server shown includes the following specific steps:
[0050] S202, Obtain the first PSD file and the second PSD file;
[0051] In an optional embodiment, the PSD (Photoshop Document) file can be a standard file format used by Adobe Photoshop software to store image files and their contained layers, channels, paths, and other information.
[0052] In optional embodiments, the first PSD file and the second PSD file may be read from a storage location (such as a local disk or a network server) to ensure that they are available for subsequent processing.
[0053] S204, in response to the file merging request, obtain the hierarchical structure corresponding to the first PSD file and the hierarchical structure corresponding to the second PSD file, wherein the hierarchical structure is the standard organization form of the elements inside the PSD file;
[0054] In an optional embodiment, the file merging request may be an instruction issued by a user or the system, requesting that two or more PSD files be merged into one.
[0055] In an optional embodiment, the hierarchy can be the organization of elements (such as layers, layer groups, etc.) within the PSD file, which determines the hierarchical relationship and display order between elements.
[0056] In an optional embodiment, in response to a file merging request, the first PSD file and the second PSD file may be analyzed using a parsing tool or library (such as Photoshop's scripting interface or a third-party PSD parsing library) to extract their hierarchical structure information.
[0057] S206. Based on the hierarchical structure corresponding to the first PSD file and the hierarchical structure corresponding to the second PSD file, the first PSD file and the second PSD file are merged to obtain the merged PSD file.
[0058] In an optional embodiment, based on the extracted hierarchical structure information, a merging algorithm (such as recursive merging, intelligent conflict resolution, etc.) can be used to merge the elements of the first PSD file and the second PSD file into a new PSD file. During the merging process, attributes such as dependencies between elements, hierarchical order, and transparency need to be considered.
[0059] Specifically, this embodiment aims to improve the efficiency of PSD file merging and reduce the workload of manual merging. It receives a first PSD file and a second PSD file provided by the user. A parsing tool is used to obtain the hierarchical structure of the two PSD files. Based on the hierarchical structure information, a merging algorithm is used to merge the two PSD files into a new PSD file. The merged PSD file is then saved to a specified location for later use by the user.
[0060] The entire merging process is automated, requiring no manual user intervention and improving efficiency. The merging algorithm considers dependencies and hierarchical order between elements, ensuring that the merged PSD file is visually and logically correct. It can also be expanded to support more image file formats or add more merging options (such as merging specific layers, ignoring certain layers, etc.) to meet the needs of different users.
[0061] To illustrate further, consider this example: a designer uses Photoshop to process an image and generates two PSD files (file A and file B). File A contains the basic design elements, while file B contains subsequent modifications and additions. The designer wants to merge these two files into a single, complete PSD file for further editing and export.
[0062] In this example, designers only need to provide file A and file B to the merging tool and issue a merge request. The merging tool will automatically parse the hierarchical structure of the two files and merge them into a new PSD file. Designers can see a complete combination of all basic design elements and subsequent modified elements in the merged file, without the need for manual layer adjustments and merging.
[0063] Optionally, in this embodiment, version information for each merge can be recorded to facilitate users in reviewing and comparing the differences between different versions.
[0064] Optionally, in this embodiment, when conflicts are encountered during the merging process (such as layers with the same name), multiple resolution strategies are provided (such as automatic renaming, user selection of which to keep, etc.) to meet the needs of different scenarios.
[0065] Optionally, in this embodiment, a preview function is provided before merging, allowing users to see the effect after merging in advance so that necessary adjustments and optimizations can be made.
[0066] It should be noted that, firstly, you need to prepare two PSD files, referred to as "PSD File 1" and "PSD File 2". These two files contain the image elements and layer information that will be merged in subsequent steps.
[0067] When a user initiates a file merge request, the system first parses the "first PSD file" and extracts its internal hierarchical structure. The hierarchical structure is a crucial component of a PSD file, defining how the various elements within the file (such as layers, layer groups, etc.) are organized and their display order.
[0068] Furthermore, this embodiment will also parse the "second PSD file" to obtain its hierarchical structure information. In this way, a complete hierarchical structure view of the two PSD files is obtained.
[0069] With the hierarchical structure information of the two PSD files, this embodiment can begin the merging process. Based on these two hierarchical structures, the elements in the "first PSD file" and the "second PSD file" are automatically merged. During this process, this embodiment considers the hierarchical relationship of elements, their display order, and attribute settings to ensure that the merged file is logically and visually correct.
[0070] After automatic merging, this embodiment will generate a new PSD file. This file contains all elements from the two PSD files before merging, and the hierarchical structure and element attributes are correctly preserved and integrated.
[0071] To further illustrate, optional examples include... Figure 3 As shown, in response to a file addition request, a first PSD file 302 and a second PSD file 304 are obtained; further in response to a file merging request, the hierarchical structure 306 corresponding to the first PSD file 302 and the hierarchical structure 308 corresponding to the second PSD file 304 are obtained; based on the hierarchical structure 306 and the hierarchical structure 308, the first PSD file 302 and the second PSD file 304 are merged to obtain a merged PSD file 310.
[0072] Optionally, the content of this embodiment can be applied to other embodiments described above, or combined with other embodiments described above.
[0073] The embodiments provided in this application obtain a first PSD file and a second PSD file; in response to a file merging request, the hierarchical structure corresponding to the first PSD file and the hierarchical structure corresponding to the second PSD file are obtained, wherein the hierarchical structure is the standard organizational form of the elements within the PSD file; based on the hierarchical structure corresponding to the first PSD file and the hierarchical structure corresponding to the second PSD file, the first PSD file and the second PSD file are merged to obtain a merged PSD file. By obtaining the hierarchical structures of the two PSD files and merging the two PSD files based on these hierarchical structures, the purpose of automating the merging of PSD files is achieved, thereby realizing the technical effect of improving the merging efficiency of PSD files.
[0074] As an optional approach, when the first PSD file is a new PSD file and the second PSD file is an old PSD file, the method further includes merging the first and second PSD files based on their respective hierarchical structures to obtain the merged PSD file.
[0075] S1-1, retrieve the first internal element in the first PSD file;
[0076] You can extract specific elements from the first PSD file that need to be used to update the old file, such as newly added layers, modified layer styles, etc.
[0077] S1-2, based on the first internal element, update the second PSD file.
[0078] The system allows comparison of the differences between corresponding elements in the first and second PSD files. Based on the comparison results, the corresponding elements are replaced or added in the second PSD file to reflect the updated content in the first PSD file. During the update process, it ensures that the overall hierarchical structure of the second PSD file is not disrupted, maintaining file consistency and readability.
[0079] In an optional embodiment, the first PSD file is a new PSD file containing the latest design elements and hierarchical structure.
[0080] In an optional embodiment, the second PSD file is an older PSD file that contains previous design elements and hierarchical structures.
[0081] In an optional embodiment, the first internal element is a specific internal element in the first PSD file, such as a layer, layer style, or image data.
[0082] In an optional embodiment, the merged PSD file is the final file obtained by merging the first PSD file and the updated second PSD file.
[0083] It should be noted that during the process of merging PSD files, when encountering a new PSD file (the first PSD file) and an old PSD file (the second PSD file), it is not only necessary to merge the two into a unified PSD file, but also to update the old file according to the internal elements of the new file.
[0084] This process aims to ensure that the merged PSD file contains the latest content of the new file, retains the necessary information of the old file through an update mechanism, and optimizes the file structure.
[0085] To illustrate further, consider the optional assumption that a designer, while creating a new poster, makes extensive modifications to an old PSD file (the second PSD file) to generate a new PSD file (the first PSD file).
[0086] When merging the two files, the system detected that a gradient background layer and an adjusted text layer had been added to the first PSD file.
[0087] Therefore, the system added these new elements to the second PSD file and replaced the corresponding background and text layers in the old file, thus obtaining a merged PSD file that contained the new elements while maintaining the original design framework.
[0088] Optionally, the content of this embodiment can be applied to other embodiments described above, or combined with other embodiments described above.
[0089] The embodiments provided in this application obtain a first internal element from a first PSD file; based on the first internal element, a second PSD file is updated. By automating the update of the old file, there is no need to manually copy and paste new elements, greatly improving work efficiency and thus achieving the technical effect of improving the merging efficiency of PSD files.
[0090] As an optional approach, based on the first internal element, the second PSD file is updated, including:
[0091] In the second PSD file, if there is a third inner element with the same name as the first inner element, use the first inner element to update the third inner element.
[0092] In an optional embodiment, the first internal element is a specific element in the first PSD file that needs to be updated.
[0093] In an optional embodiment, the third inner element is an element in the second PSD file that has the same name as the first inner element.
[0094] Optionally, in this embodiment, updating is the process of replacing old elements with new ones.
[0095] For example, search for a third inner element with the same name as the first inner element in the second PSD file. If found, proceed to the next step; if not found, process according to preset rules (such as adding a new element, ignoring, etc.).
[0096] For example, copy all properties of the first inner element (such as layer style, opacity, position, etc.) to the third inner element. In the second PSD file, replace the original third inner element with the updated third inner element. Ensure that the updated third inner element's layer position remains unchanged in the second PSD file to maintain the integrity of the file structure.
[0097] It should be noted that during the merging of PSD files, when an internal element (first internal element) in the new PSD file (first PSD file) needs to be used to update an old PSD file (second PSD file), if an internal element with the same name as these new elements exists in the old file (third internal element), the new element will directly replace the old element. This process aims to ensure that the merged PSD file accurately reflects the latest design content while maintaining a clear and consistent file structure.
[0098] To illustrate further, for example, when a designer is creating a new version of the UI, they may redesign the button layer in the old version of the PSD file (the second PSD file) and generate a new button layer (the first internal element).
[0099] When merging old and new files, the system detected a button layer (third inner element) with the same name in the old file. Therefore, the system replaced the attributes of the old button layer with all the attributes of the new button layer, thus updating the button layer.
[0100] Optionally, the content of this embodiment can be applied to other embodiments described above, or combined with other embodiments described above.
[0101] Through the embodiments provided in this application, when a third internal element with the same name as a first internal element exists in the second PSD file, the third internal element is updated using the first internal element. By directly replacing the element with the same name, it is ensured that the merged PSD file contains only the latest design content, avoiding errors and omissions that may occur due to manual updates, thereby achieving the technical effect of improving the accuracy of merging PSD files.
[0102] As an optional approach, if the second PSD file contains a layer with the same name as the first inner element, and the first inner element is a control type, then the third inner element is updated using the first inner element, including:
[0103] S2-1, modify the level and coordinates of the third inner element to be the same as those of the first inner element;
[0104] Search for a third inner element with the same name as the first inner element in the second PSD file, and confirm that it is a layer type.
[0105] Additionally, check if the first inner element is a control type. Read its hierarchy and coordinate properties from the first inner element.
[0106] The retrieved layer and coordinate attributes are applied to the third inner element to update the layer and position.
[0107] S2-2, if the first inner element is an image or text, copy the first inner element to overwrite the third inner element.
[0108] Check if the first internal element is an image or text type.
[0109] Create a copy of the first inner element. In the second PSD file, replace the original third inner element with the copied copy of the first inner element, achieving direct content replacement.
[0110] In an optional embodiment, the hierarchy can be the stacking order of layers in the PSD file.
[0111] In an optional embodiment, the coordinates can be the layer's position information within the PSD file.
[0112] In an optional embodiment, the control type can refer to a layer type with specific functions and attributes, such as a button, slider, etc.
[0113] In an alternative embodiment, the image or text may refer to a layer type that does not contain complex interactive features and is primarily used to display static content.
[0114] It should be noted that during the merging of PSD files, when a control-type internal element (first internal element) in the new PSD file (first PSD file) needs to update a layer with the same name in the old PSD file (second PSD file) (third internal element, specifically referring to the layer), different update strategies are adopted depending on the element type.
[0115] If the first inner element is a control, its hierarchy and coordinate properties are copied to the third inner element; if the first inner element is an image or text, it is directly copied to overwrite the third inner element. This process aims to ensure that the merged PSD file accurately reflects the latest design while maintaining the hierarchy and position information of controls, and directly replacing images and text.
[0116] To illustrate further, an example could be a designer updating a PSD file of a UI interface and discovering a redesigned button (control type, first internal element) and a new background image (image type) in the new design.
[0117] When merging old and new files, the system first detects a button layer (the third inner element) with the same name in the old file. It then applies the new button's layer and coordinate attributes to the old button layer, updating the button's position and layer. Next, the system detects the new background image and directly copies the new image to replace the background layer in the old file.
[0118] Optionally, the content of this embodiment can be applied to other embodiments described above, or combined with other embodiments described above.
[0119] The embodiments provided in this application modify the layer and coordinates of the third inner element to be the same as those of the first inner element. If the first inner element is an image or text, it is copied to overwrite the third inner element. By updating the layer and coordinates of the control layers, the position and layer information of the controls in the merged PSD file are ensured to be consistent with the latest design draft. For image and text elements, direct copying and replacement avoids errors and inconveniences that may result from manual adjustments, thereby achieving the technical effect of improving the accuracy of PSD file merging.
[0120] As an alternative, if the second PSD file lacks a layer with the same name as the first inner element, and the first inner element is a control type, the third inner element can be updated using the first inner element, including:
[0121] S3-1, if both the first and third inner elements are folders, or if the first and third inner elements are of different formats, mark the third inner element as deleted and add the first inner element to the second PSD file.
[0122] Search the second PSD file for a layer or folder with the same name as the first internal element, and confirm that it does not exist.
[0123] Although the third internal element does not exist, for the sake of process consistency, it is logically marked as "deleted" to prepare for the addition of a new element.
[0124] Add a first internal element to the second PSD file as a new layer or folder.
[0125] S3-2, if the first inner element and the third inner element are not both folders, or if the first inner element and the third inner element have the same format, update the third inner element to the first inner element.
[0126] Similarly, search the second PSD file for a layer with the same name as the first internal element to confirm that it does not exist.
[0127] There's no need to mark and delete non-existent third inner elements; simply add the first inner element directly as a new layer in the second PSD file.
[0128] In an alternative embodiment, the folder can be a container within a PSD file used to organize layers.
[0129] In an alternative embodiment, the format may refer to the content type or structure of a layer or folder.
[0130] In an optional embodiment, the deletion marker may be to mark an element in the PSD file as pending deletion. Although this is mainly used for logical preparation steps in this scenario, since the third internal element does not exist in the first place.
[0131] It should be noted that during the merging of PSD files, when a control-type internal element (first internal element) in a new PSD file (first PSD file) needs to be updated in an old PSD file (second PSD file), if the old file lacks a layer (third internal element, specifically referring to a layer or folder) with the same name as the first internal element, different update or addition strategies will be adopted based on the type and format of the first internal element and the potential third internal element (if it exists, but in this scenario it is assumed or does not exist).
[0132] If both are folders or have different formats, mark the deletion of non-existent third inner elements in the old file (actually, this is preparatory work before adding new elements, since the third inner element does not exist in the first place), and add a new first inner element.
[0133] If both are not folders or have the same format, the first inner element is added directly to the old file as the updated content, overriding any assumed existence of a third inner element (which is actually adding a new element because the third inner element does not exist).
[0134] To illustrate further, an example could be a designer updating a complex UI PSD file and discovering that a new control group (folder type, containing multiple sub-controls, the first inner element) has been added to the new design.
[0135] When merging old and new files, the system detects that there is no folder or layer with the same name as the new control group in the old file. Since the new control group is a folder and there is no corresponding folder or layer in the old file, the system logically "marks" the non-existent corresponding element for deletion (in reality, no deletion operation is performed, it is just preparation for the process), and adds the new control group folder and all its child controls to the old file.
[0136] Optionally, the content of this embodiment can be applied to other embodiments described above, or combined with other embodiments described above.
[0137] The embodiments provided in this application, when both the first and third internal elements are folders, or when the first and third internal elements have different formats, mark the third internal element as deleted and add the first internal element to the second PSD file; or, when the first and third internal elements are not both folders, or when the first and third internal elements have the same format, update the third internal element to the first internal element. By identifying missing layers or folders with the same name in the old file and flexibly adopting a strategy of adding new elements, it is ensured that the merged PSD file contains the latest design content. For folder-type elements, by adding the entire folder and its contents, the clarity and order of the layer structure in the PSD file are maintained, thereby achieving the technical effect of improving the accuracy of merging PSD files.
[0138] As an alternative, if the first inner element is an attribute type, use the first inner element to update the third inner element, including:
[0139] S4-1, In the case where the third inner element has a second attribute with the same name as the first attribute of the first inner element, use the first attribute to update the second attribute;
[0140] Search within the third inner element for a second property that has the same name as the first property of the first inner element.
[0141] Use the value of the first attribute to update the value of the second attribute in the third inner element.
[0142] S4-2, In the case where the third inner element lacks a second attribute, add a second attribute to the third inner element.
[0143] Check if a second attribute with the same name as the first attribute exists in the third inner element, and confirm that it does not exist.
[0144] Add a second property with the same name as the first property to the third inner element, and assign the value of the first property to it.
[0145] In an optional embodiment, the attribute type can refer to a configurable or modifiable characteristic of an element, such as color, transparency, font size, etc.
[0146] In an optional embodiment, the first attribute may be a specific attribute in the first internal element that needs to be updated.
[0147] In an optional embodiment, the second attribute may be an attribute in a third inner element that has the same name as the first attribute.
[0148] It should be noted that during the merging or updating of PSD files, when a new PSD file (or design element set) encounters an attribute-type internal element (first internal element) that needs to update a corresponding element (third internal element) in an older PSD file (or design element set), if the first internal element is an attribute type (such as color, transparency, font size, etc.), different update strategies are adopted depending on whether an attribute with the same name as the first internal element (second attribute) already exists in the third internal element. If the third internal element already has a second attribute with the same name, the first attribute of the first internal element is used to update the value of the second attribute. If the third internal element lacks the second attribute, the attribute is added and assigned the value of the first attribute of the first internal element.
[0149] To further illustrate, consider this example: When a designer updates a button design, they might notice a change in the button's text color (first internal element, attribute type) in the new design. During the merging of the old and new design files, the system recognizes that the button layer (third internal element) in the old file already has a "text color" attribute (second attribute), but its value differs from the color in the new design. Therefore, the system updates the "text color" attribute (second attribute) of the button layer in the old file with the new text color attribute (first attribute). Alternatively, if the button layer in the old file originally did not have a "text color" attribute, the system will add this attribute and assign it a new text color value.
[0150] Optionally, the content of this embodiment can be applied to other embodiments described above, or combined with other embodiments described above.
[0151] Through the embodiments provided in this application, when a third internal element has a second attribute with the same name as a first attribute of a first internal element, the first attribute is used to update the second attribute; or, when a second attribute is missing in a third internal element, a second attribute is added to the third internal element. By identifying and updating the values of attributes with the same name, it is ensured that the element attributes in the merged PSD file or design element set are consistent with the latest design draft. For missing attributes, by adding and assigning values, it is ensured that the element can fully reflect all attribute information in the latest design draft, thereby achieving the desired technical effect.
[0152] As an alternative, if the first inner element is an external link type, use the first inner element to update the third inner element, including:
[0153] S5-1, In the case where the third inner element has a second outer link with the same name as the first outer link of the first inner element, use the first outer link to update the second outer link;
[0154] Search within the third inner element for a second outer link with the same name as the first outer link of the first inner element. S5-2, based on the updated second outer link, update the layer order and coordinates of the third inner element;
[0155] Update the value of the second outer link in the third inner element using the value of the first outer link.
[0156] S5-3: In the case where the third inner element lacks a second outer link, add a second outer link to the third inner element.
[0157] If the introduction of a new external link causes changes to the design layout, then the layer order and coordinates of the third internal element are updated based on the updated second external link.
[0158] In an optional embodiment, the external link type can refer to a link where an element depends on external files (such as images, icons, font files, etc.).
[0159] In an optional embodiment, the first external link may be a link to an external file that the first internal element depends on.
[0160] In an optional embodiment, the second external link may be an external link in a third internal element that may have the same name as the first external link.
[0161] In an optional embodiment, the layer order can be the stacking order of layers in the PSD file.
[0162] In an optional embodiment, the coordinates can be the layer's position information within the PSD file.
[0163] It should be noted that in scenarios involving the merging of PSD files or design resources, when a new design element (the first internal element) is an external link type (such as a link to an image, icon, or font file), if that element needs to update an old design element (the third internal element), different update strategies will be adopted depending on whether an external link with the same name as the new element's external link already exists in the old element (the second external link).
[0164] If an existing element contains a backlink with the same name, the backlink in the old element (the second backlink) is updated using the new element's backlink (the first backlink). The layer order and coordinates of the old element may also be updated accordingly to reflect the new design layout. If the old element lacks the backlink, it is added.
[0165] To illustrate further, consider this scenario: When a designer updates a promotional poster design, they discover that the new design incorporates a new background image (first internal element, external link type). During the merging of the old and new design files, the system recognizes a layer named "Background" (third internal element) in the old file, whose external link points to an older background image (second external link, but with the old value at this point).
[0166] Therefore, the system updated the "Background" layer's external link (second external link) in the old file using the new background image external link (first external link). Furthermore, because the size and position of the new background image may differ from the old image, the system also updated the layer order and coordinates of the "Background" layer based on the updated external link to ensure the new design layout is correctly rendered. If the old file did not originally have a layer or external link named "Background," the system will add this layer and external link for it.
[0167] Optionally, the content of this embodiment can be applied to other embodiments described above, or combined with other embodiments described above.
[0168] Through the embodiments provided in this application, when a third internal element has a second external link with the same name as a first external link of the first internal element, the first external link is used to update the second external link; based on the updated second external link, the layer order and coordinates of the third internal element are updated; or, if a second external link is missing in the third internal element, a second external link is added to the third internal element. By identifying and updating the values of external links with the same name, it is ensured that the merged PSD file or design resource can correctly reference the latest external file. While updating the external links, the layer order and coordinates are intelligently adjusted according to the information of the external file pointed to by the new external link (such as size, position, etc.) to maintain the overall layout and visual effect of the design. The automated external link update and layout adjustment process reduces the time of manual operation, thereby achieving the technical effect of improving the merging efficiency of PSD files.
[0169] As an optional approach, based on the first internal element, the second PSD file is updated, including:
[0170] If the second PSD file lacks an inner element with the same name as the first inner element, add the first inner element to the second PSD file.
[0171] Search the second PSD file for an internal element with the same name as the first internal element, and confirm that it does not exist.
[0172] Add an inner element with the same name as the first inner element to the second PSD file, and copy or reference all relevant attributes and content of the first inner element.
[0173] In an optional embodiment, the inner element with the same name can be an element in the second PSD file that has the same name as the first inner element.
[0174] It should be noted that in scenarios involving the merging or updating of design resources, when a new design element (the first internal element) needs to be integrated into an existing PSD file (the second PSD file), if the second PSD file lacks an element with the same name as the first internal element, the system will automatically add that first internal element to the second PSD file. This process aims to ensure that new design elements can be seamlessly integrated into existing design files, thereby maintaining the integrity and consistency of the design.
[0175] To illustrate further, an example could be a designer updating a web page project and discovering that the new design includes a new button element (the first inner element) with specific style, size, and position information.
[0176] When integrating this new button into the existing PSD file (the second PSD file), the designer discovered that the second PSD file did not contain an element with the same name as the new button. Therefore, the designer used the automation function in the design tool to add the button element to the second PSD file, while preserving all its style and position information in the new design.
[0177] Optionally, the content of this embodiment can be applied to other embodiments described above, or combined with other embodiments described above.
[0178] The embodiments provided in this application demonstrate how, in the case of a missing internal element with the same name as the first internal element in the second PSD file, a first internal element is added to the second PSD file. By automatically checking for missing elements and adding the first internal element to the second PSD file, it is ensured that the new design element can be seamlessly integrated into the existing design file, avoiding omissions or errors that may occur when manually adding elements. The newly added internal element not only has the same name as in the new design draft but also retains all its related attributes and content, thereby ensuring the consistency and integrity of the updated second PSD file in terms of design, thus achieving the technical effect of improving the merging efficiency of PSD files.
[0179] As an optional approach, when the first PSD file is a new PSD file and the second PSD file is an old PSD file, the method further includes merging the first and second PSD files based on their respective hierarchical structures to obtain the merged PSD file.
[0180] S6-1, retrieve the second internal element in the second PSD file;
[0181] Confirm that the first PSD file is the new design file and the second PSD file is the old design file, and prepare to merge them.
[0182] Identify and extract the second internal elements in the second PSD file that need to be considered or updated during the merging of the old and new files.
[0183] S6-2, based on the second internal element and the first PSD file, update the second PSD file.
[0184] Update the second PSD file based on the latest design changes or added elements in the first PSD file, as well as the specific requirements of the second internal elements. This may include adding new layers, modifying the properties of existing layers, deleting layers that are no longer needed, etc.
[0185] After updating the second PSD file based on the second internal element, the two are merged into a new PSD file according to the hierarchical structure of the first and second PSD files, which is the merged PSD file.
[0186] It should be noted that during the design project iteration or resource integration process, it is often necessary to merge the new design file (first PSD file) with the old design file (second PSD file) to integrate the latest design changes or add new design elements.
[0187] When merging the first PSD file as the new file and the second PSD file as the old file, in addition to merging based on their hierarchical structures, it is also necessary to consider how to update the second PSD file based on specific elements (second internal elements) in the second PSD file to ensure that the merged PSD file contains both the latest design changes and retains important design elements and information from the old file.
[0188] To illustrate further, consider a UI design project where a designer completes a new version of the interface design (first PSD file) and needs to merge it with an older version (second PSD file). During the merging process, the designer discovers a specific button element in the older version (second internal element) that has undergone some style updates in the new version.
[0189] Therefore, the system first identified the button element in both the old and new files, and then updated the button in the old file based on the button style in the new version. Finally, the system merged the hierarchical structures of the old and new files, resulting in a merged PSD file that includes both the design changes from the new version and the important design elements from the old version.
[0190] Optionally, the content of this embodiment can be applied to other embodiments described above, or combined with other embodiments described above.
[0191] The embodiments provided in this application obtain second internal elements from a second PSD file; based on the second internal elements and a first PSD file, the second PSD file is updated. By updating the second PSD file based on the second internal elements during the merging of old and new files, it is ensured that the merged PSD file retains important design elements and information from the old file. The merged PSD file not only contains important elements from the old file but also integrates the latest design changes from the new file, thereby achieving design iteration and updates, and thus improving the technical effect of merging PSD files.
[0192] As an optional approach, based on the second internal element and the first PSD file, the second PSD file is updated, including:
[0193] If the first PSD file lacks an inner element with the same name as the second inner element, delete the second inner element for the second PSD file.
[0194] Confirm that the first PSD file is the new design file and the second PSD file is the old design file, and prepare to merge or update them.
[0195] Search the first PSD file for an inner element with the same name as the second inner element, and confirm that it does not exist.
[0196] Given that the first PSD file lacks an internal element with the same name as the second internal element, the second internal element is deleted from the second PSD file.
[0197] In an optional embodiment, the inner element with the same name can be an element in the first PSD file that has the same name as the second inner element.
[0198] It should be noted that in scenarios involving design file iteration or resource integration, when it is necessary to merge or update a new design file (the first PSD file) with an old design file (the second PSD file), in addition to considering the hierarchical structure and element correspondence between the two, it is also necessary to update the old file based on specific elements (the second internal elements) in the old file.
[0199] In particular, if a new file lacks an element with the same name as a specific element in the old file, it may mean that the element has been removed or replaced in the new design, and therefore the element needs to be deleted accordingly when updating the old file. This process aims to ensure that the merged or updated design file reflects the latest design changes while avoiding unnecessary redundant elements.
[0200] To further illustrate, consider a UI design project where a designer completes a new version of the interface design (first PSD file) and plans to merge it with an older version (second PSD file). During the merging process, the designer discovers a specific icon element in the older version (second internal element), but this icon has been replaced with another icon in the new version.
[0201] Therefore, when checking the element correspondence between the old and new files, the system found that the new version was missing an element with the same name as the icon in the old version. Based on this discovery, the system deleted this no longer needed icon element when updating the old file.
[0202] Optionally, the content of this embodiment can be applied to other embodiments described above, or combined with other embodiments described above.
[0203] The embodiments provided in this application allow for the deletion of a second internal element from the first PSD file if the first PSD file lacks an internal element with the same name as the second internal element. By deleting unnecessary elements (second internal elements) from the old file during the merging or updating of old and new files, redundant elements are avoided in the merged file. After deleting redundant elements, the merged or updated design file is more concise and clear, consistent with the latest design changes, thereby achieving the technical effect of improving the accuracy of PSD file merging.
[0204] As an optional approach, the second internal element can be removed from the second PSD file, including:
[0205] If the first PSD file lacks a layer with the same name as the second inner element, and the second inner element is a control type, mark the second inner element as to be deleted.
[0206] Confirm that the first PSD file is the new design file and the second PSD file is the old design file, and prepare to synchronize or merge them.
[0207] Check the first PSD file to see if a layer with the same name as the second internal element exists, and confirm that it does not exist.
[0208] Determine whether the second inner element is a control type element.
[0209] When the first PSD file lacks a layer with the same name as the second internal element, and the second internal element is a control type, mark the element in the second PSD file for deletion instead of deleting it directly.
[0210] In an optional embodiment, the layer with the same name can be a layer in the first PSD file that has the same name as the second internal element.
[0211] It should be noted that during the iterative update of design files, when it is necessary to synchronize or merge the new design file (first PSD file) with the old design file (second PSD file), elements that may have been removed or replaced in the old file need to be processed accordingly in the old file.
[0212] In particular, when an element (the second inner element) in the old file is a control type element that does not exist in the new file, and a layer with the same name as that element is missing in the new file, this indicates that the control has been removed or replaced in the new design. In this case, to maintain the consistency and cleanliness of the design files, the control element in the old file should be marked for deletion instead of being deleted directly, so that the element can be traced or restored when needed.
[0213] To illustrate further, for example, in a mobile application design project, the designer completes a new version of the user interface design (first PSD file) and plans to synchronize this new version with the old version of the user interface design (second PSD file).
[0214] During the synchronization process, the system discovered a specific button control (second internal element) in the old version, but this button had been removed in the new version, and a layer with the same name as the button was missing in the new version. Based on this discovery, when updating the old file, the system does not directly delete the button control, but instead marks it for deletion so that the button's design can be traced or restored if needed.
[0215] Optionally, the content of this embodiment can be applied to other embodiments described above, or combined with other embodiments described above.
[0216] In the embodiments provided in this application, if a layer with the same name as the second internal element is missing in the first PSD file, and the second internal element is a control type, the second internal element is marked for deletion. By marking control type elements that have been removed from the old file in the new file for deletion during the synchronization process of the old and new files, design inconsistencies that may be caused by direct deletion are avoided, thereby achieving the technical effect of improving the accuracy of merging PSD files.
[0217] As an optional approach, if the first PSD file is a new PSD file and the second PSD file is an old PSD file, the first PSD file and the second PSD file are merged based on their respective hierarchical structures to obtain a merged PSD file, including:
[0218] S7-1, Obtain all element association information between each node in the hierarchical structure corresponding to the first PSD file and the second PSD file. Here, nodes are used to represent internal elements of the PSD file, and element association information is used to represent the association relationship between internal elements of the first PSD file and internal elements of the second PSD file.
[0219] First, obtain the nodes in the hierarchical structure corresponding to the first PSD file. These nodes represent the elements within the PSD file. Then, obtain all element association information between these nodes and the second PSD file. This information is used to represent the correspondence between elements in the two files.
[0220] S7-2, based on element association information, merge the first PSD file and the second PSD file to obtain the merged PSD file.
[0221] Based on the obtained element association information, the first and second PSD files are merged. During the merging process, the relationships between elements are considered to ensure that the merged PSD file contains both the latest design changes and retains necessary historical elements.
[0222] In an optional embodiment, a node is a unit that represents an element within a PSD file in a hierarchical structure.
[0223] In an optional embodiment, element association information: data representing the association relationship between elements within the first PSD file and elements within the second PSD file.
[0224] It should be noted that in design file management and version update scenarios, it is often necessary to merge new design files (first PSD file) with old design files (second PSD file) to integrate the latest design changes and retain necessary historical information.
[0225] This approach aims to intelligently merge old and new PSD files by comparing their hierarchical structures and based on the element relationships within those structures, thereby generating a merged PSD file that includes both the latest design changes and retains necessary historical elements.
[0226] To further illustrate, consider a UI design project where a designer completes a new version of the user interface design (first PSD file) and plans to merge it with an older version (second PSD file). During the merging process, the system first obtains the hierarchical structure and element relationship information of the two files.
[0227] Then, based on this information, the system matched and integrated the new and modified elements in the new version with the elements in the old version. The result was a merged PSD file that included both the latest design changes from the new version and retained necessary historical elements from the old version.
[0228] Optionally, the content of this embodiment can be applied to other embodiments described above, or combined with other embodiments described above.
[0229] The embodiments provided in this application obtain all element association information between each node in the hierarchical structure corresponding to the first PSD file and the second PSD file. Nodes represent elements within the PSD file, and element association information indicates the relationship between elements within the first and second PSD files. Based on the element association information, the first and second PSD files are merged to obtain a merged PSD file. By intelligently merging old and new PSD files, designers can quickly integrate the latest design changes without manually copying and pasting elements, thereby improving design efficiency and achieving the technical effect of improving the accuracy of PSD file merging.
[0230] As an optional approach, obtain all element association information between each node in the hierarchical structure corresponding to the first PSD file and the second PSD file, including:
[0231] Perform the following steps until all element association information is obtained:
[0232] S8-1, Determine the current set of nodes from the hierarchical structure corresponding to the first PSD file;
[0233] S8-2, determine the current node from the current node set;
[0234] S8-3, retrieve the current element association information between the current node and the second PSD file;
[0235] S8-4: If there are still nodes in the current node set that have not obtained element association information, obtain the next node from the current node set and determine the next node as the current node;
[0236] S8-5: If the association information of each node in the current node set with the second PSD file has been obtained, but not all the association information has been obtained, then the next node set is obtained from the hierarchical structure corresponding to the first PSD file, and the next node set is determined as the current node set.
[0237] S8-6, Given that the association information of all node sets corresponding to the set elements in the hierarchical structure corresponding to the first PSD file has been obtained, the association information of all node sets corresponding to the set elements is determined as the association information of all elements.
[0238] In an optional embodiment, the current set of nodes may be the set of nodes currently being processed in the first PSD file hierarchy.
[0239] In an optional embodiment, the current node can be the node currently being processed in the current node set.
[0240] In an optional embodiment, the next node can be the node that needs to be processed immediately following the current node in the current node set.
[0241] In an optional embodiment, the set element association information may be a set of element association information between all nodes in the current node set and the second PSD file.
[0242] It should be noted that this embodiment aims to obtain the element association information between each node (representing an internal element of the PSD file) and the second PSD file by traversing the hierarchical structure of the first PSD file (the first PSD file is the newer version and the second PSD file is the older version). This process will continue until all element association information between all nodes in the first PSD file and the second PSD file is obtained.
[0243] To illustrate further, an example is a UI design iteration where the designer needs to merge two versions of PSD files. The older PSD file (the second PSD file) contains earlier design elements, while the newer PSD file (the first PSD file) contains updates and additions to those elements.
[0244] To merge these two files, the system needs to obtain the association information between each new element and each old element. In this embodiment, the system can traverse the hierarchical structure of the new PSD file, process each node, and ultimately obtain all element association information between all new and old elements.
[0245] Optionally, the content of this embodiment can be applied to other embodiments described above, or combined with other embodiments described above.
[0246] The embodiments provided in this application involve performing the following steps until all element association information is obtained: determining the current node set from the hierarchical structure corresponding to the first PSD file; determining the current node from the current node set; obtaining the current element association information between the current node and the second PSD file; if there are still nodes in the current node set whose element association information has not been obtained, obtaining the next node from the current node set and determining the next node as the current node; if the set element association information between each node in the current node set and the second PSD file has been obtained, but not all element association information has been obtained, obtaining the next node set from the hierarchical structure corresponding to the first PSD file and determining the next node set as the current node set; if the set element association information corresponding to all node sets in the hierarchical structure corresponding to the first PSD file has been obtained, determining the set element association information corresponding to all node sets as the complete element association information. By traversing the hierarchical structure of the new version of the PSD file and obtaining the element association information between each node and the old version of the PSD file, the effective merging of the two PSD files is achieved, thereby improving the technical effect of improving the merging efficiency of PSD files.
[0247] As an optional approach, before obtaining the hierarchical structure corresponding to the first PSD file and the hierarchical structure corresponding to the second PSD file in response to the file merging request, the method further includes at least one of the following:
[0248] S9-1 is an internal element of the control type in the hierarchical structure, configured with the first symbol;
[0249] Traverse the hierarchical structure of the PSD file, and for internal elements that belong to the control type, configure the first symbol to identify them.
[0250] S9-2 is an internal element of an attribute type in a hierarchical structure, configured with a second symbol;
[0251] Continue traversing the hierarchical structure, and for internal elements that belong to the attribute type, configure a second symbol to distinguish them.
[0252] S9-3 is an internal element belonging to the external link type in the hierarchical structure, configured with a third symbol;
[0253] During the traversal, for internal elements that are of the external link type, a third symbol is configured to indicate their link relationship with other elements.
[0254] S9-4 is an internal element belonging to other additional field types in the hierarchical structure, configured with the fourth symbol.
[0255] For the remaining additional field types within the hierarchical structure, configure a fourth symbol for uniform identification.
[0256] In an optional embodiment, the internal elements of the control type can be elements in the PSD file used to perform specific functions or display specific information, such as buttons, text boxes, etc.
[0257] In an optional embodiment, the element inside the attribute type can be an element that describes or defines the characteristics of other elements, such as attributes like color, size, and position.
[0258] In an optional embodiment, the internal elements of the external link type can be elements that link to other files or resources, such as external images, fonts, etc.
[0259] In an optional embodiment, the internal elements of other additional field types can be elements of other types besides controls, attributes, and external links, and may contain additional information or data.
[0260] In optional embodiments, the symbols can be tags or identifiers used to identify or distinguish different types of internal elements. For example, the first symbol can be a symbol for internal elements of a control type. The second symbol can be a symbol for internal elements of an attribute type. The third symbol can be a symbol for internal elements of an external link type. The fourth symbol can be a symbol for internal elements of other additional field types.
[0261] It should be noted that, before responding to file merge requests, to improve the efficiency and accuracy of PSD file processing, this embodiment proposes configuring different types of symbols for the internal elements in the PSD file's hierarchical structure. These symbols are used to distinguish elements of different natures in the hierarchical structure, such as controls, attributes, external components, and other additional fields. By configuring these symbols, different types of elements can be identified and processed more quickly during the subsequent file merging process, thereby improving merging efficiency and ensuring accuracy.
[0262] To further illustrate, consider an optional assumption that a PSD file contains multiple internal elements of different types, such as buttons (control type), color values (attribute type), external image links (external link type), and annotation information (other additional field types). According to this embodiment, before responding to a file merge request, different symbols can be configured for each of these different types of elements. For example, the button element is configured as "B" (first symbol), the color value element as "C" (second symbol), the external image link as "L" (third symbol), and the annotation information as "N" (fourth symbol).
[0263] Optionally, the content of this embodiment can be applied to other embodiments described above, or combined with other embodiments described above.
[0264] The embodiments provided in this application configure a first symbol for internal elements of the control type in the hierarchical structure; a second symbol for internal elements of the attribute type in the hierarchical structure; a third symbol for internal elements of the external link type in the hierarchical structure; and a fourth symbol for internal elements of other additional field types in the hierarchical structure. By configuring symbols for different types of internal elements, these elements can be identified and processed more quickly during subsequent file merging, reducing the workload of manual inspection and classification, thereby achieving the technical effect of improving the merging efficiency of PSD files.
[0265] As an alternative solution, for ease of understanding, the PSD file merging method is applied to scenarios where game engines such as UE or Unity export and generate PSD files. Suppose there is a tool of an engine (such as UE or Unity) that can export and generate PSD files. If the artist makes modifications based on this PSD, and the engine tool exports another PSD, then the two PSDs will be different. If the artist has to merge them manually, the workload will be too large, thus reducing the efficiency of merging PSD files.
[0266] It should be noted that the solution in this embodiment first defines a hierarchical structure for the PSD. The purpose of the hierarchical structure is to make the PSD more organized. The merging tool automatically merges the PSDs based on the hierarchical structure, while also informing the artists which controls have been modified. Added controls will have "-a-" prefixed to their names, and deleted controls will have "-d-" prefixed to their names. In this way, the artists only need to focus on processing the modified controls, while other adjustments are handled by default and do not require the artists' attention.
[0267] To further illustrate, optional examples include... Figure 4 As shown, first create the root directory of the PSD file, such as Psd, then create a function folder, such as Test. Under the Test directory, there are two folders, one is PsdNew and the other is PsdOld, which will store the new and old files of the same PSD file respectively, such as TestHorizontalBox.psd.
[0268] Optional based on Figure 4 The scenario shown continues, for example... Figure 5 The PSD plugin shown in (a) has a "Merge PSDs" button. First, open TestHorizontalBox.psd in the PsdOld directory and keep it as the active document. Clicking the "Merge PSDs" button will merge TestHorizontalBox.psd in the PsdNew directory into the currently opened PSD.
[0269] If no documents are currently open, clicking "Merge PSDs" will bring up a dialog box that says, "No documents are open. Please open the old PSD file first."
[0270] If the current document is not in the PsdOld directory, a dialog box will pop up saying, "The current document is not in the PsdOld directory. Please select an older PSD file before processing."
[0271] If a PSD file with the same name does not exist in the PsdNew directory, a dialog box will pop up saying "A file with the same name does not exist in the current document in the PsdNew directory".
[0272] The merging process has a progress bar, such as... Figure 5 As shown in (b) above, it displays the message "Merging PSDs may be slow if the document is large. Please do not operate Photoshop and wait patiently!"
[0273] The merge process is as follows: If successful, a dialog box will pop up saying "Congratulations, PSD merge successful, time taken: xxx seconds"; if it fails, a corresponding error box will pop up. The Photoshop document is not automatically saved after merging; the artist decides whether to save it.
[0274] In an optional embodiment, a hierarchical structure is designed for the PSD file, such as... Figure 6 As shown, elements marked with square brackets "<>" are controls, with the control type explicitly indicated inside the brackets. Layers without any brackets represent ordinary images or ordinary text. Specifically, image layers without brackets represent ordinary images, and text layers without brackets represent ordinary text. Control types correspond to UI elements in the game engine, such as text, images, buttons, progress bars, and control panels. A PSD file can contain multiple controls, forming a tree structure. There is a root node, similar to the trunk of a tree, from which multiple control branches extend. This hierarchical structure aims to clearly show the organizational relationship between the elements in the PSD file.
[0275] In an optional embodiment, a hierarchical structure is designed for the PSD file, such as... Figure 7As shown, square brackets "[]" are used to clearly identify attributes, with the attribute name detailed inside the brackets. The area outside the brackets should be concise, without any additional strings. These attributes directly correspond to the specific properties of controls in the game engine. They are built upon the basic elements of the PSD, including image layers, text layers, and folder layers, and their identity is clearly defined by adding square brackets and attribute names. For example, under the "WidgetStyle" directory, various attributes are used to describe different states of the control. These attributes, clearly identified in the hierarchical structure, clearly reflect the appearance and behavior of the control in different states. This hierarchical structure is designed to provide a clear and readable framework for organizing and managing various elements and their attributes within the PSD file.
[0276] In an optional embodiment, a hierarchical structure is designed for the PSD file, such as... Figure 8 As shown, curly braces "{}" are used to mark external links. The specific name of the external link is filled inside the curly braces; this name can be flexibly adjusted by the artists according to actual needs. When a PSD file references other PSD files, the referenced PSD is considered an external link, and this is reflected in the hierarchical structure.
[0277] In an optional embodiment, a hierarchical structure is designed for the PSD file, such as... Figure 9 As shown, parentheses "()" are used in this embodiment to represent special fields. Currently, this solution only uses "(Size)" to explicitly identify the area of the control. By using specific fields within the parentheses, the size information of the control can be accurately reflected in the hierarchical structure, facilitating subsequent UI development and implementation.
[0278] Optionally, when processing layer merging tasks for PSD files, this embodiment can follow the following technical process:
[0279] When a PSD file has a clearly defined hierarchical structure, this embodiment can perform a PSD merging operation based on this structure. Specifically, this embodiment integrates the modifications made in the new file into the old file, thereby generating a merged PSD file. This process ensures the complete migration and updating of layer information.
[0280] When naming new controls, this example adds the prefix "-a-" before their names to clearly distinguish them and prompt artists to pay attention to these new elements.
[0281] For deleted controls, this embodiment adds the prefix "-d-" before their names, also to highlight them and simplify the editing process for artists.
[0282] If the parent hierarchy needs to be adjusted, this embodiment will directly align the control hierarchy in the old file with the new control hierarchy, and in principle, follow the hierarchical structure of the new file when making changes.
[0283] To ensure the consistency and manageability of the PSD file structure, this embodiment defines a common root node for all PSD files. All child nodes (i.e., layers or controls) are organized under this root node (e.g., "Root"), forming a clear hierarchical relationship.
[0284] To further illustrate, optionally, when control names are the same but control types change, a process for changing control types will be triggered, for example... Figure 10 As shown, first, it checks if the current control is the root node. If so, it directly changes the old type to the new type. If not, it further checks if both the old and new control types are folders. If both are folders, it adds "-d-" to the beginning of the old control's name and treats the new control as a newly added control. If neither are folders, it checks if both the old and new control types are images or text. If neither is, it adds "-d-" to the beginning of the old control's name and treats the new control as a newly added control. If both are, it updates the old control type to the new control type.
[0285] In an optional embodiment, during PSD file processing, each PSD consists of multiple nodes, and some nodes can be further combined into controls. Figure 11 This demonstrates an overview of the overall merge process, with steps specific to "changing control type" included. Figure 10 This was explained in the text.
[0286] One of the key steps in the merge process is traversing the node structure of the new file. This involves examining each node in the new file one by one and performing corresponding operations based on its attributes and status. After the traversal is complete, the system will process changes to all controls that were not marked for deletion. These changes may include updates to control types, adjustments to attributes, and modifications to the hierarchical structure.
[0287] For controls that need to be deleted, the processing flow will be shown in the "Delete Control Flowchart" ( Figure 11 The process is described in the document. It will clearly instruct how to identify, flag, and ultimately remove these controls from the PSD file to ensure the accuracy of the merged file structure.
[0288] To further illustrate, optional examples include... Figure 11 As shown, a new control is copied to replace the control in the old file. The root node of the new file is set as the current parent control. Each child node of the parent control is recursively processed, resolving the node name. The specific steps are as follows:
[0289] First, determine the node type. If it is a box-shaped node (control):
[0290] Check if a parent node with the same name exists in the old file:
[0291] If it does not exist, add the control to the old file and update the hierarchy and coordinates.
[0292] If it exists, further check if the parent node name is consistent:
[0293] If there is a discrepancy, adjust the parent node of the control with the same name in the old file and update the layer and coordinates.
[0294] If they match, check if a layer with the same name exists in the old file:
[0295] If it does not exist, perform control type replacement.
[0296] If it exists, check if there is a control with the same name (after removing the control type):
[0297] If it does not exist, add a new control.
[0298] If it exists, no action is required.
[0299] If the node type is a bracket node (attribute):
[0300] Check if a parent control with the same name exists in the old file:
[0301] If it does not exist, add the attribute and update the external link name, layer order, and coordinates.
[0302] If it exists, check if the parent control has a property with the same name:
[0303] If it exists, update the attributes.
[0304] If it does not exist, add the attribute and update the external link name, layer order, and coordinates.
[0305] If the node type is a regular node (external link):
[0306] Get the control name and external link name.
[0307] Check if a control with the same name exists in an older file:
[0308] If it exists, update the external link name, layer order, and coordinates.
[0309] If it does not exist, add a new external link.
[0310] After processing the current node, move to the next sibling node and repeat the above process. After processing the current node, move to its parent node. If the current node is not the root node, continue processing the parent nodes. If the current node is the root node, process the deleted node.
[0311] To further illustrate, the optional process for deleting a control is as follows: Figure 12 As shown, the root node of the old file is set as the current parent node. Each child node of the current parent node is processed recursively. The name of the current node is then obtained.
[0312] Determine if the current node is a control (such as a node with square brackets or no brackets):
[0313] If so, check if a layer with the same name exists in the new file:
[0314] If it does not exist, it means it is a control to be deleted. Add "-d-" before its name.
[0315] If it exists, then determine whether the current node is a folder.
[0316] If not, then similar to the previous approach of determining if the current node is a control, check if the current node is a folder:
[0317] If so, set the current node as the parent node and continue processing its child nodes.
[0318] If not, check if the current node has a sibling node:
[0319] If so, point to the next sibling node and repeat the above processing procedure.
[0320] If not, backtrack to the parent node:
[0321] After the current node has finished processing, it points to its parent node.
[0322] Check if the current node is the root node:
[0323] If it is not the root node, continue tracing back up to process the parent node.
[0324] If it is the root node, the process ends.
[0325] Optionally, the content of this embodiment can be applied to other embodiments described above, or combined with other embodiments described above.
[0326] The embodiments provided in this application design a hierarchical structure for PSD files, making them more structured and the rules relatively simple and easy to understand, thus providing a data structure foundation for the merging tool. The hierarchical structure design of the PSD aims to give its structure meaning and recognizability, ensuring the rules are concise and easy to understand, thereby laying a solid foundation for the merging tool. Although the internal execution process of the PSD merging tool is complex, users only need one step to automatically merge two PSD files, and it can identify and present incremental modifications for artists to edit, significantly improving the efficiency of art work.
[0327] It is understood that in the specific embodiments of this application, data such as user information are involved. When the above embodiments of this application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions.
[0328] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to this application.
[0329] According to another aspect of the embodiments of this application, a PSD file merging apparatus for implementing the above-described PSD file merging method is also provided. For example... Figure 13 As shown, the device includes:
[0330] The first acquisition unit 1302 is used to acquire the first PSD file and the second PSD file;
[0331] The second acquisition unit 1304 is used to acquire the hierarchical structure corresponding to the first PSD file and the hierarchical structure corresponding to the second PSD file in response to the file merging request, wherein the hierarchical structure is the standard organization form of the internal elements of the PSD file.
[0332] The merging unit 1306 is used to merge the first PSD file and the second PSD file based on the hierarchical structure corresponding to the first PSD file and the hierarchical structure corresponding to the second PSD file to obtain the merged PSD file.
[0333] For specific implementation examples, please refer to the example shown in the above PSD file merging method, which will not be repeated here.
[0334] As an optional solution, in the case where the first PSD file is a new PSD file and the second PSD file is an old PSD file, the device also includes:
[0335] The third acquisition unit is used to acquire the first internal element in the first PSD file during the process of merging the first PSD file and the second PSD file based on the hierarchical structure corresponding to the first PSD file and the hierarchical structure corresponding to the second PSD file to obtain the merged PSD file.
[0336] The first update unit is used to update the second PSD file based on the first internal element during the process of merging the first PSD file and the second PSD file based on the hierarchical structure corresponding to the first PSD file and the hierarchical structure corresponding to the second PSD file to obtain the merged PSD file.
[0337] For specific implementation examples, please refer to the example shown in the above PSD file merging method, which will not be repeated here.
[0338] As an optional approach, the first update unit includes:
[0339] The update module is used to update the third inner element using the first inner element when there is a third inner element with the same name as the first inner element in the second PSD file.
[0340] For specific implementation examples, please refer to the example shown in the above PSD file merging method, which will not be repeated here.
[0341] As an optional approach, in the second PSD file, if there is a layer with the same name as the first internal element, and the first internal element is a control type, the update module includes:
[0342] Modify the submodule to change the level and coordinates of the third inner element to be the same as those of the first inner element;
[0343] The copy submodule is used to copy the first inner element (either an image or text) over the third inner element.
[0344] For specific implementation examples, please refer to the example shown in the above PSD file merging method, which will not be repeated here.
[0345] As an optional solution, if the second PSD file lacks a layer with the same name as the first internal element, and the first internal element is a control type, update the module, including:
[0346] The first newly added submodule is used to mark the third inner element as deleted and add the first inner element to the second PSD file when both the first and third inner elements are folders, or when the first and third inner elements have different formats; or,
[0347] The first update submodule is used to update the third inner element to the first inner element when the first inner element and the third inner element are not both folders, or when the first inner element and the third inner element have the same format.
[0348] For specific implementation examples, please refer to the example shown in the above PSD file merging method, which will not be repeated here.
[0349] As an alternative, if the first inner element is an attribute type, update the module, including:
[0350] The second update submodule is used to update the second attribute using the first attribute when the third inner element has a second attribute with the same name as the first attribute of the first inner element; or,
[0351] The second newly added submodule is used to add a second attribute to the third inner element when the second attribute is missing.
[0352] For specific implementation examples, please refer to the example shown in the above PSD file merging method, which will not be repeated here.
[0353] As an alternative, if the first internal element is an external link type, update the module, including:
[0354] The third update submodule is used to update the second outer link using the first outer link when there is a second outer link with the same name as the first outer link of the first inner element in the third inner element.
[0355] The fourth update submodule is used to update the layer order and coordinates of the third internal element based on the updated second external link; or,
[0356] The third newly added submodule is used to add a second external link to the third internal element when the second external link is missing.
[0357] For specific implementation examples, please refer to the example shown in the above PSD file merging method, which will not be repeated here.
[0358] As an optional approach, the first update unit includes:
[0359] A new module is added to the second PSD file to add a first internal element if the second PSD file lacks an internal element with the same name as the first internal element.
[0360] For specific implementation examples, please refer to the example shown in the above PSD file merging method, which will not be repeated here.
[0361] As an optional solution, in the case where the first PSD file is a new PSD file and the second PSD file is an old PSD file, the device also includes:
[0362] The fourth acquisition unit is used to acquire the second internal element in the second PSD file during the process of merging the first PSD file and the second PSD file based on the hierarchical structure corresponding to the first PSD file and the hierarchical structure corresponding to the second PSD file to obtain the merged PSD file.
[0363] The second update unit is used to update the second PSD file based on the second internal element and the first PSD file during the process of merging the first PSD file and the second PSD file based on the hierarchical structure corresponding to the first PSD file and the hierarchical structure corresponding to the second PSD file to obtain the merged PSD file.
[0364] For specific implementation examples, please refer to the example shown in the above PSD file merging method, which will not be repeated here.
[0365] As an optional solution, the second update unit includes:
[0366] The delete module is used to delete the second internal element in the second PSD file if the first PSD file is missing an internal element with the same name as the second internal element.
[0367] For specific implementation examples, please refer to the example shown in the above PSD file merging method, which will not be repeated here.
[0368] As an optional solution, the module can be removed, including:
[0369] The delete submodule is used to mark the second internal element as to be deleted if the first PSD file lacks a layer with the same name as the second internal element and the second internal element is a control type.
[0370] For specific implementation examples, please refer to the example shown in the above PSD file merging method, which will not be repeated here.
[0371] As an optional solution, when the first PSD file is a new PSD file and the second PSD file is an old PSD file, the merging unit 1306 includes:
[0372] The acquisition module is used to acquire all element association information between each node in the hierarchical structure corresponding to the first PSD file and the second PSD file. Nodes are used to represent internal elements of the PSD file, and element association information is used to represent the association relationship between internal elements of the first PSD file and internal elements of the second PSD file.
[0373] The merge module is used to merge the first PSD file and the second PSD file based on element association information to obtain the merged PSD file.
[0374] For specific implementation examples, please refer to the example shown in the above PSD file merging method, which will not be repeated here.
[0375] As an optional solution, the acquisition module includes:
[0376] The execution submodule is used to perform the following steps until all element association information is obtained:
[0377] Determine the current set of nodes from the hierarchical structure corresponding to the first PSD file;
[0378] Determine the current node from the current node set;
[0379] Get the current element association information between the current node and the second PSD file;
[0380] If there are still nodes in the current node set that have not yet obtained element association information, obtain the next node from the current node set and determine the next node as the current node;
[0381] If the association information between each node in the current node set and the second PSD file has been obtained, but not all the association information has been obtained, then the next node set is obtained from the hierarchical structure corresponding to the first PSD file, and the next node set is determined as the current node set.
[0382] Given the hierarchical structure corresponding to the first PSD file, the association information of the set elements corresponding to all node sets is determined as the total element association information.
[0383] For specific implementation examples, please refer to the example shown in the above PSD file merging method, which will not be repeated here.
[0384] As an optional solution, the device may also include at least one of the following:
[0385] The first configuration unit is used to configure a first symbol for internal elements of the control type in the hierarchical structure before obtaining the hierarchical structure corresponding to the first PSD file and the hierarchical structure corresponding to the second PSD file in response to the file merging request.
[0386] The second configuration unit is used to configure a second symbol for internal elements belonging to the attribute type in the hierarchical structure before obtaining the hierarchical structure corresponding to the first PSD file and the hierarchical structure corresponding to the second PSD file in response to the file merging request.
[0387] The third configuration unit is used to configure a third symbol for internal elements of the external link type in the hierarchical structure before obtaining the hierarchical structure corresponding to the first PSD file and the hierarchical structure corresponding to the second PSD file in response to the file merging request.
[0388] The fourth configuration unit is used to configure a fourth symbol for internal elements belonging to other additional field types in the hierarchical structure before obtaining the hierarchical structure corresponding to the first PSD file and the hierarchical structure corresponding to the second PSD file in response to the file merging request.
[0389] For specific implementation examples, please refer to the example shown in the above PSD file merging method, which will not be repeated here.
[0390] According to another aspect of the embodiments of this application, an electronic device for implementing the above-described method for merging PSD files is also provided. This electronic device may, but is not limited to, […]. Figure 1 The user equipment 102 or server 112 shown in the figure, in this embodiment, is taken as an example of an electronic device, namely user equipment 102. Further, as shown in the figure... Figure 14 As shown, the electronic device includes a memory 1402 and a processor 1404. The memory 1402 stores a computer program, and the processor 1404 is configured to execute the steps of any of the above method embodiments via the computer program.
[0391] In an optional embodiment, the aforementioned electronic device may be located in at least one of a plurality of network devices in a computer network.
[0392] In an optional embodiment, the processor described above may be configured to perform the following steps via a computer program:
[0393] S10-1, Obtain the first PSD file and the second PSD file;
[0394] S10-2, In response to the file merging request, obtain the hierarchical structure corresponding to the first PSD file and the hierarchical structure corresponding to the second PSD file, wherein the hierarchical structure is the standard organization form of the internal elements of the PSD file.
[0395] S10-3, Based on the hierarchical structure corresponding to the first PSD file and the hierarchical structure corresponding to the second PSD file, merge the first PSD file and the second PSD file to obtain the merged PSD file.
[0396] Alternatively, as those skilled in the art will understand, Figure 14 The structure shown is for illustrative purposes only. Figure 14 This does not limit the structure of the aforementioned electronic devices. For example, the electronic device may also include components that are more... Figure 14The more or fewer components shown (such as network interfaces, etc.), or having the same Figure 14 The different configurations shown.
[0397] The memory 1402 can be used to store software programs and modules, such as the program instructions / modules corresponding to the PSD file merging method and apparatus in this embodiment. The processor 1404 executes various functional applications and data processing by running the software programs and modules stored in the memory 1402, thereby implementing the aforementioned PSD file merging method. The memory 1402 may include high-speed random access memory and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 1402 may further include memory remotely located relative to the processor 1404, and these remote memories can be connected to electronic devices via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof. Specifically, the memory 1402 may be used, but is not limited to, to store information such as the first PSD file, the second PSD file, and the merged PSD file. As an example, such as... Figure 14 As shown, the memory 1402 may include, but is not limited to, the first acquisition unit 1302, the second acquisition unit 1304, and the merging unit 1306 of the PSD file merging device. Furthermore, it may include, but is not limited to, other module units of the PSD file merging device, which will not be described further in this example.
[0398] Optionally, the transmission device 1406 described above is used to receive or send data via a network. Specific examples of the network described above may include wired networks and wireless networks. In one example, the transmission device 1406 includes a Network Interface Controller (NIC), which can be connected to other network devices and routers via a network cable to communicate with the Internet or a local area network. In another example, the transmission device 1406 is a Radio Frequency (RF) module, used for wireless communication with the Internet.
[0399] In addition, the aforementioned electronic device also includes: a display 1408 for displaying information such as the first PSD file, the second PSD file, and the merged PSD file; and a connection bus 1410 for connecting the various module components in the aforementioned electronic device.
[0400] In other embodiments, the aforementioned user equipment or server can be a node in a distributed system, wherein the distributed system can be a blockchain system, which is a distributed system formed by connecting multiple nodes through network communication. The nodes can form a peer-to-peer network, and any form of computing device, such as a server, user equipment, or other electronic device, can become a node in the blockchain system by joining this peer-to-peer network.
[0401] According to one aspect of this application, a computer program product is provided, comprising a computer program / instructions containing program code for performing the methods shown in the flowchart. In such embodiments, the computer program can be downloaded and installed from a network via a communication component, and / or installed from a removable medium. When the computer program is executed by a central processing unit, it performs various functions provided in embodiments of this application.
[0402] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0403] It should be noted that the computer system of the electronic device is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of this application.
[0404] A computer system includes a Central Processing Unit (CPU), which performs various appropriate actions and processes based on programs stored in Read-Only Memory (ROM) or loaded from RAM. ROM also stores various programs and data required for system operation. The CPU, ROM, and RAM are interconnected via a bus. Input / output interfaces (I / O interfaces) are also connected to the bus.
[0405] The following components are connected to the input / output interface: input sections including keyboards, mice, etc.; output sections including cathode ray tubes (CRTs), liquid crystal displays (LCDs), and speakers; storage sections including hard drives; and communication sections including network interface cards such as LAN cards and modems. The communication section performs communication processing via a network such as the Internet. Drives are also connected to the input / output interface as needed. Removable media, such as disks, optical discs, magneto-optical discs, semiconductor memories, etc., are installed on the drive as needed so that computer programs read from them can be installed into the storage section as required.
[0406] Specifically, according to embodiments of this application, the processes described in the various method flowcharts can be implemented as computer software programs. For example, embodiments of this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication component, and / or installed from a removable medium. When the computer program is executed by a central processing unit, it performs various functions defined in the system of this application.
[0407] According to one aspect of this application, a computer-readable storage medium is provided, wherein a processor of a computer device reads computer instructions from the computer-readable storage medium, and executes the computer instructions to cause the computer device to perform the methods provided in the various alternative implementations described above.
[0408] In an optional embodiment, the computer-readable storage medium described above may be configured to store a computer program for performing the following steps:
[0409] S11-1, Obtain the first PSD file and the second PSD file;
[0410] S11-2, In response to the file merging request, obtain the hierarchical structure corresponding to the first PSD file and the hierarchical structure corresponding to the second PSD file, wherein the hierarchical structure is the standard organization form of the internal elements of the PSD file.
[0411] S11-3, Based on the hierarchical structure corresponding to the first PSD file and the hierarchical structure corresponding to the second PSD file, merge the first PSD file and the second PSD file to obtain the merged PSD file.
[0412] Optionally, in embodiments of this application, the terms "module" or "unit" refer to a computer program or part of a computer program that has a predetermined function and works with other related parts to achieve a predetermined goal, and can be implemented wholly or partially using software, hardware (such as processing circuitry or memory), or a combination thereof. Similarly, a processor (or multiple processors or memory) can be used to implement one or more modules or units. Furthermore, each module or unit can be part of an overall module or unit that includes the functionality of that module or unit.
[0413] In optional embodiments, those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be implemented by a program instructing related hardware of an electronic device. The program can be stored in a computer-readable storage medium, which may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, etc.
[0414] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0415] If the integrated units in the above embodiments are implemented as software functional units and sold or used as independent products, they can be stored in the aforementioned computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause one or more computer devices (which may be personal computers, servers, or network devices, etc.) to execute all or part of the steps of the methods of the various embodiments of this application.
[0416] In the above embodiments of this application, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0417] In the several embodiments provided in this application, it should be understood that the disclosed user equipment can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection of units or modules may be electrical or other forms.
[0418] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0419] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0420] The above description is only a preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.
Claims
1. A method for merging PSD files, characterized in that, include: Obtain the first PSD file and the second PSD file; In response to a file merging request, the hierarchical structure corresponding to the first PSD file and the hierarchical structure corresponding to the second PSD file are obtained, wherein the hierarchical structure is a standard organization form of elements within the PSD file; Based on the hierarchical structure corresponding to the first PSD file and the hierarchical structure corresponding to the second PSD file, the first PSD file and the second PSD file are merged to obtain a merged PSD file.
2. The method according to claim 1, characterized in that, When the first PSD file is a new PSD file and the second PSD file is an old PSD file, in the process of merging the first PSD file and the second PSD file based on the hierarchical structure corresponding to the first PSD file and the hierarchical structure corresponding to the second PSD file to obtain a merged PSD file, the method further includes: Get the first internal element in the first PSD file; Update the second PSD file based on the first internal element.
3. The method according to claim 2, characterized in that, The step of updating the second PSD file based on the first internal element includes: In the second PSD file, if there is a third inner element with the same name as the first inner element, the third inner element is updated using the first inner element.
4. The method according to claim 3, characterized in that, In the second PSD file, if there is a layer with the same name as the first internal element, and the first internal element is a control type, then updating the third internal element using the first internal element includes: Modify the level and coordinates of the third internal element to be the same as those of the first internal element; If the first inner element is an image or text, copy the first inner element to overwrite the third inner element.
5. The method according to claim 3, characterized in that, In the second PSD file, if a layer with the same name as the first internal element is missing, and the first internal element is a control type, updating the third internal element using the first internal element includes: If both the first internal element and the third internal element are folders, or if the first internal element and the third internal element have different formats, mark the third internal element as deleted and add the first internal element to the second PSD file; or, If neither the first internal element nor the third internal element is a folder, or if the first internal element and the third internal element have the same format, the third internal element is updated to the first internal element.
6. The method according to claim 3, characterized in that, When the first inner element is an attribute type, updating the third inner element using the first inner element includes: If the third inner element has a second attribute with the same name as the first attribute of the first inner element, the first attribute is used to update the second attribute; or, if the third inner element lacks the second attribute, the second attribute is added to the third inner element.
7. The method according to claim 3, characterized in that, When the first internal element is an external link type, updating the third internal element using the first internal element includes: If the third inner element has a second outer link with the same name as the first outer link of the first inner element, the second outer link is updated using the first outer link. Based on the updated second external link, update the layer order and coordinates of the third internal element; or, If the second external link is missing in the third internal element, a second external link is added to the third internal element.
8. The method according to claim 2, characterized in that, The step of updating the second PSD file based on the first internal element includes: If the second PSD file lacks an internal element with the same name as the first internal element, the first internal element is added to the second PSD file.
9. The method according to claim 1, characterized in that, When the first PSD file is a new PSD file and the second PSD file is an old PSD file, in the process of merging the first PSD file and the second PSD file based on the hierarchical structure corresponding to the first PSD file and the hierarchical structure corresponding to the second PSD file to obtain a merged PSD file, the method further includes: Get the second internal element in the second PSD file; Update the second PSD file based on the second internal element and the first PSD file.
10. The method according to claim 9, characterized in that, The step of updating the second PSD file based on the second internal element and the first PSD file includes: If the first PSD file lacks an internal element with the same name as the second internal element, delete the second internal element from the second PSD file.
11. The method according to claim 10, characterized in that, The step of deleting the second internal element from the second PSD file includes: If a layer with the same name as the second internal element is missing in the first PSD file, and the second internal element is a control type, then the second internal element will be marked for deletion.
12. The method according to claim 1, characterized in that, When the first PSD file is a new PSD file and the second PSD file is an old PSD file, the step of merging the first PSD file and the second PSD file based on the hierarchical structure corresponding to the first PSD file and the hierarchical structure corresponding to the second PSD file to obtain a merged PSD file includes: Obtain all element association information between each node in the hierarchical structure corresponding to the first PSD file and the second PSD file, wherein the node is used to represent an internal element of the PSD file, and the element association information is used to represent the association relationship between the internal elements of the first PSD file and the internal elements of the second PSD file; Based on the element association information, the first PSD file and the second PSD file are merged to obtain the merged PSD file.
13. The method according to claim 12, characterized in that, The step of obtaining all element association information between each node in the hierarchical structure corresponding to the first PSD file and the second PSD file includes: Perform the following steps until all element association information is obtained: Determine the current node set from the hierarchical structure corresponding to the first PSD file; The current node is determined from the set of current nodes; Obtain the current element association information between the current node and the second PSD file; If there are still nodes in the current node set that have not obtained element association information, obtain the next node from the current node set and determine the next node as the current node; If the association information between each node in the current node set and the second PSD file has been obtained, but not all the association information has been obtained, the next node set is obtained from the hierarchical structure corresponding to the first PSD file, and the next node set is determined as the current node set. Given that the association information of the set elements corresponding to all node sets in the hierarchical structure corresponding to the first PSD file has been obtained, the association information of the set elements corresponding to all node sets is determined as the total element association information.
14. The method according to any one of claims 1 to 13, characterized in that, Before obtaining the hierarchical structure corresponding to the first PSD file and the hierarchical structure corresponding to the second PSD file in response to the file merging request, the method further includes at least one of the following: Configure a first symbol for the internal elements belonging to the control type in the hierarchical structure; Configure a second symbol for the internal elements belonging to the attribute type in the hierarchical structure; Configure a third symbol for the internal elements belonging to the external link type in the hierarchical structure; Configure a fourth symbol for internal elements belonging to other additional field types in the hierarchical structure.
15. A device for merging PSD files, characterized in that, include: The first acquisition unit is used to acquire the first PSD file and the second PSD file; The second acquisition unit is used to acquire the hierarchical structure corresponding to the first PSD file and the hierarchical structure corresponding to the second PSD file in response to the file merging request, wherein the hierarchical structure is the standard organization form of the internal elements of the PSD file; The merging unit is used to merge the first PSD file and the second PSD file based on the hierarchical structure corresponding to the first PSD file and the hierarchical structure corresponding to the second PSD file to obtain a merged PSD file.
16. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored program, wherein the program is executed by an electronic device to perform the method according to any one of claims 1 to 14.
17. A computer program product comprising a computer program / instructions, characterized in that, When the computer program / instructions are executed by the processor, they implement the steps of the method described in any one of claims 1 to 14.
18. An electronic device comprising a memory and a processor, characterized in that, The memory stores a computer program, and the processor is configured to execute the method described in any one of claims 1 to 14 through the computer program.