CN111127306A - Method and terminal for restoring picture transparency in PPTX file - Google Patents

Method and terminal for restoring picture transparency in PPTX file Download PDF

Info

Publication number
CN111127306A
CN111127306A CN201911214026.5A CN201911214026A CN111127306A CN 111127306 A CN111127306 A CN 111127306A CN 201911214026 A CN201911214026 A CN 201911214026A CN 111127306 A CN111127306 A CN 111127306A
Authority
CN
China
Prior art keywords
picture
transparency
data
resource
file
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201911214026.5A
Other languages
Chinese (zh)
Other versions
CN111127306B (en
Inventor
刘德建
林严
郭玉湖
陈宏�
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Fujian Tianquan Educational Technology Ltd
Original Assignee
Fujian Tianquan Educational Technology Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Fujian Tianquan Educational Technology Ltd filed Critical Fujian Tianquan Educational Technology Ltd
Priority to CN201911214026.5A priority Critical patent/CN111127306B/en
Publication of CN111127306A publication Critical patent/CN111127306A/en
Application granted granted Critical
Publication of CN111127306B publication Critical patent/CN111127306B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • G06T3/04
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/001Texturing; Colouring; Generation of texture or colour
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2210/00Indexing scheme for image generation or computer graphics
    • G06T2210/62Semi-transparency
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)

Abstract

The invention discloses a method and a terminal for restoring picture transparency in a PPTX file, which decompress specified file contents in a PPTX compression format file and read an XML file in the file contents; traversing the XML file, and determining a picture set by a transparency effect; acquiring transparency data and picture resources before and after the setting of the picture according to the picture subjected to the transparency effect setting; and performing transparency restoration on the picture resource by using an image processing algorithm corresponding to the transparency data, and enabling the picture resource not to be processed by utilizing the effect preset by the PowerPoint through deep analysis of the picture transparency data in the PPTX file, and realizing restoration with the same transparency effect as the transparency effect set by the PowerPoint by means of the image processing algorithm.

Description

