CN106874285B - Photo file processing method and terminal equipment - Google Patents

Photo file processing method and terminal equipment Download PDF

Info

Publication number
CN106874285B
CN106874285B CN201510920309.7A CN201510920309A CN106874285B CN 106874285 B CN106874285 B CN 106874285B CN 201510920309 A CN201510920309 A CN 201510920309A CN 106874285 B CN106874285 B CN 106874285B
Authority
CN
China
Prior art keywords
image data
file
photo file
bit image
photo
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
CN201510920309.7A
Other languages
Chinese (zh)
Other versions
CN106874285A (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.)
China Mobile Communications Group Co Ltd
Original Assignee
China Mobile Communications Corp
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 China Mobile Communications Corp filed Critical China Mobile Communications Corp
Priority to CN201510920309.7A priority Critical patent/CN106874285B/en
Publication of CN106874285A publication Critical patent/CN106874285A/en
Application granted granted Critical
Publication of CN106874285B publication Critical patent/CN106874285B/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/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/174Redundancy elimination performed by the file system
    • G06F16/1744Redundancy elimination performed by the file system using compression, e.g. sparse files
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/50Information retrieval; Database structures therefor; File system structures therefor of still image data

Landscapes

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

Abstract

The invention discloses a photo file processing method and terminal equipment, wherein the method comprises the following steps: acquiring a photo file, wherein the photo file at least comprises image data; sequentially reading M-bit image data from the image data, wherein M is an integer greater than or equal to 1; inquiring in a database based on the M-bit image data, and performing processing operation based on an inquiry result; and obtaining a compressed file corresponding to the photo file after reading all the image data of the photo file, and deleting the photo file.

Description

一种照片文件处理方法及终端设备A photo file processing method and terminal device

技术领域technical field

本发明涉及网络管理领域的时隙管理技术,尤其涉及一种照片文件处理方法及终端设备。The invention relates to a time slot management technology in the field of network management, in particular to a photo file processing method and a terminal device.

背景技术Background technique

终端设备,尤其是智能移动终端已非常普及,而且在移动终端应用中相机拍照功能使用率相对比较高。终端相机的功能是很多手机厂商的一大卖点,如像素越来越高、功能也越来越多、可以连拍等。多数人在旅游或出行时喜欢连拍,随的像素越来越高拍照生成的照片也越来越大。当前市场上多数手机的照相机功能像素可以达到1300万像素。拍出的照片可以非常清楚达到专业相机的水平,同时终端拍照应用拍完照片后直接保存到SD卡或内存卡中,一般使用JPEG或其它技术进行存储,大约为4MB左右。Terminal devices, especially intelligent mobile terminals, have become very popular, and the usage rate of the camera function in mobile terminal applications is relatively high. The function of the terminal camera is a major selling point of many mobile phone manufacturers, such as higher and higher pixels, more and more functions, and continuous shooting. Most people like to take continuous shots when traveling or traveling, and as the pixels become higher and higher, the photos generated by taking pictures become larger and larger. Most mobile phones currently on the market have cameras that can reach 13 million pixels. The photos taken can be very clear to the level of professional cameras. At the same time, the terminal camera application directly saves the photos to the SD card or memory card after taking the photos. Generally, JPEG or other technologies are used for storage, which is about 4MB.

现有技术在移动终端在连拍中都采用直接使用JPEG或其它格式进行存储,而现有终端很多都是不可以进行增加扩展存储,而且连拍的照片在一般在10张以上,这样一次连拍占用了大量的存储,按一张4MB,那么一次连拍需要40MB或更多的存储空间。可以看出,现有技术并没有对照片进行高效的压缩从而浪费了中的设备的存储空间。In the prior art, in the continuous shooting of mobile terminals, JPEG or other formats are directly used for storage, and many existing terminals cannot be added for extended storage, and the continuous shooting photos are generally more than 10. Shooting takes up a lot of storage. If you press 4MB for one shot, then a continuous shooting requires 40MB or more of storage space. It can be seen that the prior art does not compress photos efficiently, thus wasting the storage space of the device.

发明内容SUMMARY OF THE INVENTION

有鉴于此,本发明的目的在于提供一种照片文件处理方法及终端设备,能至少解决现有技术中存在的上述问题。In view of this, the purpose of the present invention is to provide a photo file processing method and terminal device, which can at least solve the above problems existing in the prior art.

为达到上述目的,本发明的技术方案是这样实现的:In order to achieve the above object, the technical scheme of the present invention is achieved in this way:

本发明实施例提供了一种照片文件处理方法,所述方法包括:An embodiment of the present invention provides a photo file processing method, the method includes:

获取到照片文件,所述照片文件中至少包括图像数据;Obtaining a photo file, the photo file at least includes image data;

依次从所述图像数据中读取M位图像数据,M为大于等于1的整数;Read M-bit image data sequentially from the image data, where M is an integer greater than or equal to 1;

