CN106776677B - File conversion method, device and file transmission system - Google Patents

File conversion method, device and file transmission system Download PDF

Info

Publication number
CN106776677B
CN106776677B CN201610942062.3A CN201610942062A CN106776677B CN 106776677 B CN106776677 B CN 106776677B CN 201610942062 A CN201610942062 A CN 201610942062A CN 106776677 B CN106776677 B CN 106776677B
Authority
CN
China
Prior art keywords
color
value
numerical value
tuple
file
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201610942062.3A
Other languages
Chinese (zh)
Other versions
CN106776677A (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.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen 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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201610942062.3A priority Critical patent/CN106776677B/en
Publication of CN106776677A publication Critical patent/CN106776677A/en
Application granted granted Critical
Publication of CN106776677B publication Critical patent/CN106776677B/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/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/178Techniques for file synchronisation in file systems
    • G06F16/1794Details of file format conversion
    • 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
    • G06F16/986Document structures and storage, e.g. HTML extensions

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)
  • Information Transfer Between Computers (AREA)
  • Document Processing Apparatus (AREA)

Abstract

The invention discloses a file conversion method, a file conversion device and a file transmission system, and belongs to the field of file compression. The file conversion method comprises the following steps: converting text contents in the target text file into a numerical value sequence in a preset character coding mode, wherein each numerical value in the numerical value sequence belongs to a preset color value range interval; dividing the numerical value sequence into a plurality of color n-tuple, wherein each color n-tuple comprises n adjacent numerical values in the numerical value sequence, each color n-tuple is used for indicating the color of one pixel point, and n is more than or equal to 3; and storing the target picture generated according to the color n-tuple, wherein each pixel point in the target picture is generated according to the color n-tuple. The invention realizes that a file compression scheme for converting text files into pictures is provided under the condition that the browser does not support a decompression algorithm, and achieves the compression effect similar to the conventional compression algorithm, thereby enriching the mode of reducing the data volume of the text files and ensuring that the browser can normally display the webpage content.

Description

