CN112989254B - Picture processing method and device - Google Patents

Picture processing method and device Download PDF

Info

Publication number
CN112989254B
CN112989254B CN202110395910.4A CN202110395910A CN112989254B CN 112989254 B CN112989254 B CN 112989254B CN 202110395910 A CN202110395910 A CN 202110395910A CN 112989254 B CN112989254 B CN 112989254B
Authority
CN
China
Prior art keywords
picture
pictures
target table
file
columns
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
CN202110395910.4A
Other languages
Chinese (zh)
Other versions
CN112989254A (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.)
Zhengzhou Xizhi Information Technology Co ltd
Original Assignee
Zhengzhou Xizhi Information Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhengzhou Xizhi Information Technology Co ltd filed Critical Zhengzhou Xizhi Information Technology Co ltd
Priority to CN202110395910.4A priority Critical patent/CN112989254B/en
Publication of CN112989254A publication Critical patent/CN112989254A/en
Application granted granted Critical
Publication of CN112989254B publication Critical patent/CN112989254B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/958Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/80Information retrieval; Database structures therefor; File system structures therefor of semi-structured data, e.g. markup language structured data such as SGML, XML or HTML
    • G06F16/81Indexing, e.g. XML tags; Data structures therefor; Storage structures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/80Information retrieval; Database structures therefor; File system structures therefor of semi-structured data, e.g. markup language structured data such as SGML, XML or HTML
    • G06F16/84Mapping; Conversion
    • G06F16/86Mapping to a database

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application provides a picture processing method and device, which are used for acquiring a target form file; acquiring the column numbers of all columns with pictures, and taking the annotation information corresponding to the pictures as keys of the pictures; backing up the target table file to obtain a target table backup file; decompressing to obtain folders and xml files in which pictures are stored, and determining the index position corresponding to each picture; and determining pictures with the same column number in the index positions in the target table file aiming at each picture, taking the index positions as values, and forming key value pairs with keys of the pictures to obtain the dictionary. The method comprises the steps of storing pictures and annotation information thereof in a target table file in advance, determining the pictures corresponding to the index positions in the target table file, taking the index positions as values, forming key value pairs with keys of the pictures, and forming a dictionary by the obtained key value pairs, so that the aim of reading the corresponding pictures in batches can be fulfilled by subsequently utilizing the dictionary, the pictures do not need to be manually operated, the method is simple and convenient, and the efficiency is improved.

Description