基于所述M位图像数据在数据库中进行查询,基于查询结果进行处理操作;其中,所述处理操作包括:若查询结果为所述数据库中保存有相同的M位图像数据,则获取到所述M位图像数据的标识信息,并将所述标识信息保存至照片文件对应的压缩文件;若查询结果为所述数据库中未保存有相同的M位图像数据,则将所述M位图像数据添加到所述数据库中,生成所述M位图像数据的标识信息,将所述标识信息保存至照片文件对应的压缩文件;Perform a query in the database based on the M-bit image data, and perform a processing operation based on the query result; wherein, the processing operation includes: if the query result is that the same M-bit image data is stored in the database, obtaining the The identification information of the M-bit image data, and the identification information is saved to the compressed file corresponding to the photo file; if the query result is that the same M-bit image data is not saved in the database, the M-bit image data is added. In the database, generate the identification information of the M-bit image data, and save the identification information to the compressed file corresponding to the photo file;

直至读取完所述照片文件的全部图像数据后,得到所述照片文件对应的压缩文件,并删除所述照片文件。After reading all the image data of the photo file, a compressed file corresponding to the photo file is obtained, and the photo file is deleted.

本发明实施例提供了一种终端设备,包括:An embodiment of the present invention provides a terminal device, including:

读取单元,用于获取到照片文件,所述照片文件中至少包括图像数据;a reading unit, configured to obtain a photo file, the photo file includes at least image data;

处理单元,用于依次从所述图像数据中读取M位图像数据,M为大于等于1的整数;基于所述M位图像数据在数据库中进行查询,基于查询结果进行处理操作;若查询结果为所述数据库中保存有相同的M位图像数据,则获取到所述M位图像数据的标识信息,并将所述标识信息保存至照片文件对应的压缩文件;若查询结果为所述数据库中未保存有相同的M位图像数据,则将所述M位图像数据添加到所述数据库中,生成所述M位图像数据的标识信息,将所述标识信息保存至照片文件对应的压缩文件;直至读取完所述照片文件的全部图像数据后,得到所述照片文件对应的压缩文件,并删除所述照片文件;a processing unit, configured to sequentially read M-bit image data from the image data, where M is an integer greater than or equal to 1; query the database based on the M-bit image data, and perform processing operations based on the query result; if the query result In order to save the same M-bit image data in the database, the identification information of the M-bit image data is obtained, and the identification information is saved to the compressed file corresponding to the photo file; if the query result is that the database The same M-bit image data is not stored, then the M-bit image data is added to the database, the identification information of the M-bit image data is generated, and the identification information is saved to the compressed file corresponding to the photo file; After reading all the image data of the photo file, the compressed file corresponding to the photo file is obtained, and the photo file is deleted;

数据库,用于保存图像数据及其对应的标识信息。The database is used to save image data and its corresponding identification information.

本发明实施例提供了照片文件处理方法及终端设备,按照预设的步长读取照片文件中的图像数据,然后基于读取的图像数据与数据库中存储的数据进行比对,仅将数据库中没有保存过的部分图像数据添加并保存在数据库中,仅在照片文件对应的压缩文件中保存每一个部分图像数据对应的标识信息。如此,使得用户避免对多个具备重复内容的照片中的重复内容进行多次保存,实现了对照片文件更有效的压缩,节省了终端设备的存储空间。The embodiments of the present invention provide a photo file processing method and a terminal device. The image data in the photo file is read according to a preset step size, and then based on the read image data and the data stored in the database, only the data stored in the database is compared. The unsaved part of the image data is added and stored in the database, and only the identification information corresponding to each part of the image data is stored in the compressed file corresponding to the photo file. In this way, the user is prevented from saving repeated content in multiple photos with repeated content for multiple times, which realizes more effective compression of the photo files, and saves the storage space of the terminal device.

附图说明Description of drawings

图1为本发明实施例照片文件处理方法流程示意图一;1 is a schematic flow chart 1 of a method for processing a photo file according to an embodiment of the present invention;

图2为本发明实施例场景示意图;FIG. 2 is a schematic diagram of a scenario according to an embodiment of the present invention;

图3为本发明实施例照片文件处理方法流程示意图二;3 is a second schematic flowchart of a method for processing a photo file according to an embodiment of the present invention;

图4为本发明实施例终端设备的组成结构示意图。FIG. 4 is a schematic diagram of a composition structure of a terminal device according to an embodiment of the present invention.

具体实施方式Detailed ways

下面结合附图及具体实施例对本发明再作进一步详细的说明。The present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.

实施例一、Embodiment 1.

本发明实施例提供了一种照片文件处理方法,如图1所示,包括:An embodiment of the present invention provides a photo file processing method, as shown in FIG. 1 , including:

步骤101:获取到照片文件,所述照片文件中至少包括图像数据;Step 101: obtaining a photo file, where the photo file at least includes image data;

步骤102:依次从所述图像数据中读取M位图像数据,M为大于等于1的整数;Step 102: Read M-bit image data sequentially from the image data, where M is an integer greater than or equal to 1;

步骤103:基于所述M位图像数据在数据库中进行查询,基于查询结果进行处理操作;其中,所述处理操作包括有:若所述数据库中保存有相同的M位图像数据,则获取到所述M位图像数据的标识信息,并将所述标识信息保存至照片文件对应的压缩文件;若所述数据库中未保存有相同的M位图像数据,则将所述M位图像数据添加到所述数据库中,生成所述M位图像数据的标识信息,将所述标识信息保存至照片文件对应的压缩文件;Step 103: query the database based on the M-bit image data, and perform a processing operation based on the query result; wherein, the processing operation includes: if the same M-bit image data is stored in the database, obtaining all the data. The identification information of the M-bit image data, and the identification information is saved to the compressed file corresponding to the photo file; if the same M-bit image data is not saved in the database, then the M-bit image data is added to the In the database, generate the identification information of the M-bit image data, and save the identification information to the compressed file corresponding to the photo file;