File conversion method, device and file transmission system
Technical Field
The embodiment of the invention relates to the field of file compression, in particular to a file conversion method, a file conversion device and a file transmission system.
Background
In the process of displaying the web page, the browser needs to download a script text file and a Style text file corresponding to the web page from the server, such as a JavaScript (Java script) text file and a CSS (Cascading Style Sheets) text file. By parsing the text files, the browser controls the logic and display style in the web page.
In order to improve the transmission rate of the text file and accelerate the webpage display speed, a compression algorithm is required to compress the text file before the server sends the text file to the browser, and the compressed text file is transmitted to the browser, so that the transmitted data volume is reduced; correspondingly, the browser decompresses the received text file by adopting a decompression algorithm and analyzes the decompressed text file, so that the webpage is controlled to be displayed according to the analysis result. In the prior art, a server usually compresses a text file by adopting a gzip compression algorithm, and a browser decompresses the compressed text file by adopting a gunzip decompression algorithm.
In the process of implementing the embodiment of the invention, the inventor finds that the technology at least has the following problems:
in the prior art, a compression algorithm is used for compressing a text file, so that the data volume of the text file is reduced, and the way of reducing the data volume of the text file is single; and the browser can display the webpage according to the decompressed text file only after the compressed text file is decompressed by adopting a corresponding decompression algorithm.
Disclosure of Invention
In order to solve the problems that the mode of reducing the data volume of a text file is single in the prior art, and a browser can display a webpage according to a decompressed text file only after the compressed text file is decompressed by adopting a corresponding decompression algorithm, the embodiment of the invention provides a file conversion method, a file conversion device and a file transmission system. The technical scheme is as follows:
according to a first aspect of an embodiment of the present invention, there is provided a file conversion method, including:
converting text contents in the target text file into a numerical value sequence in a preset character coding mode, wherein each numerical value in the numerical value sequence belongs to a preset color value range interval;
dividing the numerical value sequence into a plurality of color n-tuple, wherein the color n-tuple comprises n adjacent numerical values in the numerical value sequence, each color n-tuple is used for indicating the color of one pixel point, n is more than or equal to 3, and n is an integer;
and storing the target picture generated according to the color n-tuple, wherein each pixel point in the target picture is generated according to the color n-tuple.
According to a second aspect of the embodiments of the present invention, there is provided a file conversion method, including:
reading color n-tuple corresponding to each pixel point in the target picture one by one, wherein each color n-tuple comprises n numerical values for indicating the color of one pixel point, n is more than or equal to 3, and n is an integer;
splicing numerical values contained in the color n-tuple to generate a numerical value sequence, wherein each numerical value in the numerical value sequence belongs to a preset color value range interval;
converting the numerical value sequence into text content in a preset character decoding mode;
and generating a target text file corresponding to the target picture according to the text content.
According to a third aspect of embodiments of the present invention, there is provided a file converting apparatus including:
the first conversion module is used for converting text contents in the target text file into a numerical value sequence in a preset character coding mode, and each numerical value in the numerical value sequence belongs to a preset color value range interval;
the dividing module is used for dividing the numerical value sequence into a plurality of color n-tuple, wherein the color n-tuple comprises n adjacent numerical values in the numerical value sequence, each color n-tuple is used for indicating the color of one pixel point, n is more than or equal to 3, and n is an integer;
the first generation module is used for storing a target picture generated according to the color n-tuple, and each pixel point in the target picture is generated according to the color n-tuple.
According to a fourth aspect of the embodiments of the present invention, there is provided a file converting apparatus including:
the reading module is used for reading color n-tuple corresponding to each pixel point in the target picture one by one, each color n-tuple comprises n numerical values and is used for indicating the color of one pixel point, n is more than or equal to 3, and n is an integer;
the splicing module is used for splicing numerical values contained in the color n-tuple to generate a numerical value sequence, and each numerical value in the numerical value sequence belongs to a preset color value range interval;
the second conversion module is used for converting the numerical value sequence into text content in a preset character decoding mode;
and the second generation module is used for generating a target text file corresponding to the target picture according to the text content.
According to a fifth aspect of embodiments of the present invention, there is provided a file transfer system, the apparatus including: a server and a terminal;
the server comprises the file conversion device according to the third aspect;
the terminal comprises the file conversion device according to the fourth aspect;
the server is used for converting the target text file into a target picture in advance and transmitting the target picture corresponding to the target text file to the terminal when the terminal requests to acquire the target text file;
the terminal is used for converting the received target picture into a target text file.
The technical scheme provided by the embodiment of the invention has the following beneficial effects:
converting text content into a numerical value sequence by utilizing a character coding mode, dividing the numerical value sequence into different color n-tuples by a numerical value combination mode, generating pixel points according to the color n-tuples obtained by division, and further generating pictures according to the pixel points, thereby realizing the conversion from a text file to a picture file; under the condition that the browser does not support a decompression algorithm, a file compression scheme for converting text files into pictures is provided, and a compression effect similar to that of the conventional compression algorithm is achieved, so that the mode of reducing the data volume of the text files is enriched, and the browser can normally display the webpage content according to the converted pictures.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
FIG. 1 is a schematic diagram of a file transfer system provided by one embodiment of the present invention;
FIG. 2 is a flow chart illustrating a file conversion method provided by an embodiment of the invention;
FIG. 3A is a flowchart illustrating a file conversion method according to another embodiment of the invention;
FIGS. 3B and 3C are schematic diagrams of an implementation of the file conversion method shown in FIG. 3A;
FIG. 4 is a flow chart illustrating a file conversion method according to a further embodiment of the present invention;
FIG. 5A is a flowchart of a file conversion method according to another embodiment of the invention;
FIG. 5B is a schematic diagram of an implementation of the file conversion method shown in FIG. 5A;
FIG. 6 is a flow chart illustrating a file conversion method provided by yet another embodiment of the present invention;
fig. 7 is a block diagram showing a configuration of a text conversion apparatus according to an embodiment of the present invention;
FIG. 8 is a block diagram illustrating the architecture of a server provided by an embodiment of the present invention;
fig. 9 is a block diagram showing a configuration of a text conversion apparatus according to another embodiment of the present invention;
fig. 10 is a schematic structural diagram of a terminal according to an embodiment of the present invention;
fig. 11 is a block diagram showing a structure of a text transmission system according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, embodiments of the present invention will be described in detail with reference to the accompanying drawings.
Reference herein to "a plurality" means two or more. "and/or" describes the association relationship of the associated objects, meaning that there may be three relationships, e.g., a and/or B, which may mean: a exists alone, A and B exist simultaneously, and B exists alone. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship.
For convenience of understanding, terms referred to in the embodiments of the present invention are explained below.
Color mode: one way to record the color of an image is to record a color, usually in numerical form. Common color patterns include an RGB (Red-Green-Blue ) pattern, an RGBA (Red-Green-Blue-Alpha, Red-Green-Blue-Alpha channel) pattern, a CMYK (Cyan-Magenta-Yellow-black) pattern, and the like. In the RGB mode, the color is represented by RGB triplets consisting of a red color value, a green color value, and a blue color value, and each value in the RGB triplets is within a range of specified color values, which is usually 0 to 255. Similar to the RGB mode, in the RGBA mode, the color is represented by RGBA quadruplets consisting of a red color value, a green color value, a blue color value and a transparency value, and each numerical value in the RGBA quadruplets is within a specified color value range, which is usually 0 to 255.
Character encoding: refers to a process of encoding each character in a set of characters as an object in a specified set, which may be a specified set of characters or a specified set of numbers. Common character encoding schemes include URI (uniform resource Identifier) encoding, Unicode encoding, or UTF-8(8-bit Unicode Transformation Format) and ASCII (American standard code for Information exchange) encoding. For example, ASCII encoding is a method for encoding characters into a value within a set of specified values (usually 0-127), for example, character a is encoded into value 97 and character + is encoded into value 43.
Character decoding: and the method is used for reducing the content subjected to character coding into the characters before coding, as opposed to character coding.
Referring to fig. 1, a schematic diagram of a file transfer system according to an embodiment of the invention is shown. The file transfer system includes a server 110 and a terminal 120.
The server 110 is a web server corresponding to a web site, and provides a web browsing function to a terminal accessing the web site. The server 110 may be a single server, or may be a server cluster or a cloud computing center composed of a plurality of servers.
The server 110 stores web page resources, script text files (such as JavaScript files), and style text files (such as CSS files) corresponding to the respective web pages. The webpage resources comprise picture resources, character resources, audio resources, video resources and the like displayed in the webpage, the script program text file is used for controlling skip and display logic in the webpage, and the style text file is used for controlling layout and display style of the webpage resources in the webpage. In the embodiment of the present invention, the server 110 converts the script program text file and the style text file corresponding to the web page into the picture file in advance, and transmits the picture files corresponding to the script program text file and the style text file to the terminal 120 when the terminal 120 requests to acquire the script program text file and the style text file corresponding to the web page.
The terminal 120 is an electronic device having a web page display function, which can be realized by a web browser or an application having a web page browsing function. The terminal 120 may be a smart phone, a tablet computer, a portable personal computer, or the like.
When the terminal 120 needs to display a web page, it sends a corresponding web page obtaining request to the server 110 to obtain a web page resource, a script program text file and a style text file corresponding to the web page, and renders and displays the web page according to the obtained content. In the embodiment of the present invention, the terminal 120 restores the image file acquired from the server 110 to the corresponding script program text file and the style text file, and controls the web page logic and the display style according to the restored script program text file and the style text file.
The following description will be made of a process of converting a text file into a picture file using an exemplary embodiment.
Referring to fig. 2, a flowchart of a file conversion method according to an embodiment of the present invention is shown, where the file conversion method is described as an example of being used in the server 110 shown in fig. 1, and the method includes:
step 201, converting the text content in the target text file into a numerical value sequence in a predetermined character coding mode, wherein each numerical value in the numerical value sequence belongs to a predetermined color value range interval.
Wherein, the text content in the target text file includes various types of characters, such as numbers, letters, symbols, and the like. After the text content is coded by a preset character coding mode, characters in the text content are all converted into corresponding numerical values. For example, by ASCII encoding, the letter a in the text content is converted to a value 97, the symbol-is converted to a value 45, and the number 1 is converted to a value 49.
In the numerical value sequence obtained by converting the text content, each numerical value belongs to a predetermined color value range interval, optionally, the predetermined color value range interval is 0 to 255, that is, each numerical value in the numerical value sequence obtained by converting is greater than or equal to 0 and less than or equal to 255.
Step 202, dividing the numerical value sequence into a plurality of color n-tuple, wherein each color n-tuple comprises n adjacent numerical values in the numerical value sequence, each color n-tuple is used for indicating the color of one pixel point, n is greater than or equal to 3, and n is an integer.
Optionally, the server divides the adjacent n values into n tuples of the same color from the head of the value sequence until the end of the value sequence is reached.
Optionally, the color n-tuple is a color triplet or a color quadruplet, and each color triplet or color quadruplet is used to indicate a color of one pixel point.
And step 203, storing the target picture generated according to the color n-tuple, wherein each pixel point in the target picture is generated according to the color n-tuple.
Optionally, corresponding pixel points are generated according to the n-tuple of each color, and the generated pixel points are spliced, so that a target picture corresponding to the target text file can be obtained.
And the data volume of the stored target picture is less than that of the target text file. Optionally, the target picture is stored in a lossless compression format, that is, the target picture is subjected to lossless compression in the generation process, so that the data amount of the target picture is reduced, and data loss or loss is avoided. For example, the target picture is a PNG (Portable network graphics Format) picture or a TIFF (Tag Image File Format) picture.
In summary, in the embodiment, text content is converted into a numerical sequence by using a character encoding mode, and the numerical sequence is divided into different color n-tuples by using a numerical combination mode, so that pixel points are generated according to the color n-tuples obtained by division, and further, a picture is generated according to the pixel points, thereby realizing conversion from a text file to a picture file; under the condition that the browser does not support a decompression algorithm, a file compression scheme for converting text files into pictures is provided, and a compression effect similar to that of the conventional compression algorithm is achieved, so that the mode of reducing the data volume of the text files is enriched, and the browser can normally display the webpage content according to the converted pictures.
In a possible implementation manner, the server may convert the text content of the target text file into a character string, and further convert the converted character string into a numerical sequence, so as to generate the target picture according to the color n-tuple divided by the numerical sequence, which is described below with an exemplary embodiment.
Referring to fig. 3A, a flowchart of a file conversion method according to another embodiment of the present invention is shown, where the file conversion method is described as an example of being used in the server 110 shown in fig. 1, and the method includes:
step 301, converting the text content of the target text file into a character string by a first character encoding mode, wherein the first character encoding mode includes any one of URI encoding, Unicode encoding or UTF-8 encoding.
The text content of the target text file contains a large number of characters, including chinese characters, english characters, numbers, symbols, and the like. Since some of the characters cannot be directly recognized (for example, chinese characters), in the early stage of conversion, the server needs to convert the text content into a character string capable of being directly recognized by the first character encoding method, where the converted character string includes directly recognized numbers, english letters, and symbols.
Optionally, when the text content is converted into a character string, the server may perform character encoding on the text content by using any one of URI encoding, Unicode encoding, or UTF-8 encoding. For convenience of description, in the following embodiments, the first character encoding mode is exemplified as URI encoding.
For example, as shown in fig. 3B, after the server obtains that the text content 31 included in the target text file is "ab sample file cd", and character-encodes the text content by using URI coding, the obtained character string 32 is "ab% E6% a 0% B7% E6% 9C% AC% E6% 96% 87% E4% BB% B6 cd", wherein "a" in the character string is obtained by encoding "a" in the text content, "B" in the character string is obtained by encoding "B" in the text content, "% E6% a 0% B7" in the character string is obtained by encoding "sample" in the text content, "% E6% 9C% AC" in the character string is obtained by encoding "this" in the text content, "% E6% 96% 87" in the character string is obtained by encoding "text" in the text content, "E4% B6" in the character string is obtained by encoding "BB" in the text content, the "c" in the character string is encoded by the "c" in the text content, and the "d" in the character string is encoded by the "d" in the text content.
Step 302, each character in the character string is converted into a corresponding numerical value by a second character encoding mode, wherein the second character encoding mode is ASCII encoding or custom encoding.
Further, for the converted character string, the server encodes each character in the character string by a second character encoding mode to obtain a numerical value corresponding to each character. The second character encoding mode is used for encoding characters into corresponding numerical values.
In the subsequent process, the converted numerical value is used as the color value in the color n-tuple, so that the converted numerical value needs to belong to the corresponding color value range interval.
Optionally, when the color of the pixel point is represented by the color n-tuple, each numerical value in the color n-tuple belongs to a range from 0 to 255, and therefore, each character needs to be encoded into a numerical value in the range from 0 to 255 in the second character encoding mode used by the server.
In one possible implementation, the server may encode the string using ASCII encoding, encoding each character in the string to a numerical value in the interval 0 to 127 (or 0 to 255);
in other possible embodiments, the server may further encode the character string according to a custom encoding manner, and ensure that each encoded numerical value belongs to a predetermined color value interval (e.g., 0 to 255).
For convenience of description, in the following embodiments, the second character encoding mode is schematically described as ASCII encoding.
For example, the server encodes the character "a" in the character string as the numerical value "97", encodes the character "%" in the character string as the numerical value "37", and encodes the character "a" in the character string as the numerical value "65" by ASCII encoding.
Step 303, generating a numerical sequence according to each numerical value obtained by conversion.
Further, the server generates a numerical value sequence corresponding to the character string according to each numerical value obtained by conversion, wherein characters in the character string correspond to numerical values in the numerical value sequence one to one.
For example, as shown in fig. 3B, the server ASCII encodes the string 32 to obtain a corresponding numerical sequence 33.
And 304, dividing every n adjacent numerical values in the numerical value sequence into a color n-tuple, wherein n is more than or equal to 3, and n is an integer.
After the numerical value sequence is generated according to the character string, the server divides the numerical value sequence into a plurality of color n-tuple according to the color mode adopted by the target picture, and therefore pixel points generated by the color n-tuple form the target picture.
In a possible implementation manner, when the color mode adopted by the target picture is the RGB mode, the server divides every three adjacent numerical values in the numerical value sequence into one color triple, where three numerical values in the color triple are respectively used for indicating a red color value, a green color value, and a blue color value of a pixel point in the target picture.
For example, as shown in fig. 3C, the server divides three consecutive values into color triples starting from the head of the value sequence. The color triples (97,98,37) represent that the red color value of the pixel point is 97, the green color value is 98, and the blue color value is 37.
In another possible implementation manner, when the color mode adopted by the target picture is the RGBA mode, the server divides every four adjacent numerical values in the numerical value sequence into a color quadruple, where four numerical values in the color quadruple are respectively used for indicating a red color value, a green color value, a blue color value and a transparency value of a pixel point in the target picture.
And 305, when the number of numerical values in the divided color n-tuple is less than n, filling the color n-tuple with a preset numerical value, wherein the preset numerical value belongs to a preset color value range interval, and the preset numerical value is different from each numerical value in the numerical value sequence.
When the value sequence is divided to the end of the value sequence, the number of the values in the tail color n-tuple may be less than n, and in order to ensure that the pixel point can be normally generated according to the tail color n-tuple, when the number of the values in the divided color n-tuple is less than n, the server fills the color n-tuple with a preset value, so that the number of the values in the color n-tuple reaches n.
Alternatively, when the numerical value sequence is obtained by ASCII code conversion, the server may fill the numerical value in the interval of 128 to 255 as a preset numerical value since the numerical value range of ASCII code is 0 to 127 and the range of the color value in RGB mode is 0 to 255.
For example, as shown in fig. 3C, when the color is divided to the end of the value sequence, the end color triple only contains the value "100", and the server fills the end color triple with the preset value "255".
Step 306, storing the target picture generated according to the color n-tuple, wherein each pixel point in the target picture is generated according to the color n-tuple.
And the server generates corresponding pixel points according to the n-tuple of each color, and splices the generated pixel points to obtain a target picture corresponding to the target text file.
For example, as shown in fig. 3B, the server generates a pixel 341 according to the color triplet (97,98,37), and generates a pixel 342 according to the color triplet (69,54, 37); and generating the target picture 34 by splicing the generated pixel points.
It should be noted that, in the process of generating and storing the target picture, the target picture is subjected to lossless compression, so that on the premise of ensuring no data loss, the data amount of the target picture is reduced, and a compression effect similar to that of the existing compression algorithm is achieved.
In the specific implementation process, the data size of a typical JavaScript file zepto.min.js as a text file is 25.7kb, and after the conversion by the file conversion method, the data size of the JavaScript file zepto.min.js as an image is 9.88kb, and the data size is reduced to 38.44% of the original data size, which is very close to the compression ratio of the existing gzip compression algorithm.
Further, the server stores the target text file and the target image obtained through conversion in a correlation mode, and sends the image corresponding to the requested text file to the terminal for conversion and use by the terminal when receiving a text acquisition request sent by the terminal.
Through the above steps 301 to 306, the server converts the text file into a corresponding picture file. When the terminal requests to acquire the text file, the server transmits the picture file corresponding to the text file to the terminal, and the terminal converts the picture file into the text file again and uses the text file. The following description will be made of a process of converting a picture file into a text file using an exemplary embodiment.
Referring to fig. 4, a flowchart of a file conversion method according to another embodiment of the present invention is shown, where the file conversion method is used for the terminal 120 shown in fig. 1 for example, and the method includes:
step 401, reading color n tuples corresponding to each pixel point in the target picture one by one, wherein each color n tuple comprises n numerical values for indicating the color of one pixel point, n is greater than or equal to 3, and n is an integer.
Optionally, when the color mode adopted by the target picture is the RGB mode, the terminal reads the color triples of each pixel point one by one, where the color triples are used to indicate the red color value, the green color value, and the blue color value of the pixel point;
optionally, when the color mode adopted by the target picture is the RGBA mode, the terminal reads the color quadruple of each pixel point one by one, and the color quadruple is used for indicating the red color value, the green color value, the blue color value and the transparency value of the pixel point.
And step 402, splicing the numerical values contained in the color n-tuple to generate a numerical value sequence, wherein each numerical value in the numerical value sequence belongs to a preset color value range interval.
And the terminal splices the numerical values in the read color n-tuple according to the reading sequence of the color n-tuple to obtain a corresponding numerical value sequence.
Optionally, each value in the value sequence belongs to a value interval from 0 to 225.
Step 403, converting the numerical value sequence into text content by a predetermined character decoding mode.
As a reverse process of step 201 in fig. 2, optionally, the terminal converts the numeric value sequence into a corresponding character string by using a predetermined character decoding manner, and converts the character string into a text content, where the text content includes a part of characters (such as chinese characters) that cannot be directly recognized.
And step 404, generating a target text file corresponding to the target picture according to the text content.
Further, the terminal generates a corresponding target text file according to the text content obtained by conversion, and conversion from the target picture to the target text file is achieved. And the data volume of the target text file is larger than that of the target picture.
Referring to fig. 5A, a flowchart of a file conversion method according to another embodiment of the present invention is shown, where the file conversion method is used for the terminal 120 shown in fig. 1 for example, and the method includes:
step 501, reading color n tuples corresponding to each pixel point in a target picture one by one, wherein each color n tuple comprises n numerical values used for indicating the color of one pixel point, n is not less than 3, and n is an integer.
After receiving a target picture transmitted by a server, a terminal acquires a color n-tuple corresponding to each pixel point in the target picture, wherein the color n-tuple is used for indicating the color of the pixel point.
In a possible implementation manner, when the color mode adopted by the target picture is the RGB mode, the terminal acquires the color triples corresponding to each pixel point one by one, and three numerical values in the color triples are respectively used for indicating the red color value, the green color value and the blue color value of the pixel point.
For example, as shown in fig. 5B, after the terminal acquires the target picture 51, the terminal reads the color triplet (97,98,37) of the pixel point 511, and further reads the color triplet (69,54,37) of the next pixel point 512.
In another possible implementation manner, when the color mode adopted by the target picture is the RGBA mode, the terminal acquires the color quadruple corresponding to each pixel point one by one, and four numerical values in the color quadruple are respectively used for indicating the red color value, the green color value, the blue color value and the transparency value of the pixel point.
Step 502, the numerical values included in the color n-tuple are spliced to generate a numerical value sequence, and each numerical value in the numerical value sequence belongs to a preset color value range interval.
And for each read color n-tuple, the terminal splices the numerical values contained in each color n-tuple to generate a corresponding numerical value sequence.
For example, as shown in fig. 5B, the terminal concatenates the values included in each read color triplet, and generates a value sequence 52.
Step 503, detecting whether the end of the value sequence contains a predetermined value, where the predetermined value is used to fill the color n-tuple when the number of values in the color n-tuple is less than n.
Since the color n-tuple corresponding to the pixel point at the end of the target picture may include (at the target picture generation stage) the filled predetermined numerical value, and the filled predetermined numerical value is invalid data, in order to avoid the influence of the predetermined numerical value on the text content restoration process, after the terminal generates the numerical value sequence, it is necessary to detect whether the end of the numerical value sequence includes the filled predetermined numerical value.
For example, as shown in fig. 5B, if the server fills the color n-tuple with a predetermined value 255 in the stage of generating the target picture, the terminal detects whether the end of the value sequence 52 generated from the target picture contains the predetermined value 255.
Step 504, when the end of the value sequence contains the predetermined value, deleting the predetermined value.
And when detecting that the tail of the numerical value sequence contains the preset numerical value, the terminal deletes the preset numerical value to obtain the corrected numerical value sequence.
For example, as shown in fig. 5B, when the terminal detects that the end of the numerical value sequence 52 includes the predetermined numerical value 255 (the numerical value in the dashed line frame), the terminal deletes the predetermined numerical value 255.
Step 505, each numerical value in the numerical value sequence is converted into a corresponding character through a first character decoding mode, wherein the first character decoding mode is ASCII decoding or custom decoding.
As a reverse process of the step 302, after the terminal acquires the numerical value sequence, each numerical value in the numerical value sequence is converted into a corresponding character through a first character decoding mode corresponding to the second character encoding mode.
For example, as shown in fig. 5B, when the second character encoding mode is ASCII encoding, the terminal converts each numerical value in the numerical value sequence 52 into a corresponding character by corresponding ASCII decoding.
Step 506, generating a character string according to the converted character.
And after the terminal decodes and converts the numerical values in the numerical value sequence one by one, generating a character string corresponding to the numerical value sequence according to the characters obtained by conversion. And the characters in the character string correspond to the numerical values in the numerical value sequence one by one.
For example, as shown in fig. 5B, the numerical value sequence 52 is ASCII decoded to obtain a corresponding character string 53.
Step 507, converting the character string into text content by a second character decoding mode, wherein the second character decoding mode comprises any one of URI decoding, Unicode decoding or UTF-8 decoding.
As a reverse process of step 301, after the terminal obtains the character string through the numeric sequence conversion, the terminal converts the character string into the text content through a second character decoding method opposite to the first character encoding method.
For example, as shown in fig. 5B, when the first character encoding mode is URI encoding, the terminal converts the character string 53 into corresponding text content 54 by corresponding URI decoding.
And step 508, generating a target text file corresponding to the target picture according to the text content.
And the terminal generates a corresponding target text file according to the text content obtained by conversion, so that the conversion from the target picture to the target text file is realized.
Further, when the target file is a script text file or a style text file of the webpage, the terminal can control the logic or display style of the webpage according to the target file.
Referring to fig. 6, a flowchart of a file conversion method according to another embodiment of the present invention is shown, where the file conversion method is used in the file transmission system shown in fig. 1 for illustration, and the method includes:
step 601, the server converts the text file into a picture in advance and stores the picture.
The server converts each text file into a picture by the file conversion method shown in fig. 3A, and stores the text file and the picture in association with each other. The corresponding relation between the text file and the picture is shown in the table I.
Watch 1
Text file Picture frame
File1.js File1.png
File2.js File2.png
File3.js File3.png
Step 602, the terminal sends a text acquisition request to the server, where the text acquisition request includes a text file identifier.
When the terminal needs to acquire the text file corresponding to the webpage, a corresponding text acquisition request is sent to the server, and the text acquisition request comprises a text file identifier.
For example, the terminal sends a text acquisition request to the server, where the text acquisition request includes a text file identifier file.
Step 603, the server receives a text acquisition request sent by the terminal.
Step 604, the server searches for a picture corresponding to the text file indicated by the text identifier according to the text file identifier included in the text acquisition request.
And after the server receives the text acquisition request, the server knows that the terminal needs to acquire the corresponding text file. Because the server converts the text file into the picture in advance, the server searches the picture corresponding to the text file indicated by the text identification according to the text file identification.
Compared with the prior art, the server searches the corresponding text file according to the text acquisition request sent by the terminal and dynamically compresses the searched text file, in the embodiment, the text file is converted into the picture in advance, the server can directly send the picture corresponding to the text file to the terminal, the dynamic compression of the text file is not needed, and therefore the processing pressure of the server is obviously reduced under the condition of large access amount.
Step 605, the server sends the searched picture to the terminal.
And step 606, the terminal receives the picture sent by the server.
In step 607, the terminal converts the picture into a corresponding text file.
The server converts the acquired picture into a text file by using the file conversion method shown in fig. 4, and controls the web page logic and/or the display style by using the text file.
In the embodiment, the server converts the text file into the picture with smaller data volume in advance, and sends the picture corresponding to the text file to the terminal when the terminal requests to acquire the text file, so that the transmitted data volume is reduced; in addition, the server does not need to dynamically compress the searched text file, and the real-time processing pressure of the server is further reduced.
The following are embodiments of the apparatus of the present invention, and for details not described in detail in the embodiments of the apparatus, reference may be made to the above-mentioned one-to-one corresponding method embodiments.
Referring to fig. 7, a block diagram of a text conversion apparatus according to an embodiment of the present invention is shown. The text conversion means is implemented by hardware or a combination of hardware and software as all or part of the server 110 in fig. 1. The text conversion apparatus includes: a first conversion module 710, a dividing module 720 and a first generation module 730;
a first conversion module 710, configured to implement the function of step 201;
a dividing module 720, configured to implement the function of step 202;
a first generating module 730 for implementing the functions of the above steps 203 or 306.
Optionally, the first conversion module 710 includes: a first conversion unit, a second conversion unit and a first generation unit;
a first conversion unit, configured to implement the function of step 301;
a second conversion unit, configured to implement the function of step 302;
a first generating unit, configured to implement the function of step 303.
Optionally, the dividing module 720 includes: the device comprises a first dividing unit, a first filling unit, a second dividing unit and a second filling unit;
a first dividing unit and a second dividing unit, configured to implement the function of step 304;
a first filling unit and a second filling unit for implementing the function of step 305;
optionally, the target picture is in a lossless compression format, and the target picture is a portable network graphics format PNG picture or a tag image file format TIFF picture.
Referring to fig. 8, a block diagram of a server according to an embodiment of the present invention is shown. The server 800 is implemented as the server 110 in fig. 1. Specifically, the method comprises the following steps:
the server 800 includes a Central Processing Unit (CPU)801, a system memory 804 including a Random Access Memory (RAM)802 and a Read Only Memory (ROM)803, and a system bus 805 connecting the system memory 804 and the central processing unit 801. The server 800 also includes a basic input/output system (I/O system) 806, which facilitates transfer of information between devices within the computer, and a mass storage device 807 for storing an operating system 813, application programs 814, and other program modules 815.
The basic input/output system 806 includes a display 808 for displaying information and an input device 809 such as a mouse, keyboard, etc. for user input of information. Wherein the display 808 and the input device 809 are connected to the central processing unit 801 through an input output controller 810 connected to the system bus 805. The basic input/output system 806 may also include an input/output controller 810 for receiving and processing input from a number of other devices, such as a keyboard, mouse, or electronic stylus. Similarly, input-output controller 810 also provides output to a display screen, a printer, or other type of output device.
The mass storage device 807 is connected to the central processing unit 801 through a mass storage controller (not shown) connected to the system bus 805. The mass storage device 807 and its associated computer-readable media provide non-volatile storage for the server 800. That is, the mass storage device 807 may include a computer-readable medium (not shown) such as a hard disk or CD-ROM drive.
Without loss of generality, the computer-readable media may comprise computer storage media and communication media. Computer storage media includes volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data. Computer storage media includes RAM, ROM, EPROM, EEPROM, flash memory or other solid state memory technology, CD-ROM, DVD, or other optical storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices. Of course, those skilled in the art will appreciate that the computer storage media is not limited to the foregoing. The system memory 804 and mass storage 807 described above may be collectively referred to as memory.
The server 800 may also operate as a remote computer connected to a network via a network, such as the internet, in accordance with various embodiments of the invention. That is, the server 800 may be connected to the network 812 through the network interface unit 811 coupled to the system bus 805, or may be connected to other types of networks or remote computer systems (not shown) using the network interface unit 811.
The memory also includes one or more programs, which are stored in the memory, and the one or more programs include instructions for performing the server-side file conversion method provided by the embodiment of the present invention.
Referring to fig. 9, a block diagram of a text conversion apparatus according to another embodiment of the present invention is shown. The text conversion means is implemented by hardware or a combination of hardware and software as all or a part of the terminal 120 in fig. 1. The text conversion apparatus includes: a reading module 910, a splicing module 920, a second converting module 930, and a second generating module 940;
a reading module 910, configured to implement the functions of the foregoing steps 401 or 501;
a splicing module 920, configured to implement the functions of the foregoing steps 402 or 502;
a second converting module 930, configured to implement the function of step 403;
a second generating module 940, configured to implement the functions of the foregoing steps 404 or 508.
Optionally, the apparatus includes: a detection module and a deletion module;
a detection module, configured to implement the function of step 503;
and a deleting module for implementing the function of the step 504.
Optionally, the second converting module 930 includes: a third conversion unit, a second generation unit and a fourth conversion unit;
a third conversion unit, configured to implement the function of step 505;
a second generating unit, configured to implement the function of step 506;
a fourth conversion unit, configured to implement the function in step 507.
Optionally, the color n-tuple is a color triplet, and three numerical values in the color triplet are respectively used for indicating a red color value, a green color value and a blue color value of the pixel point;
or the like, or, alternatively,
the color n-tuple is a color quadruple, and four numerical values in the color quadruple are respectively used for indicating a red color value, a green color value, a blue color value and a transparency value of the pixel point.
Optionally, the target picture is in a lossless compression format, and the target picture is a portable network graphics format PNG picture or a tag image file format TIFF picture.
Referring to fig. 10, a schematic structural diagram of a terminal according to an embodiment of the present invention is shown. The terminal 1000 is the terminal 120 of fig. 1. Specifically, the method comprises the following steps:
terminal 1000 can include RF (Radio Frequency) circuitry 1010, memory 1020 including one or more computer-readable storage media, input unit 1030, display unit 1040, sensors 1050, audio circuitry 1060, near field communication module 1070, processor 1080 including one or more processing cores, and power supply 1090. Those skilled in the art will appreciate that the terminal structure shown in fig. 10 is not intended to be limiting and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components. Wherein:
RF circuit 1010 may be used for receiving and transmitting signals during a message transmission or communication process, and in particular, for receiving downlink information from a base station and then processing the received downlink information by one or more processors 1080; in addition, data relating to uplink is transmitted to the base station. In general, RF circuitry 1010 includes, but is not limited to, an antenna, at least one Amplifier, a tuner, one or more oscillators, a Subscriber Identity Module (SIM) card, a transceiver, a coupler, an LNA (Low Noise Amplifier), a duplexer, and the like. In addition, the RF circuitry 1010 may also communicate with networks and other devices via wireless communications. The wireless communication may use any communication standard or protocol, including but not limited to GSM (Global System for Mobile communications), GPRS (General Packet Radio Service), CDMA (Code Division Multiple Access), WCDMA (Wideband Code Division Multiple Access), LTE (Long Term Evolution), e-mail, SMS (Short Messaging Service), and the like.
The memory 1020 may be used to store software programs and modules, and the processor 1080 executes various functional applications and data processing by operating the software programs and modules stored in the memory 1020. The memory 1020 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data (such as audio data, a phonebook, etc.) created according to the use of the terminal 1000, and the like. Further, the memory 1020 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device. Accordingly, memory 1020 may also include a memory controller to provide access to memory 1020 by processor 1080 and input unit 1030.
The input unit 1030 may be used to receive input numeric or character information and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control. Specifically, the input unit 1030 may include an image input device 1031 and other input devices 1032. The image input device 1031 may be a camera or a photoelectric scanning device. The input unit 1030 may include other input devices 1032 in addition to the image input device 1031. In particular, other input devices 1032 may include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a track ball, a mouse, a joystick, or the like.
Display unit 1040 can be used to display information entered by or provided to a user as well as various graphical user interfaces of terminal 1000, which can be comprised of graphics, text, icons, video, and any combination thereof. The Display unit 1040 may include a Display panel 1041, and optionally, the Display panel 1041 may be configured in the form of an LCD (Liquid Crystal Display), an OLED (Organic Light-Emitting Diode), or the like.
Terminal 1000 can also include at least one sensor 1050, such as a light sensor, motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor that adjusts the brightness of the display panel 1041 according to the brightness of ambient light, and a proximity sensor that turns off the display panel 1041 and/or a backlight when the terminal 1000 moves to the ear. As one of the motion sensors, the gravity acceleration sensor can detect the magnitude of acceleration in each direction (generally, three axes), can detect the magnitude and direction of gravity when the mobile phone is stationary, and can be used for applications of recognizing the posture of the mobile phone (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer and tapping), and the like; other sensors such as a gyroscope, a barometer, a hygrometer, a thermometer, and an infrared sensor that can be configured for terminal 1000 are not described herein.
Audio circuitry 1060, speaker 1061, and microphone 1062 can provide an audio interface between a user and terminal 1000. The audio circuit 1060 can transmit the electrical signal converted from the received audio data to the speaker 1061, and the electrical signal is converted into a sound signal by the speaker 1061 and output; on the other hand, the microphone 1062 converts the collected sound signals into electrical signals, which are received by the audio circuit 1060 and converted into audio data, which are then processed by the audio data output processor 1080 and then transmitted to, for example, another electronic device via the RF circuit 1010, or output to the memory 1020 for further processing. Audio circuitry 1060 may also include an earbud jack to provide communication of peripheral headphones with terminal 1000.
Terminal 1000 can establish a near field communication connection with an external device via near field communication module 1070 and can exchange data via the near field communication connection. In this embodiment, the near field communication module 1070 specifically includes a bluetooth module and/or a WiFi module.
Processor 1080 is the control center for terminal 1000, and is coupled to various components of the overall handset using various interfaces and lines to perform various functions and process data of terminal 1000 by running or executing software programs and/or modules stored in memory 1020 and invoking data stored in memory 1020, thereby providing overall monitoring of the handset. Optionally, processor 1080 may include one or more processing cores; preferably, the processor 1080 may integrate an application processor, which handles primarily the operating system, user interfaces, applications, etc., and a modem processor, which handles primarily the wireless communications. It is to be appreciated that the modem processor described above may not be integrated into processor 1080.
Terminal 1000 can also include a power supply 1090 (e.g., a battery) for powering the various components, which can preferably be logically coupled to processor 1080 via a power management system that can facilitate managing charging, discharging, and power consumption via the power management system. Power supply 1090 may also include any component including one or more DC or AC power sources, recharging systems, power failure detection circuitry, power converters or inverters, power status indicators, and the like.
Although not shown, terminal 1000 can also include a Bluetooth module or the like, which is not described in detail herein.
In this embodiment, the terminal 1000 further includes a memory and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by one or more processors to implement the file conversion method.
It will be understood by those skilled in the art that all or part of the steps in the text conversion method of the above embodiments may be implemented by a program instructing associated hardware, and the program may be stored in a computer-readable storage medium, and the storage medium may include: read Only Memory (ROM), Random Access Memory (RAM), magnetic or optical disks, and the like.
Referring to fig. 11, a block diagram of a text transmission system according to an embodiment of the present invention is shown, where the text transmission system includes: a server 1110 and a terminal 1120, and the server 1110 and the terminal 1120 are connected by a wired or wireless network.
The server 1110 includes a file conversion apparatus as shown in fig. 7;
the terminal 1120 includes a file conversion apparatus as shown in fig. 9;
the server 1110 is configured to convert the target text file into a target picture in advance, and transmit the target picture corresponding to the target text file to the terminal 1120 when the terminal 1110 requests to acquire the target text file;
the terminal 1120 is used for converting the received target picture into a target text file.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like that fall within the spirit and principle of the present invention are intended to be included therein.