Picture processing method and device
Technical Field
The invention relates to the technical field of computers, in particular to a picture processing method and device.
Background
With the continuous development of computer technology, the forms of websites are also diversified.
In the process of establishing a website, various data are generally used, for example, a picture is one kind of data, that is, a programmer adds a picture to the website.
At present, when a single website is established, a programmer generally adds pictures in a manual operation mode, however, the manual operation mode is complicated and low in efficiency.
Disclosure of Invention
In view of this, embodiments of the present invention provide a picture processing method and device, so as to solve the problems of complexity and low efficiency in adding pictures in a manual operation manner in the prior art.
In order to achieve the above object, the embodiments of the present invention provide the following technical solutions:
in one aspect, an embodiment of the present invention provides a method for processing an image, where the method includes:
acquiring a target table file, wherein the target table file comprises a pre-stored picture and annotation information of the picture, and the annotation information is positioned in a first row of a column where the picture is positioned;
acquiring the column number of all columns with pictures in the target table file, and taking annotation information corresponding to the pictures as keys of the pictures;
backing up the target table file to obtain a target table backup file with a compressed format as a file suffix;
decompressing the target table backup file, and determining an index position corresponding to each picture based on the obtained folder and xml file in which the pictures are stored;
and determining pictures with the same column number in the target table file and the index positions according to each picture, taking the index positions as values, and forming key value pairs with keys of the pictures to obtain a dictionary.
Optionally, the obtaining the number of columns of all columns in which the picture exists in the target table file includes:
and reading all columns of the pictures in the target table file by adopting an xlrd module of python, and determining the number of the columns of each picture.
Optionally, decompressing the target table backup file, and determining an index position corresponding to each picture based on the obtained folder and xml file in which the picture is stored, includes:
decompressing the target table backup file to obtain a folder and an xml file which store the picture;
acquiring a current path of the folder according to the name of the folder;
slicing the current path of the folder to obtain a corresponding slice list;
carrying out regular expression processing on the slice list to obtain a picture path of the picture;
coding the current path of the folder to obtain a coding path;
analyzing the current path of the folder, the picture path of the picture and the coding path by using an xml function, and acquiring the number of rows and columns corresponding to each picture according to rules in the xml file;
and taking the number of the rows and the number of the columns corresponding to each picture as an index position of each picture.
Optionally, the determining, for each picture, pictures in the target table file with the same number of columns as the number of columns in the index position, taking the index position as a value, and forming a key-value pair with a key of the picture to obtain a dictionary includes:
determining pictures stored in the same column number position in the target table file based on the column number in the index position of each picture, and acquiring keys of the pictures;
splicing the keys of the pictures and the index positions serving as values in a json format to obtain key value pairs;
and composing the obtained key-value pairs into a dictionary.
Optionally, the method further includes:
and reading a corresponding key value pair in the dictionary based on the website data filling request, and filling the picture corresponding to the value into the website according to the indication of the key.
In another aspect, an embodiment of the present invention provides an image processing apparatus, where the apparatus includes:
the device comprises a first acquisition unit, a second acquisition unit and a third acquisition unit, wherein the first acquisition unit is used for acquiring a target table file, the target table file comprises a picture stored in advance and annotation information of the picture, and the annotation information is positioned in a first row of a column where the picture is positioned;
the second acquisition unit is used for acquiring the column number of all columns with pictures in the target table file and taking the annotation information corresponding to the pictures as keys of the pictures;
the backup unit is used for backing up the target table file to obtain a target table backup file with a compressed format as a file suffix;
the decompression unit is used for decompressing the target table backup file and determining the index position corresponding to each picture based on the obtained folder and the xml file which store the pictures;
and the determining unit is used for determining the pictures with the same column number in the target table file and the index positions according to each picture, taking the index positions as values, and forming key value pairs with the keys of the pictures to obtain a dictionary.
Optionally, the second obtaining unit is specifically configured to read all columns of the target table file where the picture exists by using an xlrA4 module of python, and determine the number of columns where each picture is located.
Optionally, the decompression unit includes:
the decompression module is used for decompressing the target table backup file to obtain a folder and an xml file which store the picture;
the acquisition module is used for acquiring the current path of the folder according to the name of the folder;
the slicing module is used for slicing the current path of the folder to obtain a corresponding slice list;
the processing module is used for carrying out regular expression processing on the slice list to obtain a picture path of the picture;
the coding module is used for coding the current path of the folder to obtain a coding path;
the analysis module is used for analyzing the current path of the folder, the picture path of the picture and the coding path by using an xml function and acquiring the number of rows and columns corresponding to each picture according to rules in the xml file; and the number of rows and columns corresponding to each picture is used as the index position of each picture.
Optionally, the determining unit includes:
the determining module is used for determining pictures stored in the same column number position in the target table file based on the column number in the index position of each picture and acquiring keys of the pictures;
the splicing module is used for splicing the key of the picture and the index position serving as the value in a json format to obtain a key value pair; and composing the resulting key-value pairs into a dictionary.
Optionally, the apparatus further comprises:
and the filling unit is used for reading the corresponding key value pair in the dictionary based on the website data filling request, and filling the picture corresponding to the value into the website according to the indication of the key.
Based on the image processing method and device provided by the embodiment of the invention, a target table file is obtained, wherein the target table file comprises pre-stored images and annotation information of the images, and the annotation information is located in the first row of the column where the images are located; acquiring the column number of all columns with pictures in the target table file, and taking annotation information corresponding to the pictures as keys of the pictures; backing up the target table file to obtain a target table backup file with a compressed format as a file suffix; decompressing the target table backup file, and determining an index position corresponding to each picture based on the obtained folder and xml file which store the pictures; and determining pictures with the same columns in the target table file and the same columns in the index positions for each picture, taking the index positions as values, and forming key value pairs with keys of the pictures to obtain the dictionary. In the scheme provided by the embodiment of the invention, the picture to be processed and the annotation information of the picture are stored in the target table file in advance, the picture corresponding to the index position in the target table file is determined based on the relation between the column number of the column where the picture is located in the target table file and the column number in the index position, the index position is used as a value, a key value pair is formed by the index position and a key formed by the annotation information of the picture, and the obtained key value pair is formed into the dictionary, so that the aim of reading the corresponding picture in batch can be fulfilled by subsequently utilizing the dictionary, manual operation of the picture is not needed, the operation is simple and convenient, and the efficiency is improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
Fig. 1 is a schematic flowchart of a picture processing method according to an embodiment of the present invention;
fig. 2 is a diagram illustrating a positional relationship between a picture and annotation information in a target form file according to an embodiment of the present invention;
fig. 3 is a schematic flowchart of another image processing method according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of an image processing apparatus according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of another image processing apparatus according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In this application, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrases "comprising a," "8230," "8230," or "comprising" does not exclude the presence of additional like elements in a process, method, article, or apparatus that comprises the element.
The terms "first," "second," "third," "fourth," and the like in the description and claims of this application and in the above-described drawings, if any, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It will be appreciated that the data so used may be interchanged under appropriate circumstances such that the embodiments described herein may be practiced otherwise than as specifically illustrated or described herein.
According to the background art, in the process of establishing the network station, the picture is added in a manual operation mode, so that the problems of complex operation and low efficiency exist.
Therefore, the picture to be processed and annotation information of the picture are stored in a target table file in advance, the picture corresponding to the index position in the target table file is determined based on the relation between the column number of the column where the picture is located in the target table file and the column number in the index position, the index position is used as a value, a key value pair is formed by the index position and a key formed by the annotation information of the picture, and the obtained key value pair is formed into a dictionary. The specific implementation process is illustrated by the following examples.
Referring to fig. 1, a flowchart of a picture processing method according to an embodiment of the present invention is shown.
The picture processing method comprises the following steps:
step S101: and acquiring a target table file.
In step S101, the target table file includes a pre-stored picture and annotation information of the picture, where the annotation information is located in a first row of a column where the picture is located.
It should be noted that the pre-stored pictures refer to pictures that a user needs to use in practical applications. For example, when a user creates a website, some pictures, such as a logo picture and a banner picture, need to be inserted into the website.
The annotation information of the picture refers to explanatory information edited with respect to the pre-stored picture. For example, the comment information may be a description of a type of a picture or the like. For example, the annotation information is a logo diagram, which is used for explaining that the corresponding diagram is a logo diagram.
Therefore, the target form file can be understood as a form file storing a picture required to be used by the user and annotation information corresponding to the picture.
In practical situations, a user can sort the pictures to be processed based on the usage requirements of the pictures, add the pictures of the same type to the same column in the target table file, and edit the annotation information of the pictures of the same type in the first row of the column for explaining the pictures of the column.
In order to visually understand the position relationship between each picture and each annotation information in the target form file, referring to fig. 2, a diagram illustrating the position relationship between the picture and the annotation information in the target form file according to an embodiment of the present invention is shown.
As shown in fig. 2, the first behavior is the annotation information for the picture, and the second behavior is the picture corresponding to the annotation information for the picture in the first row.
The annotation information of the first action picture, in order from left to right, is then:
the annotation information of the pictures in the first row and the first column is: company logo (width 225, height 225, picture background transparent or from the bottom);
the annotation information of the pictures in the first row and the second column is as follows: the width 460 and the height 308 of the company image picture (more than 10 pictures);
the annotation information for the pictures in the first row and the third column is: why we chose our picture (why choose us) (5 sheets) (width 399, height 278);
the annotation information of the pictures in the first row and the fourth column is as follows: contact two-dimensional code picture (width 230, height 228).
Thus, in the second row and first column is a picture corresponding to the annotation information "company logo (width 225, height 225, picture background transparent or bottom)";
in the second row and the second column, pictures corresponding to the annotation information of 'company image picture (more than 10) picture width 460 and height 308' are provided;
in the second row and third column is a picture corresponding to the annotation information "why we selected our picture (why choose us) (5 sheets) (width 399, height 278);
in the fourth column of the second row is a picture corresponding to the annotation information "contact two-dimensional code picture (width 230, height 228).
It should be noted that fig. 2 is only for illustration.
Step S102: and acquiring the column number of all columns with pictures in the target table file, and taking the annotation information corresponding to the pictures as keys of the pictures.
In the process of specifically implementing step S102, based on the target table file obtained by executing step S101, an xlrd module of python may be used to read all columns of the picture in the target table file, determine the number of columns where each picture in the target table file is located, and use the annotation information corresponding to each picture as a key of the picture.
Step S103: and backing up the target table file to obtain a target table backup file with a compressed format as a file suffix.
In the process of implementing step S103 specifically, the target table file obtained in step S101 is backed up, and the file suffix of the backed-up target table file is modified into a zip format, so as to obtain a target table backup file with a compressed format of the file suffix.
Optionally, the backed-up target table file may also be compressed into a compressed file in a zip format, so as to obtain a target table backed-up file in a compressed format followed by a file suffix.
It should be noted that, in the embodiment of the present invention, an implementation manner of obtaining a target table backup file with a compressed format as a file suffix based on a backed-up target table file is not limited, and it is sufficient that the file suffix of the finally obtained target table backup file is in a zip format.
Step S104: and decompressing the target table backup file, and determining the index position corresponding to each picture based on the obtained folder and xml file which are stored with the pictures.
In the process of implementing step S104, based on the target table backup file obtained by executing step S103, a zip file module of python may be used to decompress the target table backup file, and based on the folder and xml file in which the pictures are stored, which are obtained by decompression, the index position corresponding to each picture is determined.
Step S105: and determining pictures with the same column number in the index positions in the target table file aiming at each picture, taking the index positions as values, and forming key value pairs with keys of the pictures to obtain the dictionary.
In the process of specifically implementing step S105, first, for each picture, based on the index position corresponding to each picture obtained by performing step S104, according to the number of columns in the index position corresponding to each picture, the pictures stored in the target table file obtained by performing step S101 at the same column number position are determined, and a key of the picture is obtained.
And then, taking the index position corresponding to the picture as a value, and splicing the index position with the key of the picture in a json format to obtain a key value pair.
And finally, forming a dictionary by the obtained key value pairs.
Based on the image processing method provided by the embodiment of the invention, the image to be processed and the annotation information of the image are stored in the target table file in advance, the image corresponding to the index position in the target table file is determined based on the relation between the column number of the column where the image is located in the target table file and the column number in the index position, the index position is used as a value, a key value pair is formed by the index position and a key formed by the annotation information of the image, and the obtained key value pair is formed into a dictionary, so that the aim of reading the corresponding image in batch can be achieved by subsequently utilizing the dictionary, manual operation of the image is not needed, the method is simple and convenient, and the efficiency is improved.
Based on the above-mentioned picture processing method disclosed in fig. 1 in the embodiment of the present invention, the process of decompressing the target table backup file in step S104 and determining the index position corresponding to each picture based on the obtained folder and xml file storing the pictures is specifically implemented, which includes the following steps:
step A1: and decompressing the target table backup file to obtain a folder and an xml file which store the pictures.
In the specific implementation of step A1, the target form backup file obtained by executing step S103 may be decompressed by using a zipfile module of python to obtain a folder and an xml file, where it should be noted that, usually, a plurality of folders obtained by decompressing the target form backup file need to be determined, and since the pictures are stored in the folder with the folder name of media, the folder with the folder name of media is determined to further determine the folder for storing the pictures.
Step A2: and acquiring the current path of the folder according to the name of the folder.
In the process of specifically implementing the step A2, based on the folder for storing the picture obtained by executing the step A1, a current path of the folder is obtained according to the name of the folder for storing the picture.
Step A3: and slicing the current path of the folder to obtain a corresponding slice list.
In the specific implementation process of the step A3, based on the current path of the folder obtained by executing the step A2, the starting position to the ending position of the current path of the folder are sliced by a preset step length through a slicing module in python to obtain a plurality of sliced pieces, and the sliced pieces are combined into a sliced list.
Step A4: and carrying out regular expression processing on the slice list to obtain a picture path of the picture.
In step A4, the regular expression refers to a section of special character sequence or character string, different regular expressions can be generated through different character strings, and further, the purposes of filtering, replacing, searching and the like of required data can be achieved by using the regular expression.
In the process of specifically realizing the step A4, based on the slice list obtained by executing the step A3, a re module in python is used for circulating the start and stop positions of the slice list, and the slice list is searched through a regular expression comprising images, so that the image path in the slice list containing the images is determined.
Step A5: and coding the current path of the folder to obtain a coding path.
In the process of specifically implementing the step A5, based on the current path of the folder obtained by executing the step A2, the current path of the folder is encoded by using the base64, so as to obtain an encoding path, that is, the encoded current path of the folder.
Step A6: and analyzing the current path of the folder, the picture path of the picture and the coding path by using an xml function, and acquiring the number of lines and columns corresponding to each picture according to rules in the xml file.
In the process of specifically implementing the step A6, based on the path where the folder obtained by executing the step A2 is currently located, based on the picture path of the picture obtained by executing the step A4, and based on the coding path obtained by executing the step A5, an xml function in python is called to perform analysis processing on the three, and the xml function in the xml file is analyzed by an xdr: form and xdr: and the pic rule further acquires the number of rows and the number of columns corresponding to each picture from the analyzed and processed result.
Step A7: and taking the number of rows and the number of columns corresponding to each picture as the index position of each picture.
In the process of specifically implementing step A7, based on the number of rows and columns corresponding to each picture obtained by performing step A6, for each picture, the number of rows and columns corresponding to each picture is used as its index position.
In the embodiment of the invention, a folder and an xml file storing pictures are obtained by decompressing a target table backup file, a current path of the folder is obtained according to the name of the folder, the current path of the folder is sliced to obtain a corresponding slice list, the slice list is subjected to regular expression processing to obtain a picture path of the pictures, the current path of the folder is encoded to obtain an encoding path, the current path of the folder, the picture path of the pictures and the encoding path are analyzed by using an xml function, the number of rows and columns corresponding to each picture are obtained according to rules in the xml file, and the number of rows and columns corresponding to each picture are used as an index position of each picture, so that the obtained index position of each picture is associated with a key of each picture to form a key value pair and form a dictionary, and the dictionary is subsequently utilized to realize the purpose of reading the corresponding pictures in batches.
Referring to fig. 3, a schematic flow chart of another picture processing method provided in the embodiment of the present invention is shown based on the picture processing method disclosed in the embodiment of the present invention.
The picture processing method comprises the following steps:
step S301: and acquiring a target table file.
Step S302: and acquiring the column number of all columns with pictures in the target table file, and taking the annotation information corresponding to the pictures as keys of the pictures.
Step S303: and backing up the target table file to obtain the target table backup file with the compressed format as the file suffix.
Step S304: and decompressing the target table backup file, and determining the index position corresponding to each picture based on the obtained folder and xml file which are stored with the pictures.
Step S305: and determining pictures with the same columns in the target table file and the same columns in the index positions for each picture, taking the index positions as values, and forming key value pairs with keys of the pictures to obtain the dictionary.
It should be noted that, for concrete implementation of the processes and execution principles of step S301 to step S305, reference may be made to relevant contents correspondingly recorded in step S101 to step S105, and details are not repeated herein.
Step S306: and reading a corresponding key value pair in the dictionary based on the website data filling request, and filling the picture corresponding to the value into the website according to the indication of the key.
In step S306, the website data populating request refers to a request initiated by a user based on a need to populate data into the website in the process of establishing the website.
In the process of specifically implementing step S306, based on the received website data filling request initiated by the user, a key value pair corresponding to the website data filling request is read from the dictionary obtained by performing step S305, and based on a value in the key value pair, a corresponding picture is read, and according to an indication of a key in the key value pair, the read picture is filled into the website, thereby implementing that different types of pictures are added to corresponding positions of the website.
In the embodiment of the invention, the picture to be processed and the annotation information of the picture are stored in a target table file in advance, the picture corresponding to the index position in the target table file is determined based on the relation between the column number of the column where the picture is located in the target table file and the column number in the index position, the index position is used as a value, a key value pair is formed by the key consisting of the annotation information of the picture, the obtained key value pair forms a dictionary, the corresponding key value pair in the dictionary is read based on a website data filling request, and the picture corresponding to the value is filled in a website according to the indication of the key, so that the purposes of reading the corresponding pictures in batches and filling the read pictures in the corresponding positions in the website are realized, the picture is not required to be manually operated, the method is simple and convenient, and the efficiency is improved.
Based on the image processing method disclosed by the embodiment of the invention, correspondingly, the embodiment of the invention also discloses an image processing device.
Fig. 4 is a schematic structural diagram of an image processing apparatus according to an embodiment of the present invention.
The picture processing apparatus includes: a first acquisition unit 401, a second acquisition unit 402, a backup unit 403, a decompression unit 404, and a determination unit 405.
The first obtaining unit 401 is configured to obtain a target table file, where the target table file includes a pre-stored picture and annotation information of the picture, and the annotation information is located in a first row of a column where the picture is located.
A second obtaining unit 402, configured to obtain the number of columns of all columns in which pictures exist in the target table file, and use comment information corresponding to a picture as a key of the picture.
The backup unit 403 is configured to backup the target table file, and obtain a target table backup file with a compressed format as a file suffix.
The decompressing unit 404 is configured to decompress the target table backup file, and determine an index position corresponding to each picture based on the obtained folder and xml file storing the pictures.
A determining unit 405, configured to determine, for each picture, pictures in the target table file with the same number of columns as the number of columns in the index position, use the index position as a value, and form a key value pair with keys of the pictures to obtain a dictionary.
Optionally, the second obtaining unit 402 is specifically configured to read all columns in which pictures exist in the target table file by using an xlrA4 module of python, and determine the number of columns in which each picture is located.
Optionally, the decompression unit 404 includes:
and the decompression module is used for decompressing the target table backup file to obtain the folder and the xml file which store the picture.
And the acquisition module is used for acquiring the current path of the folder according to the name of the folder.
And the slicing module is used for slicing the current path of the folder to obtain a corresponding slice list.
And the processing module is used for carrying out regular expression processing on the slice list to obtain the picture path of the picture.
And the coding module is used for coding the current path of the folder to obtain a coding path.
The analysis module is used for analyzing the current path of the folder, the picture path of the picture and the coding path by using an xml function, and acquiring the number of rows and columns corresponding to each picture according to the rule in the xml file; and the number of rows and columns corresponding to each picture is used as the index position of each picture.
Optionally, the determining unit 405 includes:
and the determining module is used for determining the pictures stored in the same column number position in the target table file based on the column number in the index position of each picture and acquiring the key of the picture.
The splicing module is used for splicing the keys of the pictures and the index positions serving as the values in the json format to obtain key value pairs; and composing the resulting key-value pairs into a dictionary.
It should be noted that, for specific implementation principles of each unit and each module in the image processing system disclosed in the embodiment of the present invention, reference may be made to corresponding contents in the image processing method disclosed in the embodiment of the present invention, and details are not repeated here.
Based on the image processing apparatus provided by the above embodiment of the present invention, the first obtaining unit obtains a target table file, where the target table file includes a pre-stored image and annotation information of the image, and the annotation information is located in a first row of a column where the image is located; the second acquisition unit acquires the column number of all columns with pictures in the target table file and takes the annotation information corresponding to the pictures as keys of the pictures; the backup unit backs up the target table file to obtain a target table backup file with a compressed format as a file suffix; the decompression unit decompresses the target table backup file and determines an index position corresponding to each picture based on the obtained folder and xml file which store the pictures; the determining unit determines pictures with the same column number in the target table file and the index positions according to each picture, takes the index positions as values, and forms key value pairs with keys of the pictures to obtain the dictionary. In the scheme provided by the embodiment of the invention, the picture to be processed and the annotation information of the picture are stored in the target table file in advance, the picture corresponding to the index position in the target table file is determined based on the relation between the column number of the column where the picture is located in the target table file and the column number in the index position, the index position is used as a value, a key value pair is formed by the index position and a key formed by the annotation information of the picture, and the obtained key value pair is formed into the dictionary, so that the aim of reading the corresponding picture in batch can be fulfilled by subsequently utilizing the dictionary, manual operation of the picture is not needed, the operation is simple and convenient, and the efficiency is improved.
Referring to fig. 5, a schematic structural diagram of another image processing apparatus according to an embodiment of the present invention is shown.
The picture processing apparatus further includes: a fill unit 506.
And a filling unit 506, configured to read a corresponding key value pair in the dictionary based on the website data filling request, and fill the picture corresponding to the value into the website according to the indication of the key.
In the embodiment of the invention, the filling unit reads the corresponding key value pair in the dictionary based on the website data filling request, and fills the pictures corresponding to the values into the website according to the indication of the key, so that the aims of reading the corresponding pictures in batches and filling the read pictures into the corresponding positions in the website are fulfilled, manual operation of the pictures is not needed, the method is simple and convenient, and the efficiency is improved.
All the embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, the system or system embodiments, which are substantially similar to the method embodiments, are described in a relatively simple manner, and reference may be made to some descriptions of the method embodiments for relevant points. The above-described system and system embodiments are only illustrative, wherein the units described as separate parts may or may not be physically separate, and the parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative components and steps have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the technical solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (8)