步骤104:直至读取完所述照片文件的全部图像数据后,得到所述照片文件对应的压缩文件,并删除所述照片文件。Step 104: After reading all the image data of the photo file, obtain a compressed file corresponding to the photo file, and delete the photo file.

本实施例描述的方法可以应用于具备图像采集功能的终端设备。本实施例中所述照片文件可以为连拍得到的多个照片中的一张照片。The method described in this embodiment can be applied to a terminal device with an image acquisition function. The photo file in this embodiment may be one photo among multiple photos obtained by continuous shooting.

本实施例中,所述照片文件中还包括:照片文件的描述信息;其中,所述照片文件的描述信息的大小是固定的,所以本实施例中只对图像数据部分进行处理。另外,文件的描述信息根据文件格式的具体规范直接获取。In this embodiment, the photo file further includes: description information of the photo file; wherein, the size of the description information of the photo file is fixed, so only the image data part is processed in this embodiment. In addition, the description information of the file is directly obtained according to the specific specification of the file format.

相应的,所述方法还包括:建立所述图片文件对应的压缩文件,添加所述照片文件的描述信息至所述压缩文件。Correspondingly, the method further includes: establishing a compressed file corresponding to the picture file, and adding description information of the photo file to the compressed file.

所述图像数据可以为二进制数据。The image data may be binary data.

进一步地,所述依次从所述图像数据中读取M位图像数据可以包括:Further, the sequentially reading M-bit image data from the image data may include:

将所述二进制的图像数据,转换为十六进制的N位图像数据,N为大于等于1的整数;Convert the binary image data into hexadecimal N-bit image data, where N is an integer greater than or equal to 1;

从所述十六进制的N为图像数据中,依次读取M位图像数据。M-bit image data is sequentially read from the hexadecimal N being image data.

可以理解的是,M除了大于等于1之外,还预设为小于等于N的整数。It can be understood that, in addition to being greater than or equal to 1, M is also preset as an integer less than or equal to N.

所述数据库,用于存储照片内容并为内容建立标识信息(ID)编码,包括ID和数据内容两列数据,其中ID编码类似数据库的自增主键并不可以重复,自动顺序累加,数据内容部分存储照片的实际数据。The database is used for storing photo content and establishing identification information (ID) codes for the content, including two columns of data of ID and data content, wherein the ID code is similar to the self-incrementing primary key of the database and cannot be repeated, and the automatic sequence is accumulated. The data content part Stores the actual data of the photo.

所述生成标识信息的方法可以为在当前已有的最大标识信息之上加一,得到新的标识信息作为生成的标识信息。The method for generating identification information may be to add one to the currently existing maximum identification information to obtain new identification information as the generated identification information.

所述依次从所述图像数据中读取M位图像数据;基于所述M位图像数据在数据库中进行查询,基于查询结果进行处理操作,包括:The sequential reading of M-bit image data from the image data; querying the database based on the M-bit image data, and performing processing operations based on the query results, including:

从所述图像数据中读取M为图像数据,基于所述M位图像数据在数据库中进行查询,基于查询结果进行处理操作;Read M is image data from the image data, query the database based on the M-bit image data, and perform processing operations based on the query result;

判断所述图像数据中是否存在未读取的图像数据,若存在,则继续读取M为图像数据,基于所述M位图像数据在数据库中进行查询,基于查询结果进行处理操作;否则,确定完成读取操作。Determine whether there is unread image data in the image data, if so, continue to read M as image data, query the database based on the M-bit image data, and perform processing operations based on the query results; otherwise, determine Complete the read operation.

本实施例还提供读取图像文件的操作,具体可以包括:This embodiment also provides an operation for reading an image file, which may specifically include:

获取到压缩文件;Get the compressed file;

逐个读取所述压缩文件中的至少一个标识信息;Read at least one identification information in the compressed file one by one;

基于所述至少一个标识信息,从所述数据库中提取所述至少一个标识信息对应的至少一组M位图像数据;Based on the at least one identification information, extracting at least one set of M-bit image data corresponding to the at least one identification information from the database;

将读取到的至少一组M位图像数据,按照顺序进行组合得到照片文件。Combine the read at least one set of M-bit image data in sequence to obtain a photo file.

其中,所述将读取到的至少一组M位图像数据,按照顺序进行组合得到照片文件,还包括:Wherein, the at least one group of M-bit image data to be read is combined in order to obtain a photo file, and also includes:

将所述至少一组十六进制的M位图像数据转换为至少一组二进制的图像数据;converting the at least one group of hexadecimal M-bit image data into at least one group of binary image data;

将转换后得到的至少一组二进制图像数据按照顺序进行组合得到照片文件。A photo file is obtained by combining at least one set of binary image data obtained after conversion in sequence.

所述压缩文件为每一个原照片文件对应一个压缩后的文件,主要存储原照片数据存储到压缩数据库后对应的ID编码。The compressed file is a compressed file corresponding to each original photo file, and mainly stores the corresponding ID code after the original photo data is stored in the compressed database.

