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

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

Info

Publication number
CN111127306B
CN111127306B CN201911214026.5A CN201911214026A CN111127306B CN 111127306 B CN111127306 B CN 111127306B CN 201911214026 A CN201911214026 A CN 201911214026A CN 111127306 B CN111127306 B CN 111127306B
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.)
Active
Application number
CN201911214026.5A
Other languages
Chinese (zh)
Other versions
CN111127306A (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

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/04Context-preserving transformations, e.g. by using an importance map
    • 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 the transparency of pictures in a PPTX file, decompressing the designated file content in a PPTX compressed format file, and reading an XML file in the file content; traversing the XML file, and determining a picture subjected to transparency effect setting; acquiring transparency data before and after the picture setting and picture resources according to the picture which is set by the transparency effect; and carrying out transparency restoration on the picture resources by using an image processing algorithm corresponding to the transparency data, and carrying out depth analysis on the transparency data of the picture in the PPTX file so that the picture resources are not processed by using the preset effect of PowerPoint, and realizing restoration identical to the transparency setting effect of PowerPoint by using the image processing algorithm.

Description

Method and terminal for restoring transparency of picture in PPTX file
Technical Field
The invention relates to the field of image processing, in particular to a method and a terminal for restoring the transparency of pictures in a PPTX file.
Background
In order to restore the transparency effect setting of the picture in the PPTX file, the PPTX file is usually read first, a POI function library is added in a JAVA program in the reading process, the PPTX file is loaded in the JAVA program, picture data in the PPTX file is obtained, the picture data are circularly read, a picture output format is set, the picture output format is exported to a designated folder, the exported picture is added into the PowerPoint, the transparency effect preset by the PowerPoint is utilized to restore the picture correspondingly, however, the method is dependent on the PowerPoint in the transparency effect restoration of the picture, when the transparency of the picture in the PPT needs to be restored and an application scene of the PowerPoint program cannot be used, the method can only be used for simply outputting the picture in the PPTX file, and POI provides functions of inserting and editing the picture to the PPTX file, but cannot be applied due to the fact that the specific value of the transparency effect setting required by the picture cannot be analyzed.
Disclosure of Invention
The technical problems to be solved by the invention are as follows: the method and the terminal for restoring the transparency of the picture in the PPTX file can effectively analyze the transparency set by the picture in the PPTX file and restore the transparency of the picture.
In order to solve the technical problems, the invention adopts the following technical scheme:
a method for restoring the transparency of pictures in a PPTX file comprises the following steps:
s1, decompressing file content appointed in a PPTX compressed format file, and reading an XML file in the file content;
s2, traversing the XML file, and determining a picture with transparency effect setting;
s3, acquiring transparency data before and after the picture setting and picture resources according to the picture which is set by the transparency effect;
s4, performing transparency restoration on the picture resources by using an image processing algorithm corresponding to the transparency data.
In order to solve the technical problems, the invention adopts another technical scheme that:
a terminal for restoring picture transparency in a PPTX file, comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the following steps when executing the computer program:
s1, decompressing file content appointed in a PPTX compressed format file, and reading an XML file in the file content;
s2, traversing the XML file, and determining a picture with transparency effect setting;
s3, acquiring transparency data before and after the picture setting and picture resources according to the picture which is set by the transparency effect;
s4, performing transparency restoration on the picture resources by using an image processing algorithm corresponding to the transparency data.
The invention has the beneficial effects that: and traversing the XML file decompressed by the PPTX, determining a picture with transparency effect setting, acquiring transparency data and picture resources before and after the picture setting, and restoring the picture resources with the transparency effect same as that set by the PowerPoint by using an image processing algorithm corresponding to the transparency data. And for the decompressed PPTX file, the decompressed XML file is read to realize the direct access to the characteristics of each element in the PPT, the XML file is traversed, the transparency effect-set picture is determined, the transparency data before and after the picture is set are obtained through deep analysis, the picture resource is obtained, the picture resource is processed by using a picture processing algorithm according to the transparency data obtained through analysis, and the picture resource can be restored in the same manner as the transparency effect set by the PowerPoint by effectively obtaining the transparency data of the picture under the condition of not using the transparency processing effect preset by the PowerPoint.
Drawings
Fig. 1 is a flowchart 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 the reference numerals:
1. a terminal for restoring the transparency of pictures in a PPTX file; 2. a memory; 3. a processor.
Detailed Description
In order to describe the technical contents, the achieved objects and effects of the present invention in detail, the following description will be made with reference to the embodiments in conjunction with the accompanying drawings.
Referring to fig. 1, a method for restoring transparency of a picture in a PPTX file includes the steps of:
s1, decompressing file content appointed in a PPTX compressed format file, and reading an XML file in the file content;
s2, traversing the XML file, and determining a picture with transparency effect setting;
s3, acquiring transparency data before and after the picture setting and picture resources according to the picture which is set by the transparency effect;
s4, performing transparency restoration on the picture resources by using an image processing algorithm corresponding to the transparency data.
From the above description, the beneficial effects of the invention are as follows: and traversing the XML file decompressed by the PPTX, determining a picture with transparency effect setting, acquiring transparency data and picture resources before and after the picture setting, and restoring the picture resources with the transparency effect same as that set by the PowerPoint by using an image processing algorithm corresponding to the transparency data. And for the decompressed PPTX file, the decompressed XML file is read to realize the direct access to the characteristics of each element in the PPT, the XML file is traversed, the transparency effect-set picture is determined, the transparency data before and after the picture is set are obtained through deep analysis, the picture resource is obtained, the picture resource is processed by using a picture processing algorithm according to the transparency data obtained through analysis, and the picture resource can be restored in the same manner as the transparency effect set by the PowerPoint by effectively obtaining the transparency data of the picture under the condition of not using the transparency processing effect preset by the PowerPoint.
Further, the step S2 includes:
and 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 the step S3, and if not, not processing.
According to the above description, by judging whether the node related to transparency setting exists under the picture node, time-consuming traversing of transparency data under the picture due to the existence of the picture which is not subjected to transparency setting processing can be effectively avoided, and information retrieval efficiency is improved.
Further, the step S3 includes:
s31, traversing child nodes under the picture nodes, and acquiring a color value and a transparency value before transparency effect setting of the picture to obtain transparency data before the picture setting;
s32, obtaining a color value and a transparency value of the picture after transparency effect setting, and obtaining transparency data of the picture after the transparency effect setting;
s33, acquiring unique identifiers of pictures, and storing the unique identifiers and transparency data before and after the pictures are set in an array in a JSON data format in a one-to-one correspondence manner;
s34, traversing all unique identifiers stored in the array, and respectively executing for each unique identifier:
s341, according to the unique identification, matching the relative path of the corresponding picture resource in the page resource association file, acquiring the picture resource by utilizing the relative path, and storing the picture resource in a project catalog in a file form;
s342, establishing the corresponding relation between the picture resource and the transparency data according to the corresponding relation between the unique identification of the picture resource and the transparency data and the corresponding relation between the unique identification of the picture resource and the picture resource.
According to the above description, the transparency data before and after the transparency effect setting is obtained, the overall picture effect analysis is beneficial to more accurate effect copying of the picture resources, the transparency data before and after the picture setting and the unique identification of the picture are stored in the JSON data format, the understanding of the corresponding relation of the data is facilitated while the data transmission is facilitated, the picture resources are obtained based on the unique identification of the picture, the uniqueness of the picture resources is ensured, the one-to-one corresponding relation between the picture resources and the transparency data can be quickly established by utilizing the corresponding relation between the unique identification of the picture resources and the transparency data and the corresponding relation between the unique identification of the picture resources and the picture resources, the transparency data can be directly obtained according to the corresponding relation when the picture resources are processed, and the picture restoration efficiency is improved.
Further, the step S4 includes:
traversing all picture resources stored in the project catalog, and respectively executing the following steps for each picture resource:
and acquiring transparency data with a corresponding relation according to the data parameters of the transferred picture resources, and performing transparency restoration on the picture resources by using an image processing algorithm corresponding to the transparency data.
As can be seen from the above description, because the corresponding relationship exists between the picture resource and the transparency data, when traversing the picture resource, the transparency data corresponding to the picture resource can be directly obtained, so that the efficiency of data obtaining is improved, and the transparency of the picture resource is restored by using the image processing algorithm corresponding to the transparency data, so that the picture can be restored with the transparency effect identical to that of the PowerPoint setting by analyzing the obtained transparency data without using PowerPoint processing.
Further, in the step S4, performing transparency restoration on the picture resource using an image processing algorithm corresponding to the transparency data includes:
traversing all pixels of the picture resource, and for each pixel, respectively performing:
and acquiring 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, enabling the transparency data of the current pixel to be 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.
As can be seen from the above description, when transparency effect setting is performed on a picture, not all pixel points in a picture satisfy the transparency effect setting condition, transparency data of each pixel in a picture resource is obtained, pixels in which the transparency data accords with the transparency data before the picture resource is subjected to the transparency effect setting are processed, other pixels maintain original transparency values, and the pixels required to be subjected to transparency setting are processed in a targeted manner, 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, wherein the processor implements the following steps when executing the computer program:
s1, decompressing file content appointed in a PPTX compressed format file, and reading an XML file in the file content;
s2, traversing the XML file, and determining a picture with transparency effect setting;
s3, acquiring transparency data before and after the picture setting and picture resources according to the picture which is set by the transparency effect;
s4, performing transparency restoration on the picture resources by using an image processing algorithm corresponding to the transparency data.
From the above description, the beneficial effects of the invention are as follows: and traversing the XML file decompressed by the PPTX, determining a picture with transparency effect setting, acquiring transparency data and picture resources before and after the picture setting, and restoring the picture resources with the transparency effect same as that set by the PowerPoint by using an image processing algorithm corresponding to the transparency data. And for the decompressed PPTX file, the decompressed XML file is read to realize the direct access to the characteristics of each element in the PPT, the XML file is traversed, the transparency effect-set picture is determined, the transparency data before and after the picture is set are obtained through deep analysis, the picture resource is obtained, the picture resource is processed by using a picture processing algorithm according to the transparency data obtained through analysis, and the picture resource can be restored in the same manner as the transparency effect set by the PowerPoint by effectively obtaining the transparency data of the picture under the condition of not using the transparency processing effect preset by the PowerPoint.
Further, the step S2 includes:
and 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 the step S3, and if not, not processing.
According to the above description, by judging whether the node related to transparency setting exists under the picture node, time-consuming traversing of transparency data under the picture due to the existence of the picture which is not subjected to transparency setting processing can be effectively avoided, and information retrieval efficiency is improved.
Further, the step S3 includes:
s31, traversing child nodes under the picture nodes, and acquiring a color value and a transparency value before transparency effect setting of the picture to obtain transparency data before the picture setting;
s32, obtaining a color value and a transparency value of the picture after transparency effect setting, and obtaining transparency data of the picture after the transparency effect setting;
s33, acquiring unique identifiers of pictures, and storing the unique identifiers and transparency data before and after the pictures are set in an array in a JSON data format in a one-to-one correspondence manner;
s34, traversing all unique identifiers stored in the array, and respectively executing for each unique identifier:
s341, according to the unique identification, matching the relative path of the corresponding picture resource in the page resource association file, acquiring the picture resource by utilizing the relative path, and storing the picture resource in a project catalog in a file form;
s342, establishing the corresponding relation between the picture resource and the transparency data according to the corresponding relation between the unique identification of the picture resource and the transparency data and the corresponding relation between the unique identification of the picture resource and the picture resource.
According to the above description, the transparency data before and after the transparency effect setting is obtained, the overall picture effect analysis is beneficial to more accurate effect copying of the picture resources, the transparency data before and after the picture setting and the unique identification of the picture are stored in the JSON data format, the understanding of the corresponding relation of the data is facilitated while the data transmission is facilitated, the picture resources are obtained based on the unique identification of the picture, the uniqueness of the picture resources is ensured, the one-to-one corresponding relation between the picture resources and the transparency data can be quickly established by utilizing the corresponding relation between the unique identification of the picture resources and the transparency data and the corresponding relation between the unique identification of the picture resources and the picture resources, the transparency data can be directly obtained according to the corresponding relation when the picture resources are processed, and the picture restoration efficiency is improved.
Further, the step S4 includes:
traversing all picture resources stored in the project catalog, and respectively executing the following steps for each picture resource:
and acquiring transparency data with a corresponding relation according to the data parameters of the transferred picture resources, and performing transparency restoration on the picture resources by using an image processing algorithm corresponding to the transparency data.
As can be seen from the above description, because the corresponding relationship exists between the picture resource and the transparency data, when traversing the picture resource, the transparency data corresponding to the picture resource can be directly obtained, so that the efficiency of data obtaining is improved, and the transparency of the picture resource is restored by using the image processing algorithm corresponding to the transparency data, so that the picture can be restored with the transparency effect identical to that of the PowerPoint setting by analyzing the obtained transparency data without using PowerPoint processing.
Further, in the step S4, performing transparency restoration on the picture resource using an image processing algorithm corresponding to the transparency data includes:
traversing all pixels of the picture resource, and for each pixel, respectively performing:
and acquiring 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, enabling the transparency data of the current pixel to be 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.
As can be seen from the above description, when transparency effect setting is performed on a picture, not all pixel points in a picture satisfy the transparency effect setting condition, transparency data of each pixel in a picture resource is obtained, pixels in which the transparency data accords with the transparency data before the picture resource is subjected to the transparency effect setting are processed, other pixels maintain original transparency values, and the pixels required to be subjected to transparency setting are processed in a targeted manner, so that the effect of the picture resource is restored more accurately.
Example 1
Referring to fig. 1, a method for restoring transparency of a picture in a PPTX file specifically includes the steps of:
s1, decompressing file content appointed in a PPTX compressed format file, and reading an XML file in the file content;
specifically, decompressing the specified file content in the PPTX compressed format file by utilizing the zlib function library, and reading the XML file in the specified file content by utilizing the RAPIDxml parsing library;
s2, traversing the XML file, and determining a picture with transparency effect setting;
specifically, the step S2 includes:
and 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 the step S3, and if not, not processing.
Specifically, traversing all page numbers in a slide directory under a PPT directory in a PPTX file decompression directory, wherein slide#. Xml is specific content of the PPT page number, slide#. Xml is a page resource associated file of the PPT page number, traversing a picture node p: pic under the slide#. Xml file, judging whether a child node a: blip under the p: blipFill exists in the picture node a: clrChange node, and if so, indicating that a picture corresponding to the picture node is set through transparency effect.
S3, acquiring transparency data before and after the picture setting and picture resources according to the picture which is set by the transparency effect;
specifically, the step S3 includes:
s31, traversing child nodes under the picture nodes, and acquiring a color value and a transparency value before transparency effect setting of the picture to obtain transparency data before the picture setting;
specifically, traversing child node a under the picture node, namely clrChange, acquiring the val attribute in the a-srgbClr node under the node a-clrFrom node, wherein the val attribute represents a color value of the picture needing transparency effect setting, extracting the val attribute in the a-alpha node under the a-srgbClr node, wherein the val attribute represents an original transparency value of the picture needing transparency effect setting, dividing the value by 100000 multiplied by 255, converting the value into transparency values in a [0,255], forming transparency data argb value of the picture, which is formed by the analyzed color value and the transparency values, and representing the transparency value by clrFromR, clrFromG, clrFromB, clrFromA variable, wherein clrFromR, clrFromG, clrFromB represents 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, and obtaining transparency data of the picture after the transparency effect setting;
specifically, a value attribute in an a-clrTo node under an a-clrChange node is obtained and represents that a picture needs to be converted into the color value after transparency effect setting, then a value attribute in an a-alpha node under the a-srgBClr node is obtained and represents that the picture needs to be divided by 100000 multiplied by 255 and converted into a transparency value in a [0,255] range, the color value obtained by analysis and the transparency value form a transparency data argb value of the picture after transparency effect setting, and the transparency data argb value is represented by clrToR, clrToG, clrToB, clrToA variables, wherein clrToR, clrToG, clrToB represents the color value and clrToA represents the transparency value;
s33, acquiring unique identifiers of pictures, and storing the unique identifiers and transparency data before and after the pictures are set in an array in a JSON data format in a one-to-one correspondence manner;
specifically, an attribute r: emud value under a blip node is obtained, the r: emud value is a unique identifier of a picture, and the unique identifier of the picture and transparency data before and after the picture is set by a transparency effect are stored in an array in a JSON data format;
s34, traversing all unique identifiers stored in the array, and respectively executing for each unique identifier:
s341, according to the unique identification, matching the relative path of the corresponding picture resource in the page resource association file, acquiring the picture resource by utilizing the relative path, and storing the picture resource in a project catalog in a file form;
specifically, traversing all r: emud values stored in an array, acquiring Target attributes representing relative paths of picture resources under a Relationship node corresponding to the r: emud values in page resource associated files slide#. Xml. Rels corresponding to page numbers by using the r: emud values, acquiring the picture resources according to the relative paths, and storing the acquired picture resources in a project catalog 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 identification of the picture resource and the transparency data and the corresponding relation between the unique identification of the picture resource and the picture resource;
s4, performing transparency restoration on the picture resources by using an image processing algorithm corresponding to the transparency data.
Specifically, the step S4 includes:
traversing all picture resources stored in the project catalog, and respectively executing the following steps for each picture resource:
and acquiring transparency data with a corresponding relation according to the data parameters of the transferred picture resources, and performing transparency restoration on 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 performing:
and acquiring 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, enabling the transparency data of the current pixel to be 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.
Specifically, traversing all pixels of the picture resource, obtaining transparency data argb value of each pixel of the picture by reading a picture stream, specifically representing by R, G, B, A, wherein R, G, B represents color value of the pixel, a represents transparency value of the pixel, judging whether the result of r= clrfromR = clrfromG = clrFromB = & A = clrFromA is true, if the result of judging is true, letting r=clrToR, g=clrToG, b=clrToB, a=clrToA,
after the above solution yields R, G, B, A, it is necessary to have its limit in the range of [0,255 ].
Example two
Referring to fig. 2, a terminal for restoring transparency of pictures in PPTX files, 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, wherein the processor 3 implements the steps in the first embodiment when executing the computer program.
In summary, according to the method and terminal for restoring the transparency of the picture in the PPTX file provided by the invention, the PPTX file is decompressed and read through the zlib, RAPIDxml tool, so that the picture resources are conveniently acquired based on the unique identifiers of the pictures, the corresponding relation between the unique identifiers of the picture resources and the transparency data and the corresponding relation between the unique identifiers of the picture resources and the picture resources are utilized, the corresponding relation between the picture resources and the transparency data is quickly established, the depth analysis of the picture nodes after the picture nodes conforming to the conditions are determined, the attribute characteristics of the corresponding picture are analyzed, the efficiency of effective information retrieval is improved, the transparency data of the picture before and after the transparency effect is set and the unique identifiers of the picture are acquired, the picture is stored in an array in a JSON data format, the data is convenient to transmit, the data structure is simpler, the picture resources are acquired based on the unique identifiers of the picture, the accuracy of the results is ensured, the corresponding relation between the picture resources and the transparency data is quickly established, the corresponding relation between the picture resources and the transparency data is directly acquired according to the corresponding relation when the picture resources are processed, the transparency data corresponding to the transparency of the picture resources is restored in the process of the picture, and the transparency of the point is not conforming to the transparency data in the process.
The foregoing description is only illustrative of the present invention and is not intended to limit the scope of the invention, and all equivalent changes made by the specification and drawings of the present invention, or direct or indirect application in the relevant art, are included in the scope of the present invention.

Claims (2)

1. The method for restoring the transparency of the picture in the PPTX file is characterized by comprising the following steps:
s1, decompressing file contents specified in a PPTX file, and reading an XML file in the file contents;
s2, traversing the XML file, and determining a picture with transparency effect setting:
acquiring all PPT page numbers in the XML file, traversing picture nodes in the PPT page numbers, judging whether nodes related to transparency effect setting exist under the picture nodes, if so, executing step S3, and if not, not processing;
s3, acquiring transparency data before and after the transparency effect is set according to the picture set by the transparency effect and picture resources:
s31, traversing child nodes under the picture nodes, and acquiring a color value and a transparency value before transparency effect setting of the picture to obtain transparency data before the transparency effect setting of the picture;
s32, obtaining a color value and a transparency value of the picture after transparency effect setting, and obtaining transparency data of the picture after transparency effect setting;
s33, acquiring a unique identifier of a picture, and storing the unique identifier and transparency data before and after the transparency effect is set by the picture in an array in a JSON data format in a one-to-one correspondence manner;
s34, traversing all unique identifiers stored in the array, and respectively executing for each unique identifier:
s341, according to the unique identification, matching the relative path of the corresponding picture resource in the page resource association file, acquiring the picture resource by utilizing the relative path, and storing the picture resource in a project catalog 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 identification of the picture resource and the transparency data and the corresponding relation between the unique identification of the picture resource and the picture resource;
s4, performing transparency restoration on the picture resources by using an image processing algorithm corresponding to the transparency data;
the step S4 includes:
traversing all picture resources stored in the project catalog, and respectively executing the following steps for each picture resource:
acquiring transparency data with a corresponding relation according to the data parameters of the transferred picture resources, and performing transparency restoration on the picture resources by using an image processing algorithm corresponding to the transparency data;
the performing transparency restoration on the picture resource by using an image processing algorithm corresponding to the transparency data comprises:
traversing all pixels of the picture resource, and for each pixel, respectively performing:
and acquiring 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, enabling the transparency data of the current pixel to be 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.
2. A terminal for restoring picture transparency in a PPTX file, comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the following steps when executing the computer program:
s1, decompressing file contents specified in a PPTX file, and reading an XML file in the file contents;
s2, traversing the XML file, and determining a picture with transparency effect setting:
acquiring all PPT page numbers in the XML file, traversing picture nodes in the PPT page numbers, judging whether nodes related to transparency effect setting exist under the picture nodes, if so, executing step S3, and if not, not processing;
s3, acquiring transparency data before and after the transparency effect is set according to the picture set by the transparency effect and picture resources:
s31, traversing child nodes under the picture nodes, and acquiring a color value and a transparency value before transparency effect setting of the picture to obtain transparency data before transparency effect setting of the picture;
s32, obtaining a color value and a transparency value of the picture after transparency effect setting, and obtaining transparency data of the picture after transparency effect setting;
s33, acquiring a unique identifier of a picture, and storing the unique identifier and transparency data before and after the transparency effect is set by the picture in an array in a JSON data format in a one-to-one correspondence manner;
s34, traversing all unique identifiers stored in the array, and respectively executing for each unique identifier:
s341, according to the unique identification, matching the relative path of the corresponding picture resource in the page resource association file, acquiring the picture resource by utilizing the relative path, and storing the picture resource in a project catalog 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 identification of the picture resource and the transparency data and the corresponding relation between the unique identification of the picture resource and the picture resource;
s4, performing transparency restoration on the picture resources by using an image processing algorithm corresponding to the transparency data;
the step S4 includes:
traversing all picture resources stored in the project catalog, and respectively executing the following steps for each picture resource:
acquiring transparency data with a corresponding relation according to the data parameters of the transferred picture resources, and performing transparency restoration on the picture resources by using an image processing algorithm corresponding to the transparency data;
the performing transparency restoration on the picture resource by using an image processing algorithm corresponding to the transparency data comprises:
traversing all pixels of the picture resource, and for each pixel, respectively performing:
and acquiring 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, enabling the transparency data of the current pixel to be 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.
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 CN111127306A (en) 2020-05-08
CN111127306B true 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)

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101963956B (en) * 2010-09-19 2013-09-25 深圳万兴信息科技股份有限公司 Method and device for converting XML document into PPTX document
CN103559690B (en) * 2013-11-05 2017-02-01 北京京东尚科信息技术有限公司 Method for achieving smoothness of image edges
US10190791B2 (en) * 2016-04-27 2019-01-29 Crestron Electronics, Inc. Three-dimensional building management system visualization
CN109348226B (en) * 2017-04-08 2022-11-11 腾讯科技(深圳)有限公司 Picture file processing 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
CN111127306A (en) 2020-05-08