Method and terminal for restoring picture transparency in PPTX file
Technical Field
The invention relates to the field of image processing, in particular to a method and a terminal for restoring picture transparency in a PPTX file.
Background
In order to restore the picture transparency effect setting in the PPTX file, the PPTX file is usually read, the reading process is usually performed by adding a POI function library in a JAVA program, loading a PPTX file in a JAVA program, acquiring picture data in the PPTX file, circularly reading the picture data, setting a picture output format, exporting the picture to a designated folder, adding the exported picture to PowerPoint, and performing corresponding transparency restoration on the picture by using a transparency effect preset by the PowerPoint, wherein the effect restoration of the picture transparency by the method depends on the PowerPoint, when the application scene which needs to restore the transparency of the picture in the PPT and cannot be aided by the PowerPoint program is required, the method can only simply realize the output of the picture in the PPTX file, although the POI provides the functions of inserting the PPTX file, editing the picture and the like, but it cannot be applied because it cannot resolve the specific value of the transparency effect setting to be performed by the picture.
Disclosure of Invention
The technical problem to be solved by the invention is as follows: the method and the terminal for restoring the picture transparency in the PPTX file are provided, the transparency set by the picture in the PPTX file can be effectively analyzed, and the picture transparency can be restored.
In order to solve the technical problems, the invention adopts the technical scheme that:
a method for restoring picture transparency in a PPTX file comprises the following steps:
s1, decompressing the file content appointed in the PPTX compression format file, and reading the XML file in the file content;
s2, traversing the XML file, and determining the picture set by the transparency effect;
s3, obtaining transparency data and picture resources before and after picture setting according to the picture subjected to transparency effect setting;
and S4, performing transparency restoration on the picture resource by using an image processing algorithm corresponding to the transparency data.
In order to solve the technical problem, the invention adopts another technical scheme as follows:
a terminal for restoring transparency of a picture in a PPTX file comprises a memory, a processor and a computer program which is stored on the memory and can run on the processor, wherein the processor executes the computer program to realize the following steps:
s1, decompressing the file content appointed in the PPTX compression format file, and reading the XML file in the file content;
s2, traversing the XML file, and determining the picture set by the transparency effect;
s3, obtaining transparency data and picture resources before and after picture setting according to the picture subjected to transparency effect setting;
and S4, performing transparency restoration on the picture resource by using an image processing algorithm corresponding to the transparency data.
The invention has the beneficial effects that: traversing the XML file decompressed by PPTX, determining the picture set by the transparency effect, acquiring transparency data and picture resources before and after the picture setting, and restoring the picture resources with the same transparency effect as the transparency effect set by PowerPoint by using an image processing algorithm corresponding to the transparency data. For the decompressed PPTX file, direct access to the characteristics of each element in PPT is realized by reading the decompressed XML file, the XML file is traversed, the picture set with the transparency effect is determined, the picture is subjected to deep analysis to obtain transparency data before and after the picture is set, picture resources are obtained, the picture resources are processed by using a picture processing algorithm according to the transparency data obtained by analysis, and the picture resources can be restored by effectively obtaining the transparency data of the picture and using an algorithm processing mode to carry out the same restoration as the transparency effect set by PowerPoint under the condition that the picture resources do not depend on the transparency processing effect preset by PowerPoint.
Drawings
Fig. 1 is a flowchart illustrating steps of a method for restoring transparency of a picture in a PPTX file according to an embodiment of the present invention;
fig. 2 is a schematic structural diagram of a terminal for restoring transparency of a picture in a PPTX file according to an embodiment of the present invention;
description of reference numerals:
1. a terminal for restoring picture transparency in a PPTX file; 2. a memory; 3. a processor.
Detailed Description
In order to explain technical contents, achieved objects, and effects of the present invention in detail, the following description is made with reference to the accompanying drawings in combination with the embodiments.
Referring to fig. 1, a method for restoring picture transparency in a PPTX file includes the steps of:
s1, decompressing the file content appointed in the PPTX compression format file, and reading the XML file in the file content;
s2, traversing the XML file, and determining the picture set by the transparency effect;
s3, obtaining transparency data and picture resources before and after picture setting according to the picture subjected to transparency effect setting;
and S4, performing transparency restoration on the picture resource by using an image processing algorithm corresponding to the transparency data.
As can be seen from the above description, the beneficial effects of the present invention are: traversing the XML file decompressed by PPTX, determining the picture set by the transparency effect, acquiring transparency data and picture resources before and after the picture setting, and restoring the picture resources with the same transparency effect as the transparency effect set by PowerPoint by using an image processing algorithm corresponding to the transparency data. For the decompressed PPTX file, direct access to the characteristics of each element in PPT is realized by reading the decompressed XML file, the XML file is traversed, the picture set with the transparency effect is determined, the picture is subjected to deep analysis to obtain transparency data before and after the picture is set, picture resources are obtained, the picture resources are processed by using a picture processing algorithm according to the transparency data obtained by analysis, and the picture resources can be restored by effectively obtaining the transparency data of the picture and using an algorithm processing mode to carry out the same restoration as the transparency effect set by PowerPoint under the condition that the picture resources do not depend on the transparency processing effect preset by PowerPoint.
Further, the step S2 includes:
acquiring all PPT page numbers in the XML file, traversing picture nodes in the PPT page numbers, judging whether nodes related to transparency setting exist under the picture nodes, if so, executing step S3, and if not, not processing.
According to the description, whether the nodes related to transparency setting exist under the picture nodes or not is judged, so that the situation that time is consumed to traverse the transparency data under the picture due to the fact that the picture which is not subjected to transparency setting processing exists can be effectively avoided, and the information retrieval efficiency is improved.
Further, the step S3 includes:
s31, traversing child nodes under the picture nodes, and acquiring color values and transparency values of the picture before transparency effect setting to obtain transparency data before the picture setting;
s32, obtaining a color value and a transparency value of the picture after transparency effect setting to obtain transparency data after the picture setting;
s33, acquiring a unique identifier of the picture, and storing the unique identifier and transparency data before and after the setting of the picture in an array in a JSON data format in a one-to-one correspondence manner;
s34, traversing all the unique identifiers stored in the array, and executing the following steps for each unique identifier respectively:
s341, matching the relative path of the corresponding picture resource in the page resource associated file according to the unique identifier, acquiring the picture resource by using the relative path, and storing the picture resource in a project directory in a file form;
and S342, establishing a corresponding relation between the picture resource and the transparency data according to the corresponding relation between the unique identifier of the picture resource and the transparency data and the corresponding relation between the unique identifier of the picture resource and the picture resource.
As can be seen from the above description, the transparency data before and after the transparency effect setting of the picture is obtained, the comprehensive picture effect analysis is favorable for more accurate effect copying of the picture resource, the transparency data before and after the picture setting and the unique identifier of the picture are stored in the data format of JSON, the data transmission is facilitated, the understanding of the corresponding relation of the data is also facilitated, the picture resource is obtained based on the unique identifier of the picture, the uniqueness of the picture resource is ensured, the corresponding relation between the unique identifier of the picture resource and the transparency data and the corresponding relation between the unique identifier of the picture resource and the picture resource are utilized, can quickly establish one-to-one corresponding relationship between the picture resources and the transparency data, is convenient for processing the picture resources subsequently, the transparency data can be directly obtained according to the corresponding relation, and the efficiency of picture restoration is improved.
Further, the step S4 includes:
traversing all the picture resources stored in the project directory, and respectively executing the following steps on each picture resource:
and acquiring transparency data with a corresponding relation with the transmitted data parameters of the picture resources according to the transmitted data parameters, and restoring the transparency of the picture resources by using an image processing algorithm corresponding to the transparency data.
According to the description, due to the fact that the corresponding relation exists between the picture resources and the transparency data, the transparency data corresponding to the picture resources can be directly acquired when the picture resources are traversed, the data acquisition efficiency is improved, the image processing algorithm corresponding to the transparency data is used for conducting transparency restoration on the picture resources, and the pictures can be restored with the transparency effect same as the transparency effect set by the PowerPoint through the transparency data obtained through analysis under the condition that PowerPoint is not used for processing.
Further, the transparency restoration of the picture resource by using the image processing algorithm corresponding to the transparency data in step S4 includes:
traversing all pixels of the picture resource, and for each pixel, respectively executing:
and obtaining transparency data corresponding to the current pixel, if the transparency data of the pixel is equal to the transparency data of the picture resource before the transparency effect is set, making the transparency data of the current pixel equal to the transparency data of the picture resource after the transparency effect is set, and if the transparency data of the current pixel is not equal to the transparency data of the picture resource after the transparency effect is set, not processing the picture resource.
As can be seen from the above description, when the transparency effect of the picture is set, not all the pixel points in one picture meet the condition for setting the transparency effect, the transparency data of each pixel in the picture resource is obtained, the pixels in which the transparency data meets the transparency data of the picture resource before the transparency effect is set are processed, the remaining pixels maintain the original transparency values, and the pixels in which the transparency is set are needed for targeted processing, so that the effect of the picture resource is restored more accurately.
Referring to fig. 2, a terminal for restoring transparency of a picture in a PPTX file includes a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor executes the computer program to implement the following steps:
s1, decompressing the file content appointed in the PPTX compression format file, and reading the XML file in the file content;
s2, traversing the XML file, and determining the picture set by the transparency effect;
s3, obtaining transparency data and picture resources before and after picture setting according to the picture subjected to transparency effect setting;
and S4, performing transparency restoration on the picture resource by using an image processing algorithm corresponding to the transparency data.
As can be seen from the above description, the beneficial effects of the present invention are: traversing the XML file decompressed by PPTX, determining the picture set by the transparency effect, acquiring transparency data and picture resources before and after the picture setting, and restoring the picture resources with the same transparency effect as the transparency effect set by PowerPoint by using an image processing algorithm corresponding to the transparency data. For the decompressed PPTX file, direct access to the characteristics of each element in PPT is realized by reading the decompressed XML file, the XML file is traversed, the picture set with the transparency effect is determined, the picture is subjected to deep analysis to obtain transparency data before and after the picture is set, picture resources are obtained, the picture resources are processed by using a picture processing algorithm according to the transparency data obtained by analysis, and the picture resources can be restored by effectively obtaining the transparency data of the picture and using an algorithm processing mode to carry out the same restoration as the transparency effect set by PowerPoint under the condition that the picture resources do not depend on the transparency processing effect preset by PowerPoint.
Further, the step S2 includes:
acquiring all PPT page numbers in the XML file, traversing picture nodes in the PPT page numbers, judging whether nodes related to transparency setting exist under the picture nodes, if so, executing step S3, and if not, not processing.
According to the description, whether the nodes related to transparency setting exist under the picture nodes or not is judged, so that the situation that time is consumed to traverse the transparency data under the picture due to the fact that the picture which is not subjected to transparency setting processing exists can be effectively avoided, and the information retrieval efficiency is improved.
Further, the step S3 includes:
s31, traversing child nodes under the picture nodes, and acquiring color values and transparency values of the picture before transparency effect setting to obtain transparency data before the picture setting;
s32, obtaining a color value and a transparency value of the picture after transparency effect setting to obtain transparency data after the picture setting;
s33, acquiring a unique identifier of the picture, and storing the unique identifier and transparency data before and after the setting of the picture in an array in a JSON data format in a one-to-one correspondence manner;
s34, traversing all the unique identifiers stored in the array, and executing the following steps for each unique identifier respectively:
s341, matching the relative path of the corresponding picture resource in the page resource associated file according to the unique identifier, acquiring the picture resource by using the relative path, and storing the picture resource in a project directory in a file form;
and S342, establishing a corresponding relation between the picture resource and the transparency data according to the corresponding relation between the unique identifier of the picture resource and the transparency data and the corresponding relation between the unique identifier of the picture resource and the picture resource.
As can be seen from the above description, the transparency data before and after the transparency effect setting of the picture is obtained, the comprehensive picture effect analysis is favorable for more accurate effect copying of the picture resource, the transparency data before and after the picture setting and the unique identifier of the picture are stored in the data format of JSON, the data transmission is facilitated, the understanding of the corresponding relation of the data is also facilitated, the picture resource is obtained based on the unique identifier of the picture, the uniqueness of the picture resource is ensured, the corresponding relation between the unique identifier of the picture resource and the transparency data and the corresponding relation between the unique identifier of the picture resource and the picture resource are utilized, can quickly establish one-to-one corresponding relationship between the picture resources and the transparency data, is convenient for processing the picture resources subsequently, the transparency data can be directly obtained according to the corresponding relation, and the efficiency of picture restoration is improved.
Further, the step S4 includes:
traversing all the picture resources stored in the project directory, and respectively executing the following steps on each picture resource:
and acquiring transparency data with a corresponding relation with the transmitted data parameters of the picture resources according to the transmitted data parameters, and restoring the transparency of the picture resources by using an image processing algorithm corresponding to the transparency data.
According to the description, due to the fact that the corresponding relation exists between the picture resources and the transparency data, the transparency data corresponding to the picture resources can be directly acquired when the picture resources are traversed, the data acquisition efficiency is improved, the image processing algorithm corresponding to the transparency data is used for conducting transparency restoration on the picture resources, and the pictures can be restored with the transparency effect same as the transparency effect set by the PowerPoint through the transparency data obtained through analysis under the condition that PowerPoint is not used for processing.
Further, the transparency restoration of the picture resource by using the image processing algorithm corresponding to the transparency data in step S4 includes:
traversing all pixels of the picture resource, and for each pixel, respectively executing:
and obtaining transparency data corresponding to the current pixel, if the transparency data of the pixel is equal to the transparency data of the picture resource before the transparency effect is set, making the transparency data of the current pixel equal to the transparency data of the picture resource after the transparency effect is set, and if the transparency data of the current pixel is not equal to the transparency data of the picture resource after the transparency effect is set, not processing the picture resource.
As can be seen from the above description, when the transparency effect of the picture is set, not all the pixel points in one picture meet the condition for setting the transparency effect, the transparency data of each pixel in the picture resource is obtained, the pixels in which the transparency data meets the transparency data of the picture resource before the transparency effect is set are processed, the remaining pixels maintain the original transparency values, and the pixels in which the transparency is set are needed for targeted processing, so that the effect of the picture resource is restored more accurately.
Example one
Referring to fig. 1, a method for restoring picture transparency in a PPTX file includes the following steps:
s1, decompressing the file content appointed in the PPTX compression format file, and reading the XML file in the file content;
specifically, a zlib function library is used for decompressing the content of a specified file in the PPTX compression format file, and an XML file in the content of the specified file is read through an RAPIDxml analysis library;
s2, traversing the XML file, and determining the picture set by the transparency effect;
specifically, the step S2 includes:
acquiring all PPT page numbers in the XML file, traversing picture nodes in the PPT page numbers, judging whether nodes related to transparency setting exist under the picture nodes, if so, executing step S3, and if not, not processing.
Specifically, traversing all page numbers in a slides directory under a PPT directory in a PPTX file decompression directory, wherein slide #. xml is the specific content of a PPT page number, slide #. xml.rels is a page resource associated file of the PPT page number, traversing picture nodes p: pic under the slide #. xml file, judging whether p: sub-nodes a: blip under blipFill under the node exist, namely clrChange nodes, and if so, indicating that a picture corresponding to the picture node is set through a transparency effect.
S3, obtaining transparency data and picture resources before and after picture setting according to the picture subjected to transparency effect setting;
specifically, the step S3 includes:
s31, traversing child nodes under the picture nodes, and acquiring color values and transparency values of the picture before transparency effect setting to obtain transparency data before the picture setting;
specifically, traversing clrChange, a child node a under the picture node, acquiring a val attribute in an a: srgbClr node under the clrFrom node, wherein the attribute represents a color value of the picture needing transparency effect setting, then extracting the val attribute in an a: alpha node under the a: srgbClr node, wherein the attribute represents an original transparency value of the picture needing transparency effect setting, the value needs to be divided by 100000 times 255 and converted into a transparency value in a range of [0,255], combining the color value and the transparency value obtained by analysis into a transparency data argb value before the picture is subjected to transparency effect setting, and expressing the transparency data argb value by clrFromR, clrFromG, clrFromB and clrFromA variables, wherein clrFromR, clrFromG and clrFromB represent the color value, and clrFromA represents the transparency value;
s32, obtaining a color value and a transparency value of the picture after transparency effect setting to obtain transparency data after the picture setting;
specifically, a val attribute in an a: srgbClr node under an a: clrChange node, which represents that a picture needs to be converted into a color value after being set by a transparency effect, is obtained, then a val attribute in an a: alpha node under the a: srgbClr node, which represents a transparency value after the picture is set by the transparency effect, wherein the value needs to be divided by 100000 times 255 and converted into a transparency value in a range of [0,255], the color value obtained by analysis and the transparency value form a transparency data argb value after the picture is set by the transparency effect, and the transparency data argb value is represented by clrToR, clrToG, clrToB and clrToA variables, wherein the clrToR, clrToG and clrToB represent the color value, and the clrToA represents the transparency value;
s33, acquiring a unique identifier of the picture, and storing the unique identifier and transparency data before and after the setting of the picture in an array in a JSON data format in a one-to-one correspondence manner;
specifically, acquiring an attribute r under a blip node, namely an embed value, wherein the r is an unique identifier of a picture, and storing the unique identifier of the picture and transparency data of the picture before and after the setting of the transparency effect in an array according to a JSON data format;
s34, traversing all the unique identifiers stored in the array, and executing the following steps for each unique identifier respectively:
s341, matching the relative path of the corresponding picture resource in the page resource associated file according to the unique identifier, acquiring the picture resource by using the relative path, and storing the picture resource in a project directory in a file form;
specifically, traversing all r: embed values stored in an array, acquiring a Target attribute representing a relative path of a picture resource under a Relationship node corresponding to the r: embed values in a page resource associated file slide #. xml.rels corresponding to page numbers by using the r: embed values, acquiring the picture resource according to the relative path, and storing the acquired picture resource in a project directory in a file form;
s342, establishing a corresponding relation between the picture resource and the transparency data according to the corresponding relation between the unique identifier of the picture resource and the transparency data and the corresponding relation between the unique identifier of the picture resource and the picture resource;
and S4, performing transparency restoration on the picture resource by using an image processing algorithm corresponding to the transparency data.
Specifically, the step S4 includes:
traversing all the picture resources stored in the project directory, and respectively executing the following steps on each picture resource:
and acquiring transparency data with a corresponding relation with the transmitted data parameters of the picture resources according to the transmitted data parameters, and restoring the transparency of the picture resources by using an image processing algorithm corresponding to the transparency data.
Traversing all pixels of the picture resource, and for each pixel, respectively executing:
and obtaining transparency data corresponding to the current pixel, if the transparency data of the pixel is equal to the transparency data of the picture resource before the transparency effect is set, making the transparency data of the current pixel equal to the transparency data of the picture resource after the transparency effect is set, and if the transparency data of the current pixel is not equal to the transparency data of the picture resource after the transparency effect is set, not processing the picture resource.
Specifically, all pixels of the picture resource are traversed, a transparency data argb value of each pixel of the picture is obtained by reading the picture stream, specifically represented by R, G, B, A, where R, G, B represents a color value of the pixel, a represents a transparency value of the pixel, whether a result of R ═ clrfomr & & G & & B ═ clrfomb & & a ═ clrfoma is true is determined, if the result of the determination is true, R ═ clrttor, G ═ clrttog, B ═ clrttob, a ═ clrttoa,
after the solution is R, G, B, A, its limit value is required to be in the range of [0,255 ].
Example two
Referring to fig. 2, a terminal for restoring transparency of a picture in a PPTX file, where the terminal 1 includes a memory 2, a processor 3 and a computer program stored in the memory 2 and executable on the processor 3, and the processor 3 implements the steps in the first embodiment when executing the computer program.
In summary, according to the method and the terminal for restoring the transparency of the picture in the PPTX file provided by the present invention, the PPTX file is decompressed and read by zlib and RAPIDxml tools, so that all PPT page contents under the decompressed directory can be conveniently obtained, the picture nodes in all page contents are traversed, whether the picture passes through the transparency effect setting is first judged, it is beneficial to perform depth analysis on the picture nodes after the picture nodes meeting the condition are determined, the attribute characteristics of the corresponding picture are analyzed, the efficiency of effective information retrieval is improved, the transparency data before and after the picture passes through the transparency effect setting and the unique identifier of the picture are obtained and stored in the array in the data format of JSON, so that data transmission is facilitated, the data structure is simpler, the picture resource is obtained based on the unique identifier of the picture, the accuracy of the result is ensured, and the correspondence between the unique identifier of the picture resource and the transparency data and the unique identifier of the picture resource are utilized The corresponding relation between the picture resources and the transparency data is quickly established, according to the corresponding relation, when the picture resources are subjected to algorithm processing, the transparency data corresponding to the picture resources can be directly obtained, the picture restoration efficiency is improved, and in the picture restoration process, the transparency data of pixels meeting conditions in the picture resources are subjected to assignment again in a targeted mode, so that the picture resources can be accurately restored with the same transparency effect as the transparency setting effect of the PowerPoint under the condition that the PowerPoint is not used.
The above description is only an embodiment of the present invention, and not intended to limit the scope of the present invention, and all equivalent changes made by using the contents of the present specification and the drawings, or applied directly or indirectly to the related technical fields, are included in the scope of the present invention.