本实施例中所述照片文件、数据库以及压缩文件之间的对应关系,可以如图2所示,有两个照片文件,分别为照片文件一和照片文件二,照片文件中的图像数据转换为二进制之后如图中所示;设置M等于8,也就是说每次从照片文件中提取8位图像数据在数据库中进行查询;假设数据库中保存有图像数据“12345670”,那么就直接从中提取其对应的标识信息“001”将001加入到照片文件一对应的压缩文件一中;再次提取图片文件一中的“23157900”,发现数据库中没有存储相同数据,就在数据库中生成标识信息002,将该部分图像数据添加到002对应的数据内容中。照片文件二的处理方式与照片文件一的处理方式相同,不做赘述。The correspondence between the photo files, the database, and the compressed files described in this embodiment can be as shown in FIG. 2 . There are two photo files, which are the first photo file and the second photo file. The image data in the photo file is converted into After binary, as shown in the figure; set M equal to 8, that is to say, extract 8-bit image data from the photo file each time to query in the database; assuming that the image data "12345670" is saved in the database, then directly extract the image data from it. The corresponding identification information "001" adds 001 to the compressed file one corresponding to the photo file one; extract "23157900" in the picture file one again, and find that the same data is not stored in the database, just generate identification information 002 in the database, and This part of the image data is added to the data content corresponding to 002. The processing method of the photo file 2 is the same as that of the photo file 1, and will not be repeated.

另外,可以理解的是,本实施例中步骤104中所述删除照片文件,可以为每次完成一次遍历照片文件的操作,就将照片文件删除;或者,可以为完成所述照片文件所在的连拍得到的全部的照片文件的处理之后,再将连拍得到的全部照片文件共同删除。In addition, it can be understood that the deletion of the photo file in step 104 in this embodiment may be to delete the photo file every time an operation of traversing the photo file is completed; or, it may be to complete the connection where the photo file is located. After all the photo files obtained by shooting are processed, all the photo files obtained by continuous shooting are collectively deleted.

具体压缩流程如图3所示:The specific compression process is shown in Figure 3:

步骤301:读取照片文件;Step 301: read the photo file;

步骤302:创建照片文件对应的压缩文件;Step 302: create a compressed file corresponding to the photo file;

步骤303:根据照片文件格式获取文件的描述信息长度以及图像数据;Step 303: Obtain the description information length and image data of the file according to the photo file format;

这里,文件格式由文件描述信息和具体图像数据两部分组成;Here, the file format consists of two parts: file description information and specific image data;

其中,所述文件的描述信息的大小是固定的,所以本实施例中只对数据部分进行数字重新编码,对文件的描述信息根据文件格式的具体规范直接获取,获取数据后转化为16进制编码,根据编码查询数据库判断是否已存有所述照片文件,如果存在,则将ID保存到压缩文件中,如果不存在,将数据内容保存到数据库中,并自动生成ID编码。The size of the description information of the file is fixed, so in this embodiment, only the data part is digitally re-encoded, the description information of the file is directly obtained according to the specific specification of the file format, and the obtained data is converted into hexadecimal system Encoding, according to the encoding query database to determine whether the photo file has been stored, if there is, the ID is saved in the compressed file, if not, the data content is saved in the database, and the ID code is automatically generated.

步骤304:以预设步长M读取原照片文件的二进制图像数据,并将读取到的图像数据转化为16进制编码,使用16进制编码到数据库中查询是否存在相同的数据内容,如果存在,则执行步骤305;否则,执行步骤306;Step 304: read the binary image data of the original photo file with a preset step size M, convert the read image data into hexadecimal code, and use the hexadecimal code to query the database for the existence of the same data content, If it exists, go to step 305; otherwise, go to step 306;

步骤305:将数据内容对应的标识信息,比如ID号,保存的到压缩文件中,执行步骤307;Step 305: Save the identification information corresponding to the data content, such as an ID number, into a compressed file, and execute Step 307;

步骤306:保存16进制编码到数据库中并按照顺序生成标识信息,然后执行步骤305;Step 306: save the hexadecimal code into the database and generate identification information in sequence, and then perform step 305;

步骤307:判断是否完成当前照片数据内容读取;没有完成,则返回执行步骤304;若完成,则执行步骤308;Step 307: determine whether the reading of the current photo data content is completed; if not, return to step 304; if completed, execute step 308;

步骤308:开始压缩其它文件,直到所有文件完成后,删除原有照片完成连拍照片的压缩。Step 308: Start to compress other files, delete the original photos after all the files are completed, and complete the compression of the burst photos.

可见,通过采用上述方案,就能够按照预设的步长读取照片文件中的图像数据,然后基于读取的图像数据与数据库中存储的数据进行比对,仅将数据库中没有保存过的部分图像数据添加并保存在数据库中,仅在照片文件对应的压缩文件中保存每一个部分图像数据对应的标识信息。如此,使得用户避免对多个具备重复内容的照片中的重复内容进行多次保存,实现了对照片文件更有效的压缩,节省了终端设备的存储空间。It can be seen that by adopting the above scheme, the image data in the photo file can be read according to the preset step size, and then based on the read image data and the data stored in the database, only the unsaved part in the database is compared. The image data is added and stored in the database, and only the identification information corresponding to each part of the image data is stored in the compressed file corresponding to the photo file. In this way, the user is prevented from saving repeated content in multiple photos with repeated content for multiple times, which realizes more effective compression of the photo files, and saves the storage space of the terminal device.

实施例二、Embodiment two,