1. A method for processing pictures, the method comprising:
acquiring a target table file, wherein the target table file comprises a pre-stored picture and annotation information of the picture, and the annotation information is positioned in a first row of a column where the picture is positioned;
acquiring the column number of all columns with pictures in the target table file, and taking annotation information corresponding to the pictures as keys of the pictures;
backing up the target table file to obtain a target table backup file with a compressed format as a file suffix;
decompressing the target table backup file to obtain a folder and an xml file which store the picture;
acquiring a current path of the folder according to the name of the folder;
slicing the current path of the folder to obtain a corresponding slice list;
carrying out regular expression processing on the slice list to obtain a picture path of the picture;
coding the current path of the folder to obtain a coding path;
analyzing the current path of the folder, the picture path of the picture and the coding path by using an xml function, and acquiring the number of rows and columns corresponding to each picture according to rules in the xml file;
taking the number of rows and the number of columns corresponding to each picture as an index position of each picture;
and determining pictures with the same column number in the target table file and the column number in the index positions aiming at each picture, taking the index positions as values, and forming key value pairs with the keys of the pictures to obtain a dictionary.
2. The method according to claim 1, wherein the obtaining the number of columns of all columns of the existing pictures in the target table file comprises:
and reading all columns of the pictures in the target table file by adopting an xlrd module of python, and determining the number of the columns of each picture.
3. The method according to claim 1, wherein the determining, for each picture, a picture in the target table file having the same number of columns as the number of columns in the index positions, taking the index positions as values, and forming key-value pairs with keys of the picture to obtain a dictionary comprises:
determining pictures stored in the same column number position in the target table file based on the column number in the index position of each picture, and acquiring keys of the pictures;
splicing the keys of the pictures and the index positions serving as values in a json format to obtain key value pairs;
and composing the obtained key-value pairs into a dictionary.
4. The method of claim 1, further comprising:
and reading a corresponding key value pair in the dictionary based on the website data filling request, and filling the picture corresponding to the value into the website according to the indication of the key.
5. A picture processing apparatus, characterized in that the apparatus comprises:
the device comprises a first acquisition unit, a second acquisition unit and a third acquisition unit, wherein the first acquisition unit is used for acquiring a target table file, the target table file comprises a picture stored in advance and annotation information of the picture, and the annotation information is positioned in a first row of a column where the picture is positioned;
a second obtaining unit, configured to obtain the number of columns of all columns in which a picture exists in the target table file, and use annotation information corresponding to the picture as a key of the picture;
the backup unit is used for backing up the target table file to obtain a target table backup file with a compressed format as a file suffix;
the decompression unit is used for decompressing the target table backup file and determining the index position corresponding to each picture based on the obtained folder and the xml file which store the pictures;
a determining unit, configured to determine, for each picture, a picture in the target table file whose number of columns is the same as that in the index position, use the index position as a value, and form a key-value pair with a key of the picture to obtain a dictionary;
the decompression unit includes:
the decompression module is used for decompressing the target table backup file to obtain a folder and an xml file which store the picture;
the acquisition module is used for acquiring the current path of the folder according to the name of the folder;
the slicing module is used for slicing the current path of the folder to obtain a corresponding slice list;
the processing module is used for carrying out regular expression processing on the slice list to obtain a picture path of the picture;
the coding module is used for coding the current path of the folder to obtain a coding path;
the analysis module is used for analyzing the current path of the folder, the picture path of the picture and the coding path by using an xml function and acquiring the number of rows and columns corresponding to each picture according to rules in the xml file; and the number of rows and columns corresponding to each picture are used as the index position of each picture.
6. The apparatus of claim 5,
the second obtaining unit is specifically configured to read all columns in which pictures exist in the target table file by using an xlrA4 module of python, and determine the number of columns in which each picture is located.
7. The apparatus of claim 5, wherein the determining unit comprises:
the determining module is used for determining pictures stored in the same column number position in the target table file based on the column number in the index position of each picture and acquiring keys of the pictures;
the splicing module is used for splicing the keys of the pictures and the index positions serving as values in a json format to obtain key value pairs; and composing the resulting key-value pairs into a dictionary.
8. The apparatus of claim 5, further comprising:
and the filling unit is used for reading the corresponding key value pair in the dictionary based on the website data filling request, and filling the picture corresponding to the value into the website according to the indication of the key.
CN202110395910.4A 2021-04-13 2021-04-13 Picture processing method and device Active CN112989254B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110395910.4A CN112989254B (en) 2021-04-13 2021-04-13 Picture processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110395910.4A CN112989254B (en) 2021-04-13 2021-04-13 Picture processing method and device