Similar Documents

Publication Publication Date Title
US8112388B2 (en) Dependency processing of computer files
US9594477B1 (en) Using deep links to restore interactive state of a web page
US20140173559A1 (en) Identifying differences between source codes of different versions of a software when each source code is organized using incorporated files
CN108563952B (en) File virus detection method and device and storage medium
CN111090417A (en) Binary file analysis method, device, equipment and medium
TWI646834B (en) Creating hash values indicative of differences in images
CN107402878B (en) Test method and device
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
CN108153896B (en) Processing method and device for input data and output data
CN107169057B (en) Method and device for detecting repeated pictures
CN112883088B (en) Data processing method, device, equipment and storage medium
CN112699183A (en) Data processing method, system, readable storage medium and computer equipment
CN107767434B (en) Method for acquiring texture mapping configuration information in virtual reality technology and storage medium
CN113204683B (en) Information reconstruction method and device, storage medium and electronic equipment
CN110019357B (en) Database query script generation method and device
CN112579357B (en) Snapshot difference obtaining method, device, equipment and storage medium
US20150347402A1 (en) System and method for enabling a client system to generate file system operations on a file system data set using a virtual namespace
CN115002243A (en) Data processing method and device
CN111080745B (en) Method and terminal for re-coloring pictures in PowerPoint
CN111158564B (en) Method and terminal for restoring picture clipping effect in PowerPoint
CN111192336A (en) Method and terminal for restoring linear gradual change of background title shadows in PPTX
CN111145104A (en) Method and terminal for restoring picture brightness and contrast
CN113628292B (en) Method and device for previewing pictures in target terminal
CN111178013B (en) Method and terminal for restoring custom coloring effect of picture in PPT

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