本发明实施例提供了一种终端设备,如图4所示,包括:An embodiment of the present invention provides a terminal device, as shown in FIG. 4 , including:

读取单元41,用于获取到照片文件,所述照片文件中至少包括图像数据;a reading unit 41, configured to obtain a photo file, where the photo file at least includes image data;

处理单元42,用于依次从所述图像数据中读取M位图像数据,M为大于等于1的整数;基于所述M位图像数据在数据库中进行查询,基于查询结果进行处理操作;若查询结果为所述数据库中保存有相同的M位图像数据,则获取到所述M位图像数据的标识信息,并将所述标识信息保存至照片文件对应的压缩文件;若查询结果为所述数据库中未保存有相同的M位图像数据,则将所述M位图像数据添加到所述数据库中,生成所述M位图像数据的标识信息,将所述标识信息保存至照片文件对应的压缩文件;直至读取完所述照片文件的全部图像数据后,得到所述照片文件对应的压缩文件,并删除所述照片文件;The processing unit 42 is configured to sequentially read M-bit image data from the image data, where M is an integer greater than or equal to 1; query the database based on the M-bit image data, and perform processing operations based on the query results; The result is that the same M-bit image data is stored in the database, then the identification information of the M-bit image data is obtained, and the identification information is saved to the compressed file corresponding to the photo file; if the query result is the database. The same M-bit image data is not stored in the M-bit image data, then the M-bit image data is added to the database, the identification information of the M-bit image data is generated, and the identification information is saved to the compressed file corresponding to the photo file ; After reading all the image data of the photo file, obtain the corresponding compressed file of the photo file, and delete the photo file;

数据库43,用于保存图像数据及其对应的标识信息。The database 43 is used to save image data and its corresponding identification information.

本实施例中所述照片文件可以为连拍得到的多个照片中的一张照片。The photo file in this embodiment may be one photo among multiple photos obtained by continuous shooting.

本实施例中,所述照片文件中还包括:照片文件的描述信息;其中,所述照片文件的描述信息的大小是固定的,所以本实施例中只对图像数据部分进行处理。另外,文件的描述信息根据文件格式的具体规范直接获取。In this embodiment, the photo file further includes: description information of the photo file; wherein, the size of the description information of the photo file is fixed, so only the image data part is processed in this embodiment. In addition, the description information of the file is directly obtained according to the specific specification of the file format.

相应的,所述处理单元,用于建立所述图片文件对应的压缩文件,添加所述照片文件的描述信息至所述压缩文件。Correspondingly, the processing unit is configured to create a compressed file corresponding to the picture file, and add description information of the photo file to the compressed file.

所述图像数据可以为二进制数据。The image data may be binary data.

进一步地,所述处理单元,用于将二进制的图像数据,转换为十六进制的N位图像数据,N为大于等于1的整数;从所述十六进制的N位图像数据中,依次读取M位图像数据。Further, the processing unit is configured to convert the binary image data into hexadecimal N-bit image data, where N is an integer greater than or equal to 1; from the hexadecimal N-bit image data, M-bit image data is sequentially read.

可以理解的是,M除了大于等于1之外,还预设为小于等于N的整数。It can be understood that, in addition to being greater than or equal to 1, M is also preset as an integer less than or equal to N.

所述数据库,用于存储照片内容并为内容建立标识信息(ID)编码,包括ID和数据内容两列数据,其中ID编码类似数据库的自增主键并不可以重复,自动顺序累加,数据内容部分存储照片的实际数据。The database is used for storing photo content and establishing identification information (ID) codes for the content, including two columns of data of ID and data content, wherein the ID code is similar to the self-incrementing primary key of the database and cannot be repeated, and the automatic sequence is accumulated. The data content part Stores the actual data of the photo.

所述生成标识信息的方法可以为在当前已有的最大标识信息之上加一,得到新的标识信息作为生成的标识信息。The method for generating identification information may be to add one to the currently existing maximum identification information to obtain new identification information as the generated identification information.

所述依次从所述图像数据中读取M位图像数据;基于所述M位图像数据在数据库中进行查询,基于查询结果进行处理操作,包括:The sequential reading of M-bit image data from the image data; querying the database based on the M-bit image data, and performing processing operations based on the query results, including:

从所述图像数据中读取M为图像数据,基于所述M位图像数据在数据库中进行查询,基于查询结果进行处理操作;Read M is image data from the image data, query the database based on the M-bit image data, and perform processing operations based on the query result;

判断所述图像数据中是否存在未读取的图像数据,若存在,则继续读取M为图像数据,基于所述M位图像数据在数据库中进行查询,基于查询结果进行处理操作;否则,确定完成读取操作。Determine whether there is unread image data in the image data, if so, continue to read M as image data, query the database based on the M-bit image data, and perform processing operations based on the query results; otherwise, determine Complete the read operation.

本实施例还提供读取图像文件的操作,所述处理单元,用于删除所述照片文件之后,获取到压缩文件;逐个读取所述压缩文件中的至少一个标识信息;基于所述至少一个标识信息,从所述数据库中提取所述至少一个标识信息对应的至少一组M位图像数据;将读取到的至少一组M位图像数据,按照顺序进行组合得到照片文件。This embodiment also provides an operation of reading an image file, the processing unit is configured to obtain a compressed file after deleting the photo file; read at least one identification information in the compressed file one by one; based on the at least one identification information, extracting at least one group of M-bit image data corresponding to the at least one identification information from the database; combining the read at least one group of M-bit image data in order to obtain a photo file.