Publications (2)

Publication Number Publication Date
CN112989254A CN112989254A (en) 2021-06-18
CN112989254B true CN112989254B (en) 2023-03-07

Family

ID=76338283

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110395910.4A Active CN112989254B (en) 2021-04-13 2021-04-13 Picture processing method and device

Country Status (1)

Country Link
CN (1) CN112989254B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102768662A (en) * 2011-05-05 2012-11-07 阿里巴巴集团控股有限公司 Method and device for loading picture
CN104156207A (en) * 2014-07-31 2014-11-19 广州金山网络科技有限公司 File display method and device
CN105868169A (en) * 2016-04-06 2016-08-17 西安电子科技大学 Data acquisition interface and data acquisition method and system
CN108829736A (en) * 2018-05-21 2018-11-16 四川斐讯信息技术有限公司 A kind of joining method and system of image data and label information
CN111062187A (en) * 2019-11-27 2020-04-24 北京计算机技术及应用研究所 Structured parsing method and system for docx format document

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2003050964A (en) * 2000-11-30 2003-02-21 Kokusai Zunou Sangyo Kk Web server system and web system for spread sheet
FI20065754L (en) * 2006-11-28 2008-05-29 Liquid Air Lab Gmbh Image processing method
CN106610983A (en) * 2015-10-22 2017-05-03 中兴通讯股份有限公司 Picture management method and apparatus, and terminal
CN106407450A (en) * 2016-09-30 2017-02-15 网易(杭州)网络有限公司 File searching method and apparatus
CN107545021B (en) * 2017-05-10 2020-12-11 新华三信息安全技术有限公司 Data storage method and device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102768662A (en) * 2011-05-05 2012-11-07 阿里巴巴集团控股有限公司 Method and device for loading picture
CN104156207A (en) * 2014-07-31 2014-11-19 广州金山网络科技有限公司 File display method and device
CN105868169A (en) * 2016-04-06 2016-08-17 西安电子科技大学 Data acquisition interface and data acquisition method and system
CN108829736A (en) * 2018-05-21 2018-11-16 四川斐讯信息技术有限公司 A kind of joining method and system of image data and label information
CN111062187A (en) * 2019-11-27 2020-04-24 北京计算机技术及应用研究所 Structured parsing method and system for docx format document

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
《Simple Image Processing in Excel》;Akbar Ali 等;《IEEE》;20191024;第1-2页 *
在线电子表格之数据存储设计;王刘杨等;《计算机光盘软件与应用》;20130101(第01期);第187-188页 *

