CN115033601A - Method and device for providing pixel picture - Google Patents
Method and device for providing pixel picture Download PDFInfo
- Publication number
- CN115033601A CN115033601A CN202210473745.4A CN202210473745A CN115033601A CN 115033601 A CN115033601 A CN 115033601A CN 202210473745 A CN202210473745 A CN 202210473745A CN 115033601 A CN115033601 A CN 115033601A
- Authority
- CN
- China
- Prior art keywords
- pixel
- canvas
- picture
- database
- data
- 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.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/24—Querying
- G06F16/245—Query processing
- G06F16/2455—Query execution
- G06F16/24552—Database cache management
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/24—Querying
- G06F16/248—Presentation of query results
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/28—Databases characterised by their database models, e.g. relational or object models
- G06F16/284—Relational databases
Landscapes
- Engineering & Computer Science (AREA)
- Databases & Information Systems (AREA)
- Theoretical Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Computational Linguistics (AREA)
- Compression Of Band Width Or Redundancy In Fax (AREA)
Abstract
The invention relates to a method and a device for providing pixel pictures. The method comprises the following steps: receiving a request for providing a pixel picture sent by a client; acquiring basic information of the pixel picture from a first database, wherein the basic information comprises canvas width, canvas height and a color code table; obtaining canvas data for the pixelized drawing from a second database, wherein the canvas data comprises: taking a pixel unit which is visible visually in the pixel picture as a unit, and carrying out color coding and coordinate coding on the pixel picture to obtain coded data, wherein the color coding is carried out according to the color code table; and sending the basic information and the canvas data to a client so that the client decodes to obtain the requested pixel picture according to the basic information and the canvas data. In the invention, the coding is carried out by taking the pixel unit which is visible in the pixel picture as a unit, the coding and decoding modes are simple, and the coded data are respectively stored in the two databases according to the characteristics of the coded data, so that the efficiency is high.
Description
Technical Field
The present invention relates to the field of digital images, and in particular, to a method and apparatus for providing a pixel picture.
Background
At present, pixel painting is more and more popular. In a pixel picture, the pixel particles are presented on the canvas in a distinct size (i.e., one grid) that is visible to the naked eye. How to better provide the display of the pixel picture for the user is a problem to be solved urgently at present.
Disclosure of Invention
To overcome the problems in the related art, embodiments of the present invention provide a method and apparatus for providing a picture of pixels. The technical scheme is as follows:
according to a first aspect of embodiments of the present invention, there is provided a method of providing a picture of pixels, comprising:
receiving a request for providing a pixel picture sent by a client;
acquiring basic information of the pixel picture from a first database, wherein the basic information comprises canvas width, canvas height and a color code table;
obtaining canvas data of the pixel drawing from a second database, wherein the canvas data comprises: taking a pixel unit which is visible visually in the pixel picture as a unit, and carrying out color coding and coordinate coding on the pixel picture to obtain coded data, wherein the color coding is carried out according to the color code table;
and sending the basic information and the canvas data to a client so that the client decodes to obtain the requested pixel picture according to the basic information and the canvas data.
In an embodiment, the method further comprises:
for each visually observable pixel cell in a pixel picture: acquiring a color code corresponding to the color of the pixel unit according to the color code table; calculating the offset of the position of the pixel unit corresponding to the coded data according to a preset coordinate conversion formula;
arranging the color codes of all the pixel units according to the corresponding offset to obtain coded data;
and sending the basic information of the pixel picture to a first database for storage, and sending the coded data of the pixel picture to a second database for storage.
In one embodiment of the method of manufacturing the optical fiber,
the color code table expresses the color by bit of a preset bit;
the preset coordinate conversion formula includes: and the offset is the offset of the pixel unit corresponding to the coded data.
In an embodiment, the first database comprises a MySQL database and the second database comprises a Redis database.
According to a second aspect of embodiments of the present invention, there is provided an apparatus for providing a picture of pixels, comprising:
the receiving module is used for receiving a request for providing a pixel picture sent by a client;
the first acquisition module is used for acquiring basic information of the pixel picture from a first database, wherein the basic information comprises canvas width, canvas height and a color code table;
a second obtaining module, configured to obtain canvas data of the pixlet from a second database, where the canvas data includes: taking a pixel unit which is visible visually in the pixel picture as a unit, and carrying out color coding and coordinate coding on the pixel picture to obtain coded data, wherein the color coding is carried out according to the color code table;
and the sending module is used for sending the basic information and the canvas data to the client so that the client can decode to obtain the requested pixel picture according to the basic information and the canvas data.
In an embodiment, the apparatus further comprises an encoding module configured to:
for each visually observable pixel cell in a pixel picture: acquiring a color code corresponding to the color of the pixel unit according to the color code table; calculating the offset of the position of the pixel unit corresponding to the coded data according to a preset coordinate conversion formula;
arranging the color codes of all the pixel units according to the corresponding offset to obtain coded data;
and sending the basic information of the pixel picture to a first database for storage, and sending the coded data of the pixel picture to a second database for storage.
In one embodiment, the color code table represents the color by bit of a preset bit;
the preset coordinate conversion formula includes: and the offset is the offset of the pixel unit corresponding to the coded data.
According to a third aspect of embodiments of the present invention, there is provided an apparatus for providing a picture of pixels, comprising:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to:
acquiring basic information of the pixel picture from a first database, wherein the basic information comprises canvas width, canvas height and a color code table;
obtaining canvas data for the pixelized drawing from a second database, wherein the canvas data comprises: taking a pixel unit which is visible visually in the pixel picture as a unit, and carrying out color coding and coordinate coding on the pixel picture to obtain coded data, wherein the color coding is carried out according to the color code table;
and sending the basic information and the canvas data to a client so that the client decodes to obtain the requested pixel picture according to the basic information and the canvas data.
According to a fourth aspect of embodiments of the present invention, there is provided a computer readable storage medium having stored thereon computer instructions, characterized in that the instructions, when executed by a processor, implement the steps of the method of any one of the first aspect of embodiments of the present invention.
In the technical scheme provided by the embodiment of the invention, the pixel unit which is visible in the pixel picture is taken as a unit, the pixel picture is subjected to color coding and coordinate coding to obtain coded data, the coding and decoding mode is simple, complex calculation is not needed, the coded data are respectively stored in two databases according to the characteristics of the coded data, and the server acquires the coded pixel picture data by accessing the two databases, so that the efficiency is high.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the invention, as claimed.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and together with the description, serve to explain the principles of the invention.
FIG. 1 is a flow diagram illustrating a method of providing a picture of pixels in accordance with one illustrative embodiment;
FIG. 2 is a schematic diagram of a color code table shown in accordance with an illustrative embodiment;
FIG. 3 is a schematic diagram illustrating pixel picture encoding in accordance with an exemplary embodiment;
FIG. 4 is a schematic diagram illustrating pixel picture decoding in accordance with an exemplary embodiment;
FIG. 5 is a flow diagram illustrating a method of providing a picture of pixels in accordance with one illustrative embodiment;
FIG. 6 is a block diagram illustrating an apparatus for providing a picture of pixels in accordance with one illustrative embodiment.
FIG. 7 is a block diagram illustrating an apparatus for providing a picture of pixels in accordance with one illustrative embodiment.
FIG. 8 is a block diagram illustrating an apparatus for providing a picture of pixels in accordance with one illustrative embodiment.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present invention. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the invention, as detailed in the appended claims.
The embodiment of the invention provides a method for providing pixel pictures, which can be applied to a server and is used for providing the pixel pictures according to the request of a client. As shown in fig. 1, the method includes the following steps 101 to 105:
in step 101, a request for providing a pixel drawing sent by a client is received.
The client may be, for example, an APP installed on a user terminal, and after the user enters the APP, the client sends a request for providing a pixel drawing to the server, so that the pixel drawing can be presented to the user. Alternatively, the APP may present thumbnails of some pixel pictures, and when a user selects a certain pixel picture, the client sends a request for providing the pixel picture to the server.
In step 102, basic information of the pixel picture is obtained from a first database, wherein the basic information comprises a canvas width, a canvas height and a color code table.
The canvas width and the canvas height are respectively the canvas width and the canvas height of the pixel picture requested by the client. Pixelized pictures are typically rendered in pixel cells that are visually observable (i.e., visible to the naked eye). Canvas width, canvas height, etc. information may be expressed in terms of the number of pixel cells. The color code table is preset, and functions of the color code table are to encode the pixel picture according to the color code table in advance, the client decodes the pixel picture by using the color code table to obtain the pixel picture, and a specific scheme for encoding the pixel picture will be described in detail below. In one embodiment, the color code table represents colors by bits of preset bits, for example, four bits may represent 16 colors. As shown in fig. 2, a binary code corresponding to hexadecimal codes of 16 colors is schematically shown, and colors are generally represented using hexadecimal codes.
In one embodiment, the first database may comprise a MySQL database for persistently storing data to a hard disk, which is powerful but slow to read.
In step 103, canvas data of the pixel drawing is obtained from a second database, wherein the canvas data comprises: and the pixel picture is subjected to color coding and coordinate coding by taking the pixel unit which is visible in the pixel picture as a unit to obtain coded data, wherein the color coding is carried out according to the color code table.
Wherein the second database stores encoded pixel picture data. In one embodiment, the second database may use a Redis database, which is used to store data that is used more frequently into a cache, and the reading speed is fast.
The advantage of splitting the basic information of the pixel picture and the canvas data into two database stores is that: the data which needs to be frequently used is stored in the database with high reading speed, so that the times of accessing the database with low reading speed are reduced, and the operation efficiency is improved.
In step 104, the basic information and the canvas data are sent to the client, so that the client decodes the basic information and the canvas data to obtain the requested pixel picture.
And the client side receives the basic information and the canvas data, and decodes the canvas data according to the canvas width, the canvas height and the color code table in the basic information to obtain the original pixel picture.
In the technical scheme provided by the embodiment of the invention, the pixel unit which is visible in the pixel picture is taken as a unit, the pixel picture is subjected to color coding and coordinate coding to obtain coded data, the coding and decoding mode is simple, complex calculation is not needed, the coded data are respectively stored in two databases, and the server obtains the data after the pixel picture coding by reading the two databases, so that the efficiency is high.
In one embodiment, the method further comprises the step of encoding the pixel picture, for example, the step of encoding the pixel picture may comprise: step a1 to step A3:
step A1, for each visually observable pixel cell in the pixel picture: acquiring a color code corresponding to the color of the pixel unit according to the color code table; calculating the offset of the position of the pixel unit corresponding to the coded data according to a preset coordinate conversion formula;
step A2, arranging the color codes of all pixel units according to the corresponding offset to obtain coded data;
fig. 3 shows an exemplary pixel picture encoding method. For example, a2 x 2 pixel picture is encoded, for example, for a (0,0) pixel cell (here, the pixel cell refers to a grid visible to the naked eye in the pixel picture), the color is red (hexadecimal code # d71345), and the color is encoded according to the preset color code table illustrated in fig. 2, and the color of the (0,0) pixel cell is 0101. It is also necessary to encode the coordinates of the (0,0) pixel cell, and the encoding of the coordinates can be according to the following formula: the offset is x + y canvas width, where x and y are respectively the abscissa and ordinate of the pixel unit, the canvas width is the horizontal number of the pixel unit drawn by the pixel, which is 2 in this embodiment, and the calculated offset is the offset of the encoded data of the pixel unit in all the encoded data. All the coded data may be stored in the form of a list, for example. According to the above formula, the offset amount of the (0,0) pixel unit is calculated to be 0.
For another example, for a (0,1) pixel cell whose color is yellow (hexadecimal code # ffc20e), the color is encoded according to the preset color code table illustrated in fig. 2, and the color code of the (0,1) pixel cell is 0110. The coordinates of the (0,1) pixel unit also need to be encoded, and the offset calculated according to the above formula is the offset of the encoded data of the pixel unit in all the encoded data. According to the above formula, the offset amount of the (0,0) pixel unit is calculated to be 1. By analogy, each pixel element in a pixel picture may be encoded. The encoded data may be, for example, a table in which the color code of each pixel unit is stored in accordance with the calculated offset. It will be appreciated by those skilled in the art that the encoding of the pixel picture can be performed by any suitable terminal, and the subject application is not limited to the implementation thereof.
And step A3, sending the basic information of the pixel picture to a first database for storage, and sending the coded data of the pixel picture to a second database for storage.
The pixel picture coding scheme provided in the embodiment consumes less storage, and for 10000 grids of pixel pictures and 16-color canvases, the coded data amount is only about 4 kB. In one embodiment, after encoding a pixel picture, basic information such as a color code table, a canvas width, a canvas height, etc. of the pixel picture may be stored in the mysql database. The encoded canvas data, i.e., the table storing the color coding of each pixel by offset, may then be stored in a redis database. The data stored in the database is used for reading when a client requests a picture of pixels.
And 104, after the basic information and the canvas data of the pixel picture are sent to the client, the client decodes the pixel picture according to the basic information and the canvas data of the pixel picture to obtain the requested pixel picture. The decoding process is the inverse of the encoding. As shown in fig. 4, after receiving the basic information of the pixel picture and the canvas data sent by the server, the client decodes the basic information to obtain the color of each pixel unit according to the code of every 4 bits in the canvas data and the preset color code table, and obtains the abscissa and the ordinate of the corresponding pixel unit according to the offset of the code of every 4 bits in the table. The coordinate conversion formula is, for example:
the abscissa x is the offset% canvas width (taking the remainder);
the ordinate y is the offset/canvas width (rounded down when there is a remainder).
The implementation process is described in detail by the following embodiments.
FIG. 5 is a schematic flow chart diagram illustrating one method of providing a picture of pixels in accordance with one illustrative embodiment. As shown in fig. 5, the method comprises the following steps:
step 501, a client APP sends a pixel drawing request to a server.
Step 502, the Server sends a request for obtaining the basic information of the canvas of the pixel picture to the database MySQL.
Step 503, returning basic canvas information to the server by the database MySQL, wherein the basic canvas information includes information which is fixed and unchangeable, such as canvas width, canvas height, color code table and the like.
In step 504, the Server sends a request for obtaining canvas data of the pixel picture to a Redis database.
In step 505, the database Redis sends canvas data to the server.
If the canvas data for a pixel drawing is large, for example, a pixel drawing contains 10000 grids, a loop traversal may be employed here, and a preset amount of canvas data is obtained each time, i.e., steps 504 and 505 are repeated until all canvas data are obtained.
Step 506, the server sends the basic canvas information and the canvas data to the client APP, so that the client decodes the received basic information and the canvas data to obtain the requested pixel picture.
The following are embodiments of the apparatus of the present invention that may be used to perform embodiments of the method of the present invention.
Fig. 6 is a block diagram illustrating an apparatus for providing a pixel picture according to an exemplary embodiment, where the apparatus for providing a pixel picture may be a server or a part of a server, or may be a part of a terminal or a terminal, and the apparatus for providing a pixel picture may be implemented as a part or all of an electronic device through software, hardware, or a combination of the two. As shown in fig. 6, the apparatus for providing a picture of pixels comprises:
a receiving module 601, configured to receive a request for providing a pixel drawing sent by a client;
a first obtaining module 602, configured to obtain basic information of the pixelized picture from a first database, where the basic information includes a canvas width, a canvas height, and a color code table;
a second obtaining module 603, configured to obtain canvas data of the pixel drawing from a second database, where the canvas data includes: taking a pixel unit which is visible visually in the pixel picture as a unit, and carrying out color coding and coordinate coding on the pixel picture to obtain coded data, wherein the color coding is carried out according to the color code table;
and a sending module 604, configured to send the basic information and the canvas data to the client, so that the client decodes the basic information and the canvas data to obtain the requested pixel image.
In an embodiment, the apparatus further comprises an encoding module configured to:
for each visually observable pixel cell in a pixel picture: acquiring a color code corresponding to the color of the pixel unit according to the color code table; calculating the offset of the position of the pixel unit corresponding to the coded data according to a preset coordinate conversion formula;
arranging the color codes of all the pixel units according to the corresponding offset to obtain coded data;
and sending the basic information of the pixel picture to a first database for storage, and sending the coded data of the pixel picture to a second database for storage.
In one embodiment, the color code table represents the color by bit of a preset bit; the preset coordinate conversion formula comprises: and the offset is the offset of the pixel unit corresponding to the coded data.
The embodiment of the invention provides a device for providing pixel pictures, which encodes the pixel units visible in the pixel pictures as units, has a simple encoding and decoding mode and does not need complex calculation, encoded data are respectively stored in two databases according to the characteristics of the encoded data, and a server acquires the encoded pixel picture data through the two databases, so that the efficiency is high.
Fig. 7 is a block diagram of an apparatus 70 for providing a pixel picture according to an exemplary embodiment, where the apparatus for providing a pixel picture may be a server or a part of a server, or may be a terminal or a part of a terminal, and the apparatus for providing a pixel picture includes:
a processor 701;
a memory 702 for storing instructions executable by the processor 701;
wherein the processor 701 is configured to:
acquiring basic information of the pixel picture from a first database, wherein the basic information comprises canvas width, canvas height and a color code table;
obtaining canvas data of the pixel drawing from a second database, wherein the canvas data comprises: taking a pixel unit which is visible visually in the pixel picture as a unit, and carrying out color coding and coordinate coding on the pixel picture to obtain coded data, wherein the color coding is carried out according to the color code table;
and sending the basic information and the canvas data to a client so that the client decodes to obtain the requested pixel picture according to the basic information and the canvas data.
Fig. 8 is a block diagram illustrating an apparatus 800 for providing pixelization, which may be a computer, server, etc., according to an example embodiment.
The apparatus may include one or more of the following components: processing component 802, memory 804, power component 806, multimedia component 808, audio component 810, input/output (I/O) interface 812, sensor component 814, and communications component 816.
The processing component 802 generally controls overall operation of the device 800, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations. The processing elements 802 may include one or more processors 820 to execute instructions to perform all or a portion of the steps of the methods described above. Further, the processing component 802 can include one or more modules that facilitate interaction between the processing component 802 and other components. For example, the processing component 802 can include a multimedia module to facilitate interaction between the multimedia component 808 and the processing component 802.
The memory 804 is configured to store various types of data to support operations at the apparatus 800. Examples of such data include instructions for any application or method operating on device 800, contact data, phonebook data, messages, pictures, videos, and so forth. The memory 804 may be implemented by any type or combination of volatile and non-volatile memory devices such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disks.
The multimedia component 808 includes a screen that provides an output interface between the device 800 and the user. In some embodiments, the screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive an input signal from a user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundary of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 808 includes a front facing camera and/or a rear facing camera. The front camera and/or the rear camera may receive external multimedia data when the device 800 is in an operation mode, such as a photographing mode or a video mode. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
The audio component 810 is configured to output and/or input audio signals. For example, audio component 810 includes a Microphone (MIC) configured to receive external audio signals when apparatus 800 is in an operational mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signals may further be stored in the memory 804 or transmitted via the communication component 816. In some embodiments, audio component 810 also includes a speaker for outputting audio signals.
The I/O interface 812 provides an interface between the processing component 802 and peripheral interface modules, which may be keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to: a home button, a volume button, a start button, and a lock button.
The sensor assembly 814 includes one or more sensors for providing various aspects of state assessment for the device 800. For example, the sensor assembly 814 may detect the open/closed state of the device 800, the relative positioning of components, such as a display and keypad of the device 600, the sensor assembly 814 may also detect a change in position of the device 800 or a component of the device 800, the presence or absence of user contact with the device 800, the orientation or acceleration/deceleration of the device 800, and a change in temperature of the device 800. Sensor assembly 814 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 814 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 514 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
The communication component 816 is configured to facilitate communications between the apparatus 800 and other devices in a wired or wireless manner. The device 800 may access a wireless network based on a communication standard, such as walkie-talkie private, WiFi, 2G, 3G, 4G, or 5G, or a combination thereof. In an exemplary embodiment, the communication component 816 receives a broadcast signal or broadcast related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 816 further includes a Near Field Communication (NFC) module to facilitate short-range communications. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, Ultra Wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
In an exemplary embodiment, the apparatus 800 may be implemented by one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), controllers, micro-controllers, microprocessors, or other electronic components for performing the above-described methods.
In an exemplary embodiment, a non-transitory computer-readable storage medium comprising instructions, such as the memory 804 comprising instructions, executable by the processor 820 of the device 800 to perform the above-described method is also provided. For example, the non-transitory computer readable storage medium may be a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
A non-transitory computer readable storage medium having instructions therein which, when executed by a processor of an apparatus 800, enable the apparatus 800 to perform the above-described method of providing a picture of pixels, the method comprising:
receiving a request for providing a pixel picture sent by a client;
acquiring basic information of the pixel picture from a first database, wherein the basic information comprises canvas width, canvas height and a color code table;
obtaining canvas data for the pixelized drawing from a second database, wherein the canvas data comprises: taking a pixel unit which is visible visually in the pixel picture as a unit, and carrying out color coding and coordinate coding on the pixel picture to obtain coded data, wherein the color coding is carried out according to the color code table;
and sending the basic information and the canvas data to a client so that the client decodes to obtain the requested pixel picture according to the basic information and the canvas data.
Other embodiments of the invention will be apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the invention following, in general, the principles of the invention and including such departures from the present disclosure as come within known or customary practice within the art to which the invention pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the invention being indicated by the following claims.
It will be understood that the invention is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the invention is limited only by the appended claims.
Claims (10)
1. A method of providing a picture of pixels, comprising:
receiving a request for providing a pixel picture sent by a client;
acquiring basic information of the pixel picture from a first database, wherein the basic information comprises canvas width, canvas height and a color code table;
obtaining canvas data for the pixelized drawing from a second database, wherein the canvas data comprises: taking a pixel unit which is visible visually in the pixel picture as a unit, and carrying out color coding and coordinate coding on the pixel picture to obtain coded data, wherein the color coding is carried out according to the color code table;
and sending the basic information and the canvas data to a client so that the client decodes to obtain the requested pixel picture according to the basic information and the canvas data.
2. The method of claim 1, further comprising:
for each visually observable pixel cell in a pixel picture: acquiring a color code corresponding to the color of the pixel unit according to the color code table; calculating the offset of the position of the pixel unit corresponding to the coded data according to a preset coordinate conversion formula;
arranging the color codes of all the pixel units according to the corresponding offset to obtain coded data;
and sending the basic information of the pixel picture to a first database for storage, and sending the coded data of the pixel picture to a second database for storage.
3. The method of claim 2,
the color code table represents the color through bit of a preset bit;
the preset coordinate conversion formula comprises: the canvas width is x + y, where x and y represent the abscissa and ordinate of the pixel unit, and the offset is the offset amount of the pixel unit corresponding to the encoded data.
4. The method of claim 1,
the first database comprises a MySQL database and the second database comprises a Redis database.
5. An apparatus for providing a picture of pixels, comprising:
the receiving module is used for receiving a request for providing a pixel picture sent by a client;
the first acquisition module is used for acquiring basic information of the pixel picture from a first database, wherein the basic information comprises canvas width, canvas height and a color code table;
a second obtaining module, configured to obtain canvas data of the pixel drawing from a second database, where the canvas data includes: taking a pixel unit which is visible visually in the pixel picture as a unit, and carrying out color coding and coordinate coding on the pixel picture to obtain coded data, wherein the color coding is carried out according to the color code table;
and the sending module is used for sending the basic information and the canvas data to a client so that the client decodes to obtain the requested pixel picture according to the basic information and the canvas data.
6. The apparatus of claim 5, further comprising an encoding module to:
for each visually observable pixel cell in a pixel picture: acquiring a color code corresponding to the color of the pixel unit according to the color code table; calculating the offset of the position of the pixel unit corresponding to the coded data according to a preset coordinate conversion formula;
arranging the color codes of all the pixel units according to the corresponding offset to obtain coded data;
and sending the basic information of the pixel picture to a first database for storage, and sending the coded data of the pixel picture to a second database for storage.
7. The apparatus of claim 6,
the color code table expresses the color by bit of a preset bit;
the preset coordinate conversion formula includes: and the offset is the offset of the pixel unit corresponding to the coded data.
8. The apparatus of claim 5,
the first database comprises a MySQL database and the second database comprises a Redis database.
9. An apparatus for providing a picture of pixels, comprising:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to:
receiving a request for providing a pixel picture sent by a client;
acquiring basic information of the pixel picture from a first database, wherein the basic information comprises canvas width, canvas height and a color code table;
obtaining canvas data for the pixelized drawing from a second database, wherein the canvas data comprises: taking a pixel unit which is visible visually in the pixel picture as a unit, and carrying out color coding and coordinate coding on the pixel picture to obtain coded data, wherein the color coding is carried out according to the color code table;
and sending the basic information and the canvas data to a client so that the client decodes to obtain the requested pixel picture according to the basic information and the canvas data.
10. A computer-readable storage medium having stored thereon computer instructions, which when executed by a processor, perform the steps of the method of any one of claims 1 to 4.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210473745.4A CN115033601A (en) | 2022-04-29 | 2022-04-29 | Method and device for providing pixel picture |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210473745.4A CN115033601A (en) | 2022-04-29 | 2022-04-29 | Method and device for providing pixel picture |
Publications (1)
Publication Number | Publication Date |
---|---|
CN115033601A true CN115033601A (en) | 2022-09-09 |
Family
ID=83119890
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210473745.4A Pending CN115033601A (en) | 2022-04-29 | 2022-04-29 | Method and device for providing pixel picture |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115033601A (en) |
-
2022
- 2022-04-29 CN CN202210473745.4A patent/CN115033601A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN105489194B (en) | A kind of method and apparatus of display image | |
CN106657780B (en) | Image preview method and device | |
CN105049219B (en) | Flow booking method and system, mobile terminal and server | |
US20220222831A1 (en) | Method for processing images and electronic device therefor | |
CN109120929B (en) | Video encoding method, video decoding method, video encoding device, video decoding device, electronic equipment and video encoding system | |
CN109756783B (en) | Poster generation method and device | |
CN104992416A (en) | Image enhancement method and device, and intelligent equipment | |
CN112035691A (en) | Method, device, equipment and medium for displaying cell labeling data of slice image | |
CN111953980A (en) | Video processing method and device | |
CN107885464B (en) | Data storage method, device and computer readable storage medium | |
CN107193530B (en) | Method and device for generating random number | |
CN111860552A (en) | Model training method and device based on nuclear self-encoder and storage medium | |
CN115033601A (en) | Method and device for providing pixel picture | |
CN112651012B (en) | Information processing method and device | |
CN111724398A (en) | Image display method and device | |
CN107682623B (en) | Photographing method and device | |
CN112036241A (en) | Image processing method and device, electronic equipment and storage medium | |
CN111241097B (en) | Method for processing object, device for processing object and storage medium | |
CN110784721A (en) | Picture data compression method and device, electronic equipment and storage medium | |
CN114500819B (en) | Shooting method, shooting device and computer readable storage medium | |
CN114415817B (en) | Display control method, electronic device and storage medium | |
CN114626468B (en) | Method, device, electronic equipment and storage medium for generating shadow in image | |
EP3910949A1 (en) | Video processing method and apparatus, and storage medium | |
CN110876013B (en) | Method and device for determining image resolution, electronic equipment and storage medium | |
CN109766506B (en) | Picture processing method, device, terminal, server 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 |