所述处理单元,用于将所述至少一组十六进制的M位图像数据转换为至少一组二进制的图像数据;将转换后得到的至少一组二进制图像数据按照顺序进行组合得到照片文件。The processing unit is used to convert the at least one group of hexadecimal M-bit image data into at least one group of binary image data; combine the at least one group of binary image data obtained after the conversion in order to obtain a photo file .

所述压缩文件为每一个原照片文件对应一个压缩后的文件,主要存储原照片数据存储到压缩数据库后对应的ID编码。The compressed file is a compressed file corresponding to each original photo file, and mainly stores the corresponding ID code after the original photo data is stored in the compressed database.

本实施例中所述照片文件、数据库以及压缩文件之间的对应关系,可以如图2所示,有两个照片文件,分别为照片文件一和照片文件二,照片文件中的图像数据转换为二进制之后如图中所示;设置M等于8,也就是说每次从照片文件中提取8位图像数据在数据库中进行查询;假设数据库中保存有图像数据“12345670”,那么就直接从中提取其对应的标识信息“001”将001加入到照片文件一对应的压缩文件一中;再次提取图片文件一中的“23157900”,发现数据库中没有存储相同数据,就在数据库中生成标识信息002,将该部分图像数据添加到002对应的数据内容中。照片文件二的处理方式与照片文件一的处理方式相同,不做赘述。The correspondence between the photo files, the database, and the compressed files described in this embodiment can be as shown in FIG. 2 . There are two photo files, which are the first photo file and the second photo file. The image data in the photo file is converted into After binary, as shown in the figure; set M equal to 8, that is to say, extract 8-bit image data from the photo file each time to query in the database; assuming that the image data "12345670" is saved in the database, then directly extract the image data from it. The corresponding identification information "001" adds 001 to the compressed file one corresponding to the photo file one; extract "23157900" in the picture file one again, and find that the same data is not stored in the database, just generate identification information 002 in the database, and This part of the image data is added to the data content corresponding to 002. The processing method of the photo file 2 is the same as that of the photo file 1, and will not be repeated.

另外,可以理解的是,本实施例中所述处理单元,可以为每次完成一次遍历照片文件的操作,就将照片文件删除;或者,可以为完成所述照片文件所在的连拍得到的全部的照片文件的处理之后,再将连拍得到的全部照片文件共同删除。In addition, it can be understood that the processing unit in this embodiment may delete the photo file every time the operation of traversing the photo file is completed once; After the photo files are processed, all the photo files obtained by continuous shooting will be deleted together.

可见,通过采用上述方案,就能够按照预设的步长读取照片文件中的图像数据,然后基于读取的图像数据与数据库中存储的数据进行比对,仅将数据库中没有保存过的部分图像数据添加并保存在数据库中,仅在照片文件对应的压缩文件中保存每一个部分图像数据对应的标识信息。如此,使得用户避免对多个具备重复内容的照片中的重复内容进行多次保存,实现了对照片文件更有效的压缩,节省了终端设备的存储空间。It can be seen that by adopting the above scheme, the image data in the photo file can be read according to the preset step size, and then based on the read image data and the data stored in the database, only the unsaved part in the database is compared. The image data is added and stored in the database, and only the identification information corresponding to each part of the image data is stored in the compressed file corresponding to the photo file. In this way, the user is prevented from saving repeated content in multiple photos with repeated content for multiple times, which realizes more effective compression of the photo files, and saves the storage space of the terminal device.

本发明实施例所述集成的模块如果以软件功能模块的形式实现并作为独立的产品销售或使用时,也可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明实施例的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机、基站、或者网络设备等)执行本发明各个实施例所述方法的全部或部分。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。这样,本发明实施例不限制于任何特定的硬件和软件结合。If the integrated modules described in the embodiments of the present invention are implemented in the form of software function modules and sold or used as independent products, they may also be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the embodiments of the present invention may be embodied in the form of software products in essence or the parts that make contributions to the prior art. The computer software products are stored in a storage medium and include several instructions for A computer device (which may be a personal computer, a base station, or a network device, etc.) is caused to execute all or part of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, Read-Only Memory (ROM, Read-Only Memory), Random Access Memory (RAM, Random Access Memory), magnetic disk or optical disk and other media that can store program codes . As such, embodiments of the present invention are not limited to any particular combination of hardware and software.

以上所述,仅为本发明的较佳实施例而已,并非用于限定本发明的保护范围。The above descriptions are only preferred embodiments of the present invention, and are not intended to limit the protection scope of the present invention.

Claims (10)