Claims (10)

1. A method for restoring picture transparency in a PPTX file is characterized by comprising the following steps:
s1, decompressing the file content appointed in the PPTX compression format file, and reading the XML file in the file content;
s2, traversing the XML file, and determining the picture set by the transparency effect;
s3, obtaining transparency data and picture resources before and after picture setting according to the picture subjected to transparency effect setting;
and S4, performing transparency restoration on the picture resource by using an image processing algorithm corresponding to the transparency data.
2. The method as claimed in claim 1, wherein the step S2 includes:
acquiring all PPT page numbers in the XML file, traversing picture nodes in the PPT page numbers, judging whether nodes related to transparency setting exist under the picture nodes, if so, executing step S3, and if not, not processing.
3. The method as claimed in claim 2, wherein the step S3 includes:
s31, traversing child nodes under the picture nodes, and acquiring color values and transparency values of the picture before transparency effect setting to obtain transparency data before the picture setting;
s32, obtaining a color value and a transparency value of the picture after transparency effect setting to obtain transparency data after the picture setting;
s33, acquiring a unique identifier of the picture, and storing the unique identifier and transparency data before and after the setting of the picture in an array in a JSON data format in a one-to-one correspondence manner;
s34, traversing all the unique identifiers stored in the array, and executing the following steps for each unique identifier respectively:
s341, matching the relative path of the corresponding picture resource in the page resource associated file according to the unique identifier, acquiring the picture resource by using the relative path, and storing the picture resource in a project directory in a file form;
and S342, establishing a corresponding relation between the picture resource and the transparency data according to the corresponding relation between the unique identifier of the picture resource and the transparency data and the corresponding relation between the unique identifier of the picture resource and the picture resource.
4. The method as claimed in claim 3, wherein the step S4 includes:
traversing all the picture resources stored in the project directory, and respectively executing the following steps on each picture resource:
and acquiring transparency data with a corresponding relation with the transmitted data parameters of the picture resources according to the transmitted data parameters, and restoring the transparency of the picture resources by using an image processing algorithm corresponding to the transparency data.
5. The method as claimed in claim 4, wherein said transparency restoration of the picture resource by using the image processing algorithm corresponding to the transparency data in step S4 comprises:
traversing all pixels of the picture resource, and for each pixel, respectively executing:
and obtaining transparency data corresponding to the current pixel, if the transparency data of the pixel is equal to the transparency data of the picture resource before the transparency effect is set, making the transparency data of the current pixel equal to the transparency data of the picture resource after the transparency effect is set, and if the transparency data of the current pixel is not equal to the transparency data of the picture resource after the transparency effect is set, not processing the picture resource.
6. A terminal for restoring transparency of a picture in a PPTX file, comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to perform the following steps:
s1, decompressing the file content appointed in the PPTX compression format file, and reading the XML file in the file content;
s2, traversing the XML file, and determining the picture set by the transparency effect;
s3, obtaining transparency data and picture resources before and after picture setting according to the picture subjected to transparency effect setting;
and S4, performing transparency restoration on the picture resource by using an image processing algorithm corresponding to the transparency data.
7. The terminal for restoring the transparency of the picture in the PPTX file as claimed in claim 6, wherein said step S2 comprises:
acquiring all PPT page numbers in the XML file, traversing picture nodes in the PPT page numbers, judging whether nodes related to transparency setting exist under the picture nodes, if so, executing step S3, and if not, not processing.
8. The terminal for restoring the transparency of a picture in a PPTX file as claimed in claim 7, wherein said step S3 comprises:
s31, traversing child nodes under the picture nodes, and acquiring color values and transparency values of the picture before transparency effect setting to obtain transparency data before the picture setting;
s32, obtaining a color value and a transparency value of the picture after transparency effect setting to obtain transparency data after the picture setting;
s33, acquiring a unique identifier of the picture, and storing the unique identifier and transparency data before and after the setting of the picture in an array in a JSON data format in a one-to-one correspondence manner;
s34, traversing all the unique identifiers stored in the array, and executing the following steps for each unique identifier respectively:
s341, matching the relative path of the corresponding picture resource in the page resource associated file according to the unique identifier, acquiring the picture resource by using the relative path, and storing the picture resource in a project directory in a file form;
and S342, establishing a corresponding relation between the picture resource and the transparency data according to the corresponding relation between the unique identifier of the picture resource and the transparency data and the corresponding relation between the unique identifier of the picture resource and the picture resource.
9. The terminal for restoring the transparency of a picture in a PPTX file as claimed in claim 8, wherein said step S4 comprises:
traversing all the picture resources stored in the project directory, and respectively executing the following steps on each picture resource:
and acquiring transparency data with a corresponding relation with the transmitted data parameters of the picture resources according to the transmitted data parameters, and restoring the transparency of the picture resources by using an image processing algorithm corresponding to the transparency data.
10. The terminal for restoring transparency of a picture in a PPTX file according to claim 9, wherein the transparency restoration of the picture resource by using the image processing algorithm corresponding to the transparency data in step S4 comprises:
traversing all pixels of the picture resource, and for each pixel, respectively executing:
and obtaining transparency data corresponding to the current pixel, if the transparency data of the pixel is equal to the transparency data of the picture resource before the transparency effect is set, making the transparency data of the current pixel equal to the transparency data of the picture resource after the transparency effect is set, and if the transparency data of the current pixel is not equal to the transparency data of the picture resource after the transparency effect is set, not processing the picture resource.
CN201911214026.5A 2019-12-02 2019-12-02 Method and terminal for restoring transparency of picture in PPTX file Active CN111127306B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911214026.5A CN111127306B (en) 2019-12-02 2019-12-02 Method and terminal for restoring transparency of picture in PPTX file

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911214026.5A CN111127306B (en) 2019-12-02 2019-12-02 Method and terminal for restoring transparency of picture in PPTX file