Claims (22)

1. A method of file conversion, the method comprising:
converting text contents in a target text file into a numerical value sequence in a preset character coding mode, wherein each numerical value in the numerical value sequence belongs to a preset color value range interval;
dividing the numerical value sequence into a plurality of color n-tuple, wherein each color n-tuple comprises n adjacent numerical values in the numerical value sequence, each color n-tuple is used for indicating the color of one pixel point, n is more than or equal to 3, and n is an integer;
storing a target picture generated according to the color n-tuple, wherein each pixel point in the target picture is generated according to the color n-tuple, and the data volume of the target picture is smaller than that of the target text file;
performing associated storage on the target text file and the target picture; when a text acquisition request sent by a terminal is received, searching for a picture corresponding to the target text file indicated by the text file identification according to the text file identification of the target text file carried in the text acquisition request, and sending the searched target picture to the terminal.
2. The method of claim 1, wherein converting the text content in the target text file into a numerical sequence by a predetermined character encoding method comprises:
converting the text content into a character string by a first character coding mode, wherein the first character coding mode comprises any one of Uniform Resource Identifier (URI) coding, uniform code (Unicode) coding or 8-bit UTF-8 coding;
converting each character in the character string into a corresponding numerical value in a second character coding mode, wherein the second character coding mode is American Standard Code for Information Interchange (ASCII) coding or custom coding;
and generating the numerical value sequence according to each numerical value obtained by conversion.
3. The method according to claim 1 or 2, wherein the color n-tuple is a color triplet, and three numerical values in the color triplet are respectively used for indicating a red color value, a green color value and a blue color value of the pixel point;
the dividing of the sequence of numerical values into a number of color n-tuples comprises:
dividing every three adjacent values in the value sequence into one color triple;
and when the number of the numerical values in the divided color triples is less than 3, filling the color triples by using preset numerical values, wherein the preset numerical values belong to the range of the preset color values, and the preset numerical values are different from all the numerical values in the numerical value sequence.
4. The method according to claim 1 or 2, wherein the color n-tuple is a color quadruple, and four numerical values in the color quadruple are respectively used for indicating a red color value, a green color value, a blue color value and a transparency value of the pixel point;
the dividing of the sequence of numerical values into a number of color n-tuples comprises:
dividing every four adjacent values in the value sequence into one color quadruplet;
and when the number of numerical values in the divided color quadruplet is less than 4, filling the color quadruplet by using a preset numerical value, wherein the preset numerical value belongs to the range interval of the preset color value, and the preset numerical value is different from each numerical value in the numerical value sequence.
5. The method according to any one of claims 1 or 2, wherein the target picture is stored in a lossless compression format, and the target picture is a portable network graphics format (PNG) picture or a Tagged Image File Format (TIFF) picture.
6. A method of file conversion, the method comprising:
when a terminal needs to acquire a target text file corresponding to a webpage, sending a corresponding text acquisition request to a server, wherein the text acquisition request comprises a text file identifier of the target text file;
receiving a target picture returned by the server based on the text file identification in the text acquisition request, wherein the data volume of the target picture is smaller than that of the target text file; reading color n-tuples corresponding to each pixel point in the target picture one by one, wherein each color n-tuple comprises n numerical values used for indicating the color of one pixel point, n is not less than 3, and n is an integer;
splicing numerical values contained in the color n-tuple to generate a numerical value sequence, wherein each numerical value in the numerical value sequence belongs to a preset color value range interval;
converting the numerical value sequence into text content in a preset character decoding mode;
and generating a target text file corresponding to the target picture according to the text content.
7. The method of claim 6, wherein converting the numerical sequence into text content by means of predetermined character decoding comprises:
converting each numerical value in the numerical value sequence into a corresponding character in a first character decoding mode, wherein the first character decoding mode is American Standard Code for Information Interchange (ASCII) decoding or custom decoding;
generating a character string according to the converted character;
and converting the character string into the text content by a second character decoding mode, wherein the second character decoding mode comprises any one of Uniform Resource Identifier (URI) decoding, uniform code (Unicode) decoding or 8-bit Unicode conversion format (UTF-8) decoding.
8. The method according to claim 6 or 7, wherein the stitching the values contained in the color n-tuple, after generating the value sequence, comprises:
detecting whether the end of the value sequence contains a preset value or not, wherein the preset value is used for filling the color n-tuple when the number of the values in the color n-tuple is less than n;
deleting the predetermined value when the end of the sequence of values contains the predetermined value.
9. The method according to claim 6 or 7,
the color n-tuple is a color triplet, and three numerical values in the color triplet are respectively used for indicating a red color value, a green color value and a blue color value of the pixel point;
or the like, or, alternatively,
the color n-tuple is a color quadruple, and four numerical values in the color quadruple are respectively used for indicating a red color value, a green color value, a blue color value and a transparency value of the pixel point.
10. The method according to claim 6 or 7, wherein the target picture is stored in a lossless compression format, and the target picture is a portable network graphics format PNG picture or a tagged image file format TIFF picture.
11. A file conversion apparatus, characterized in that the apparatus comprises:
the first conversion module is used for converting text contents in the target text file into a numerical value sequence in a preset character coding mode, and each numerical value in the numerical value sequence belongs to a preset color value range interval;
the dividing module is used for dividing the numerical value sequence into a plurality of color n-tuple, each color n-tuple comprises n adjacent numerical values in the numerical value sequence, each color n-tuple is used for indicating the color of one pixel point, n is more than or equal to 3, and n is an integer;
the first generation module is used for storing a target picture generated according to the color n-tuple, each pixel point in the target picture is generated according to the color n-tuple, and the data volume of the target picture is smaller than that of the target text file;
the apparatus is further configured to: performing associated storage on the target text file and the target picture; when a text acquisition request sent by a terminal is received, searching for a picture corresponding to the target text file indicated by the text file identification according to the text file identification of the target text file carried in the text acquisition request, and sending the searched target picture to the terminal.
12. The apparatus of claim 11, wherein the first conversion module comprises:
the first conversion unit is used for converting the text content into a character string by a first character coding mode, wherein the first character coding mode comprises any one of Uniform Resource Identifier (URI) coding, uniform code (Unicode) coding or 8-bit UTF-8 coding;
the second conversion unit is used for converting each character in the character string into a corresponding numerical value in a second character coding mode, wherein the second character coding mode is American Standard Code for Information Interchange (ASCII) coding or custom coding;
and the first generating unit is used for generating the numerical value sequence according to each numerical value obtained by conversion.
13. The apparatus according to claim 11 or 12, wherein the color n-tuple is a color triplet, and three values in the color triplet are respectively used for indicating a red color value, a green color value and a blue color value of the pixel point;
the dividing module comprises:
a first dividing unit, configured to divide every three adjacent values in the value sequence into one color triple;
and the first filling unit is used for filling the color triples by using preset values when the number of the numerical values in the divided color triples is less than 3, wherein the preset values belong to the range of the preset color values, and the preset values are different from all the numerical values in the numerical value sequence.
14. The apparatus of claim 11 or 12, wherein the color n-tuple is a color quadruple, and four numerical values in the color quadruple are respectively used for indicating a red color value, a green color value, a blue color value and a transparency value of the pixel point;
the dividing module comprises:
the second dividing unit is used for dividing every four adjacent numerical values in the numerical value sequence into one color quadruplet;
and the second filling unit is used for filling the color quadruple by using a preset value when the number of the numerical values in the divided color quadruple is less than 4, wherein the preset value belongs to the range interval of the preset color value, and the preset value is different from each numerical value in the numerical value sequence.
15. The apparatus according to any one of claims 11 or 12, wherein the target picture is stored in a lossless compression format, and the target picture is a portable network graphics format PNG picture or a tagged image file format TIFF picture.
16. A file conversion apparatus is characterized in that,
the apparatus is for: when a terminal needs to acquire a target text file corresponding to a webpage, sending a corresponding text acquisition request to a server, wherein the text acquisition request comprises a text file identifier of the target text file;
receiving a target picture returned by the server based on the text file identification in the text acquisition request, wherein the data volume of the target picture is smaller than that of the target text file;
the device further comprises: the reading module is used for reading color n-tuple corresponding to each pixel point in the target picture one by one, each color n-tuple comprises n numerical values and is used for indicating the color of one pixel point, n is more than or equal to 3, and n is an integer;
the splicing module is used for splicing numerical values contained in the color n-tuple to generate a numerical value sequence, and each numerical value in the numerical value sequence belongs to a preset color value range interval;
the second conversion module is used for converting the numerical value sequence into text content in a preset character decoding mode;
and the second generation module is used for generating a target text file corresponding to the target picture according to the text content.
17. The apparatus of claim 16, wherein the second conversion module comprises:
the third conversion unit is used for converting each numerical value in the numerical value sequence into a corresponding character in a first character decoding mode, wherein the first character decoding mode is American Standard Code for Information Interchange (ASCII) decoding or custom decoding;
a second generation unit configured to generate a character string from the converted character;
and the fourth conversion unit is used for converting the character string into the text content in a second character decoding mode, wherein the second character decoding mode comprises any one of Uniform Resource Identifier (URI) decoding, uniform code (Unicode) decoding or 8-bit Unicode conversion format (UTF-8) decoding.
18. The apparatus according to claim 16 or 17, characterized in that it comprises:
a detection module, configured to detect whether an end of the value sequence includes a predetermined value, where the predetermined value is used to fill the color n-tuple when the number of values in the color n-tuple is less than n;
and the deleting module is used for deleting the preset numerical value when the tail of the numerical value sequence contains the preset numerical value.
19. The apparatus of claim 16 or 17,
the color n-tuple is a color triplet, and three numerical values in the color triplet are respectively used for indicating a red color value, a green color value and a blue color value of the pixel point;
or the like, or, alternatively,
the color n-tuple is a color quadruple, and four numerical values in the color quadruple are respectively used for indicating a red color value, a green color value, a blue color value and a transparency value of the pixel point.
20. The apparatus of claim 16 or 17, wherein the target picture is stored in a lossless compression format, and wherein the target picture is a portable network graphics format (PNG) picture or a Tagged Image File Format (TIFF) picture.
21. A file transfer system, comprising: a server and a terminal;
the server comprising the file conversion apparatus according to any one of claims 11 to 15;
the terminal comprises the file conversion apparatus according to any one of claims 16 to 20;
the server is used for converting the target text file into the target picture in advance and transmitting the target picture corresponding to the target text file to the terminal when the terminal requests to acquire the target text file;
and the terminal is used for converting the received target picture into the target text file.
22. A computer-readable storage medium, in which one or more programs are stored, the one or more programs being loaded and executed by a processor to implement the operations performed by the file conversion method according to any one of claims 1 to 10.
CN201610942062.3A 2016-10-25 2016-10-25 File conversion method, device and file transmission system Active CN106776677B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610942062.3A CN106776677B (en) 2016-10-25 2016-10-25 File conversion method, device and file transmission system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610942062.3A CN106776677B (en) 2016-10-25 2016-10-25 File conversion method, device and file transmission system