1.一种照片文件处理方法,其特征在于,所述方法包括:1. a photo file processing method, is characterized in that, described method comprises: 获取到照片文件,所述照片文件中至少包括图像数据;Obtaining a photo file, the photo file at least includes image data; 依次从所述图像数据中读取M位图像数据,M为大于等于1的整数;Read M-bit image data sequentially from the image data, where M is an integer greater than or equal to 1; 基于所述M位图像数据在数据库中进行查询,基于查询结果进行处理操作;其中,所述处理操作包括:若查询结果为所述数据库中保存有相同的M位图像数据,则获取到所述M位图像数据的标识信息,并将所述标识信息保存至照片文件对应的压缩文件;若查询结果为所述数据库中未保存有相同的M位图像数据,则将所述M位图像数据添加到所述数据库中,生成所述M位图像数据的标识信息,将所述标识信息保存至照片文件对应的压缩文件;Perform a query in the database based on the M-bit image data, and perform a processing operation based on the query result; wherein, the processing operation includes: if the query result is that the same M-bit image data is stored in the database, obtaining the The identification information of the M-bit image data, and the identification information is saved to the compressed file corresponding to the photo file; if the query result is that the same M-bit image data is not saved in the database, the M-bit image data is added. In the database, generate the identification information of the M-bit image data, and save the identification information to the compressed file corresponding to the photo file; 直至读取完所述照片文件的全部图像数据后,得到所述照片文件对应的压缩文件,并删除所述照片文件。After reading all the image data of the photo file, a compressed file corresponding to the photo file is obtained, and the photo file is deleted. 2.根据权利要求1所述的方法,其特征在于,所述依次从所述图像数据中读取M位图像数据,包括:2. The method according to claim 1, wherein the sequentially reading M-bit image data from the image data comprises: 将二进制的图像数据,转换为十六进制的N位图像数据,N为大于等于1的整数;Convert binary image data to hexadecimal N-bit image data, where N is an integer greater than or equal to 1; 从所述十六进制的N位图像数据中,依次读取M位图像数据。From the N-bit image data in the hexadecimal system, M-bit image data is sequentially read. 3.根据权利要求1所述的方法,其特征在于,所述照片文件中还包括:照片文件的描述信息;3. The method according to claim 1, wherein the photo file further comprises: description information of the photo file; 相应的,所述方法还包括:Correspondingly, the method further includes: 建立所述照片文件对应的压缩文件,添加所述照片文件的描述信息至所述压缩文件。A compressed file corresponding to the photo file is created, and description information of the photo file is added to the compressed file. 4.根据权利要求1-3任一项所述的方法,其特征在于,所述删除所述照片文件之后,所述方法还包括:4. The method according to any one of claims 1-3, wherein after the deletion of the photo file, the method further comprises: 获取到压缩文件;Get the compressed file; 逐个读取所述压缩文件中的至少一个标识信息;Read at least one identification information in the compressed file one by one; 基于所述至少一个标识信息,从所述数据库中提取所述至少一个标识信息对应的至少一组M位图像数据;Based on the at least one identification information, extracting at least one set of M-bit image data corresponding to the at least one identification information from the database; 将读取到的至少一组M位图像数据,按照顺序进行组合得到照片文件。Combine the read at least one set of M-bit image data in sequence to obtain a photo file. 5.根据权利要求4所述的方法,其特征在于,所述将读取到的至少一组M位图像数据,按照顺序进行组合得到照片文件,包括:5. The method according to claim 4, wherein the at least one group of M-bit image data that will be read is combined in order to obtain a photo file, comprising: 将所述至少一组十六进制的M位图像数据转换为至少一组二进制的图像数据;converting the at least one group of hexadecimal M-bit image data into at least one group of binary image data; 将转换后得到的至少一组二进制图像数据按照顺序进行组合得到照片文件。A photo file is obtained by combining at least one set of binary image data obtained after conversion in sequence. 6.一种终端设备,其特征在于,包括:6. A terminal device, comprising: 读取单元,用于获取到照片文件,所述照片文件中至少包括图像数据;a reading unit, configured to obtain a photo file, the photo file includes at least image data; 处理单元,用于依次从所述图像数据中读取M位图像数据,M为大于等于1的整数;基于所述M位图像数据在数据库中进行查询,基于查询结果进行处理操作;若查询结果为所述数据库中保存有相同的M位图像数据,则获取到所述M位图像数据的标识信息,并将所述标识信息保存至照片文件对应的压缩文件;若查询结果为所述数据库中未保存有相同的M位图像数据,则将所述M位图像数据添加到所述数据库中,生成所述M位图像数据的标识信息,将所述标识信息保存至照片文件对应的压缩文件;直至读取完所述照片文件的全部图像数据后,得到所述照片文件对应的压缩文件,并删除所述照片文件;a processing unit, configured to sequentially read M-bit image data from the image data, where M is an integer greater than or equal to 1; query the database based on the M-bit image data, and perform processing operations based on the query result; if the query result In order that the same M-bit image data is stored in the database, the identification information of the M-bit image data is obtained, and the identification information is saved to the compressed file corresponding to the photo file; if the query result is that in the database The same M-bit image data is not stored, then the M-bit image data is added to the database, the identification information of the M-bit image data is generated, and the identification information is saved to the compressed file corresponding to the photo file; After reading all the image data of the photo file, the compressed file corresponding to the photo file is obtained, and the photo file is deleted; 数据库,用于保存图像数据及其对应的标识信息。The database is used to save image data and its corresponding identification information. 7.根据权利要求6所述的终端设备,其特征在于,所述处理单元,用于将二进制的图像数据,转换为十六进制的N位图像数据,N为大于等于1的整数;从所述十六进制的N位图像数据中,依次读取M位图像数据。7. The terminal device according to claim 6, wherein the processing unit is used to convert binary image data into N-bit image data in hexadecimal, where N is an integer greater than or equal to 1; In the hexadecimal N-bit image data, M-bit image data is sequentially read. 8.根据权利要求6所述的终端设备,其特征在于,所述处理单元,用于建立所述照片文件对应的压缩文件,添加所述照片文件的描述信息至所述压缩文件;其中,所述照片文件中还包括:照片文件的描述信息。8. The terminal device according to claim 6, wherein the processing unit is configured to create a compressed file corresponding to the photo file, and add description information of the photo file to the compressed file; wherein, the The described photo file also includes: description information of the photo file. 9.根据权利要求6-8任一项所述的终端设备,其特征在于,所述处理单元,用于删除所述照片文件之后,获取到压缩文件;逐个读取所述压缩文件中的至少一个标识信息;基于所述至少一个标识信息,从所述数据库中提取所述至少一个标识信息对应的至少一组M位图像数据;将读取到的至少一组M位图像数据,按照顺序进行组合得到照片文件。9 . The terminal device according to claim 6 , wherein the processing unit is configured to obtain a compressed file after deleting the photo file; read at least one of the compressed files one by one. 10 . an identification information; based on the at least one identification information, extract at least one group of M-bit image data corresponding to the at least one identification information from the database; the read at least one group of M-bit image data, in order Combine to get photo files. 10.根据权利要求9所述的终端设备,其特征在于,所述处理单元,用于将所述至少一组十六进制的M位图像数据转换为至少一组二进制的图像数据;将转换后得到的至少一组二进制图像数据按照顺序进行组合得到照片文件。10. The terminal device according to claim 9, wherein the processing unit is configured to convert the at least one group of hexadecimal M-bit image data into at least one group of binary image data; The obtained at least one set of binary image data is combined in sequence to obtain a photo file.
CN201510920309.7A 2015-12-10 2015-12-10 Photo file processing method and terminal equipment Active CN106874285B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510920309.7A CN106874285B (en) 2015-12-10 2015-12-10 Photo file processing method and terminal equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510920309.7A CN106874285B (en) 2015-12-10 2015-12-10 Photo file processing method and terminal equipment