Publications (2)

Publication Number Publication Date
CN111127306A true CN111127306A (en) 2020-05-08
CN111127306B CN111127306B (en) 2023-04-28

Family

ID=70496779

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911214026.5A Active CN111127306B (en) 2019-12-02 2019-12-02 Method and terminal for restoring transparency of picture in PPTX file

Country Status (1)

Country Link
CN (1) CN111127306B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101963956A (en) * 2010-09-19 2011-02-02 深圳市万兴软件有限公司 Method and device for converting XML document into PPTX document
CN103559690A (en) * 2013-11-05 2014-02-05 北京京东尚科信息技术有限公司 Method for achieving smoothness of image edges
CN107071514A (en) * 2017-04-08 2017-08-18 腾讯科技(深圳)有限公司 A kind of photograph document handling method and intelligent terminal
US20170315697A1 (en) * 2016-04-27 2017-11-02 Crestron Electronics, Inc. Three-dimensional building management system visualization
CN108037915A (en) * 2017-11-07 2018-05-15 福建天泉教育科技有限公司 A kind of method and terminal of acquisition json configuration files

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101963956A (en) * 2010-09-19 2011-02-02 深圳市万兴软件有限公司 Method and device for converting XML document into PPTX document
CN103559690A (en) * 2013-11-05 2014-02-05 北京京东尚科信息技术有限公司 Method for achieving smoothness of image edges
US20170315697A1 (en) * 2016-04-27 2017-11-02 Crestron Electronics, Inc. Three-dimensional building management system visualization
CN107071514A (en) * 2017-04-08 2017-08-18 腾讯科技(深圳)有限公司 A kind of photograph document handling method and intelligent terminal
CN108037915A (en) * 2017-11-07 2018-05-15 福建天泉教育科技有限公司 A kind of method and terminal of acquisition json configuration files