Publications (2)

Publication Number Publication Date
CN106776677A CN106776677A (en) 2017-05-31
CN106776677B true CN106776677B (en) 2020-08-28

Family

ID=58973665

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610942062.3A Active CN106776677B (en) 2016-10-25 2016-10-25 File conversion method, device and file transmission system

Country Status (1)

Country Link
CN (1) CN106776677B (en)

Families Citing this family (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110019007A (en) * 2017-10-30 2019-07-16 北京金风科创风电设备有限公司 Data processing method and device
CN109982111B (en) * 2017-12-28 2020-05-22 贵州白山云科技股份有限公司 Text content transmission optimization method and device based on live broadcast network system
CN108737976B (en) * 2018-05-22 2021-05-04 南京大学 Compression transmission method based on Beidou short message
CN109492657B (en) * 2018-09-18 2024-08-27 平安科技(深圳)有限公司 Handwriting sample digitizing method and device, computer equipment and storage medium
CN109241470A (en) * 2018-09-27 2019-01-18 北京小米移动软件有限公司 Page display method, apparatus and system
CN110515892A (en) * 2019-07-15 2019-11-29 平安普惠企业管理有限公司 Text conversion method, device, equipment and storage medium based on artificial intelligence
CN112364642B (en) * 2019-07-23 2024-04-02 马上消费金融股份有限公司 Text processing method and device
CN110545449A (en) * 2019-08-30 2019-12-06 华中科技大学 Industrial field data transmission method based on streaming media
CN111369422B (en) * 2019-10-12 2023-09-15 杭州海康威视系统技术有限公司 Data compression method and device, equipment and storage medium
CN111899173B (en) * 2020-07-24 2021-04-27 自然资源部第一海洋研究所 Data transmission method and device and electronic equipment
CN113590858B (en) * 2021-06-30 2023-10-03 北京百度网讯科技有限公司 Target object generation method and device, electronic equipment and storage medium
CN116136839B (en) * 2023-04-17 2023-06-23 湖南正宇软件技术开发有限公司 Method, system and related equipment for generating legal document face manuscript

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1638365A (en) * 2003-12-29 2005-07-13 和记黄埔企业有限公司 Multi-language wireless email transmission method for mobile communication
CN101488169A (en) * 2008-01-18 2009-07-22 富士施乐株式会社 Information processing apparatus, information processing system, information processing method, computer-readable medium and computer data signal
CN101520901A (en) * 2008-02-26 2009-09-02 富士施乐株式会社 Image processing apparatus and image processing method
CN102655633A (en) * 2012-04-20 2012-09-05 华为技术有限公司 Method for sending blessing information and increment platform
CN105229670A (en) * 2013-02-27 2016-01-06 隆沙有限公司 The text representation of image
CN105700911A (en) * 2015-12-29 2016-06-22 北京金山安全软件有限公司 Application installation method and device and electronic equipment

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1638365A (en) * 2003-12-29 2005-07-13 和记黄埔企业有限公司 Multi-language wireless email transmission method for mobile communication
CN101488169A (en) * 2008-01-18 2009-07-22 富士施乐株式会社 Information processing apparatus, information processing system, information processing method, computer-readable medium and computer data signal
CN101520901A (en) * 2008-02-26 2009-09-02 富士施乐株式会社 Image processing apparatus and image processing method
CN102655633A (en) * 2012-04-20 2012-09-05 华为技术有限公司 Method for sending blessing information and increment platform
CN105229670A (en) * 2013-02-27 2016-01-06 隆沙有限公司 The text representation of image
CN105700911A (en) * 2015-12-29 2016-06-22 北京金山安全软件有限公司 Application installation method and device and electronic equipment

Also Published As

Publication number Publication date
CN106776677A (en) 2017-05-31

Similar Documents

Publication Publication Date Title
CN106776677B (en) File conversion method, device and file transmission system
US9710929B2 (en) Method and apparatus for lossless image compression
US20210211728A1 (en) Image Compression Method and Apparatus
RU2602791C2 (en) Typesetting method, device and system
CN107277399A (en) Television terminal and HDR image switch to SDR method and computer-readable recording medium
CN104424496A (en) Two-dimension code generation, identification and information providing method, device and system
CN104063362A (en) Character string truncation method and device
CN109993817B (en) Animation realization method and terminal
US10515613B2 (en) Method of processing images and apparatus
CN112601096A (en) Video decoding method, device, equipment and readable storage medium
CN113424548A (en) Electronic device and method for playing high dynamic range video
CN113220651B (en) Method, device, terminal equipment and storage medium for compressing operation data
CN104639501B (en) A kind of method of data stream transmitting, equipment and system
KR101843411B1 (en) System for cloud streaming service, method of image cloud streaming service based on transparency of image and apparatus for the same
CN112888024B (en) Data processing method, data processing device, storage medium and electronic equipment
WO2024088132A1 (en) Target-image display method and display apparatus, and electronic device and storage medium
CN116795780A (en) Document format conversion method and device, storage medium and electronic equipment
CN112823519B (en) Video decoding method, device, electronic equipment and computer readable storage medium
CN115424569A (en) Display control method, electronic equipment and display system
CN114155142A (en) Image processing method, image processing device, computer-readable storage medium and computer equipment
US8090362B2 (en) Mobile electronic device and method for displaying characters on a bluetooth device
CN114022343A (en) Resource loading method, terminal and storage medium
CN117742577A (en) Image processing method, device, storage medium and electronic equipment
CN114584783B (en) Picture decoding method and device, terminal equipment and readable storage medium
CN117412055A (en) Image processing method, electronic device, 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