Also Published As

Publication number Publication date
CN112989254A (en) 2021-06-18

Similar Documents

Publication Publication Date Title
US8107727B2 (en) Document processing apparatus, document processing method, and computer program product
US9880709B2 (en) System and method for creating and displaying previews of content items for electronic works
US9928415B2 (en) Mathematical formula learner support system
CN108334508B (en) Webpage information extraction method and device
WO2010126451A1 (en) A data file having more than one mode of operation
US20210073313A1 (en) Methods and systems for three-way merges of object representations
CN106294480A (en) A kind of file layout change-over method, device and examination question import system
CN111222611B (en) Color-based stacked three-dimensional code encoding method, encoding device, decoding method, decoding device and storage medium
CN112989254B (en) Picture processing method and device
CN104423962A (en) Document evaluation device and method
CN112835577A (en) Data processing method, data processing device, computer equipment and readable storage medium
Hutchins Testing software tools of potential interest for digital preservation activities at the national library of australia
WO2018208412A1 (en) Detection of caption elements in documents
CN102346771B (en) Information expression method and device
CN116451683B (en) Document merging method, terminal and computer readable storage medium
CN116010147A (en) Method, system, electronic device and storage medium for generating exception handling table
CN111241096A (en) Text extraction method, system, terminal and storage medium for EXCEL document
CN111259276A (en) Method and device for displaying title content, electronic equipment and storage medium
CN112950167A (en) Design service matching method, device, equipment and storage medium
CN112752165A (en) Subtitle processing method, subtitle processing device, server and computer-readable storage medium
CN111209759A (en) Webpage translation method and device, computer equipment and storage medium
CN106815249B (en) Vertical text advertisement filtering method and device
CN116432617A (en) Method, device, equipment and medium for merging OFD files
CN115982358B (en) Document splitting method, device, terminal equipment and computer readable storage medium
CN116795367A (en) Front-end page development method, device, equipment and 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