Also Published As

Publication number Publication date
CN111127306B (en) 2023-04-28

Similar Documents

Publication Publication Date Title
US8112388B2 (en) Dependency processing of computer files
TWI646834B (en) Creating hash values indicative of differences in images
CN113495728A (en) Dependency relationship determination method, dependency relationship determination device, electronic equipment and medium
CN111127306B (en) Method and terminal for restoring transparency of picture in PPTX file
CN107169057B (en) Method and device for detecting repeated pictures
CN111049735B (en) Group head portrait display method, device, equipment and storage medium
CN111340728B (en) Point cloud denoising method and device based on 3D point cloud segmentation and storage medium
CN110134583B (en) Software testing and data processing method and device
CN107767434B (en) Method for acquiring texture mapping configuration information in virtual reality technology and storage medium
CN111145104B (en) Method and terminal for restoring picture brightness and contrast
CN111192336A (en) Method and terminal for restoring linear gradual change of background title shadows in PPTX
CN111080745B (en) Method and terminal for re-coloring pictures in PowerPoint
CN112579357B (en) Snapshot difference obtaining method, device, equipment and storage medium
CN111158564B (en) Method and terminal for restoring picture clipping effect in PowerPoint
CN111160403B (en) API (application program interface) multiplexing discovery method and device
CN115543263A (en) Script generation method, device, equipment and medium
CN111178013B (en) Method and terminal for restoring custom coloring effect of picture in PPT
CN113765926B (en) Message reconstruction method and system
CN111259177B (en) Black-white binary signature picture storage method and system
CN114928466B (en) Automatic identification method and device for encrypted data, storage medium and computer equipment
CN109947775B (en) Data processing method and device, electronic equipment and computer readable medium
CN110875744B (en) Coding method and device
CN114254143A (en) Distributed image searching method and system based on clickhouse
Kim Renormalization Group Invariance of the Pole Mass in the Multi-Higgs System
CN114356946A (en) Data table updating method, device, equipment and readable storage medium

Legal Events

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