Publications (2)

Publication Number Publication Date
CN106874285A CN106874285A (en) 2017-06-20
CN106874285B true CN106874285B (en) 2020-06-30

Family

ID=59178134

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510920309.7A Active CN106874285B (en) 2015-12-10 2015-12-10 Photo file processing method and terminal equipment

Country Status (1)

Country Link
CN (1) CN106874285B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111787070B (en) * 2020-06-10 2022-07-12 俞力奇 Equipment end resource management method

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102663076A (en) * 2012-03-31 2012-09-12 福建榕基软件股份有限公司 Method for processing file data
CN103164433A (en) * 2011-12-13 2013-06-19 阿里巴巴集团控股有限公司 Image search method, device and server
CN106156070A (en) * 2015-03-31 2016-11-23 华为技术有限公司 A kind of querying method, Piece file mergence method and relevant apparatus

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8213728B2 (en) * 2008-06-16 2012-07-03 Taiwan Imagingtek Corporation Method and apparatus of image compression with output control
US8934144B2 (en) * 2013-02-28 2015-01-13 Ricoh Co. Ltd Overcoat processing mechanism

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103164433A (en) * 2011-12-13 2013-06-19 阿里巴巴集团控股有限公司 Image search method, device and server
CN102663076A (en) * 2012-03-31 2012-09-12 福建榕基软件股份有限公司 Method for processing file data
CN106156070A (en) * 2015-03-31 2016-11-23 华为技术有限公司 A kind of querying method, Piece file mergence method and relevant apparatus

Also Published As

Publication number Publication date
CN106874285A (en) 2017-06-20

Similar Documents

Publication Publication Date Title
CN102937926B (en) Method and device for recovering deleted sqlite files on mobile terminal
CN107493458A (en) A kind of method and system for accessing monitor video
WO2011155551A1 (en) File storage device, file storage method and program
CN106649721B (en) File duplicate removal method and device
CN111125034A (en) Aggregation object data processing method, system and related equipment
WO2015027882A1 (en) Method, apparatus and terminal for image processing
CN104639839A (en) Method and device for shooting
CN103631616B (en) Picture is quickly loaded and caching method and system
CN112152634B (en) Block compression coding method, device, computer equipment and readable storage medium
CN110597461B (en) Data storage method, device and equipment in block chain type account book
CN106874285B (en) Photo file processing method and terminal equipment
CN106909542A (en) The method and device of information erasing is carried out on the terminal device
CN105354510A (en) Naming method and naming system of photos
CN104424109B (en) Information processing method and electronic equipment
WO2020066607A1 (en) Image data storage device, image data storage method, and program
CN111832529A (en) Video to text conversion method, mobile terminal and computer-readable storage medium
US20250117426A1 (en) Two-dimensional code-based data processing method, apparatus, and system
CN110597462A (en) Data storage method, system, device and equipment in block chain type account book
CN108874891B (en) Method for facilitating reading of family cloud disk files
CN105704007A (en) Multimedia message sending method and system of terminal
CN109905715A (en) Code stream conversion method and system for inserting SEI data
US10037148B2 (en) Facilitating reverse reading of sequentially stored, variable-length data
CN105472086A (en) Contact feature information sending method, contact feature information sending device, receiving method and receiving device
CN115455464A (en) Image desensitization method, device, terminal equipment and computer-readable storage medium
CN103546670A (en) Image distribution system and methods

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