CN103678300B - Picture conversion method and device - Google Patents

Picture conversion method and device Download PDF

Info

Publication number
CN103678300B
CN103678300B CN201210315470.8A CN201210315470A CN103678300B CN 103678300 B CN103678300 B CN 103678300B CN 201210315470 A CN201210315470 A CN 201210315470A CN 103678300 B CN103678300 B CN 103678300B
Authority
CN
China
Prior art keywords
picture
converted
column
redundant
pixels
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
CN201210315470.8A
Other languages
Chinese (zh)
Other versions
CN103678300A (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.)
Shenzhen Shiji Guangsu Information Technology Co Ltd
Original Assignee
Shenzhen Shiji Guangsu Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Shiji Guangsu Information Technology Co Ltd filed Critical Shenzhen Shiji Guangsu Information Technology Co Ltd
Priority to CN201210315470.8A priority Critical patent/CN103678300B/en
Publication of CN103678300A publication Critical patent/CN103678300A/en
Application granted granted Critical
Publication of CN103678300B publication Critical patent/CN103678300B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Editing Of Facsimile Originals (AREA)
  • Color Image Communication Systems (AREA)
  • Image Processing (AREA)

Abstract

The invention relates to a picture conversion method and a device, wherein the picture conversion method comprises the following steps: determining a redundant part of a picture to be converted; cutting redundant parts of the picture to be converted to obtain a cut picture; and abbreviating the cut picture to obtain the converted picture. The invention also relates to a picture conversion device. The picture conversion method and the picture conversion device judge the redundant part of the original picture and cut the redundant part of the original picture, and solve the technical problem that the text content in the picture converted by the conventional picture conversion method and the conventional picture conversion device is possibly unclear.

Description

Picture conversion method and device
Technical Field
The present invention relates to the field of image processing technologies, and in particular, to an image conversion method and an image conversion apparatus.
Background
With the development of electronic communication technology, more and more people enjoy the convenience brought by mobile terminals such as smart phones. When a user browses a webpage by using a mobile terminal such as a smart phone, the webpage to be browsed by the user needs to be transcoded due to the fact that the size of a display screen of the mobile terminal is different from that of a display screen of a computer, and the webpage is more suitable for being displayed on the mobile phone. The conversion of pictures in web pages is an important step in the transcoding process, and the conversion of pictures in web pages is to convert pictures suitable for being displayed on a computer screen into pictures suitable for being displayed on a mobile terminal.
The existing picture conversion method is to directly reduce the original picture according to the aspect ratio of the original picture without cutting the original picture, i.e. the picture suitable for being displayed on a computer is reduced according to the aspect ratio of the original picture, so that the reduced picture is suitable for being displayed on a mobile terminal.
However, when the method is used for picture conversion, the conversion effect on some irregular pictures (such as pictures with special width or special height) is poor. As shown in fig. 1, fig. 1 is a schematic flow chart of picture conversion according to a conventional conversion method, wherein since the width of the picture before conversion in fig. 1 is large, the width of the picture is abbreviated to 1/3 of the width of the picture before conversion so as to be suitable for being displayed on a mobile terminal. However, the text content in the picture converted by the existing conversion method is very unclear, which seriously affects the web browsing experience of the mobile terminal user.
Therefore, it is necessary to provide a method and an apparatus for converting pictures to solve the problems of the prior art.
Disclosure of Invention
The invention aims to provide a picture conversion method and a picture conversion device for judging redundant parts of an original picture and cutting the redundant parts of the original picture, and the technical problem that the text content in the picture converted by using the conventional picture conversion method and device is possibly unclear is solved.
In order to solve the above problems, the technical scheme provided by the invention is as follows:
the invention relates to a picture conversion method, which comprises the following steps:
determining a redundant part of the picture to be converted;
cutting the redundant part of the picture to be converted to obtain a cut picture; and
and carrying out picture abbreviation on the cut picture to obtain a converted picture.
In the image conversion method of the present invention, the step of determining the redundant portion of the image to be converted specifically includes:
and scanning the colors of the pixels of the picture to be converted, and determining the redundant part of the picture to be converted according to the scanning result.
In the picture conversion method according to the present invention, the redundant portion includes at least one of a column area redundant portion and a row area redundant portion; wherein:
the step of determining the column area redundant part of the picture to be converted comprises the following steps:
scanning the pixel colors of the picture to be converted column by column according to the region, and if the colors of all pixels of a scanned column are the same, judging that the scanned column belongs to the redundant part of the column region;
the step of determining the row region redundant part of the picture to be converted comprises the following steps:
and scanning the pixel colors of the picture to be converted line by line according to the region, and if the colors of all pixels of a scanned line are the same, judging that the scanned line belongs to the line region redundant part.
In the picture conversion method according to the present invention, the column region redundant portion includes at least one of a left redundant portion and a right redundant portion, and the row region redundant portion includes at least one of an upper redundant portion and a lower redundant portion; wherein:
the step of determining the left redundant part of the picture to be converted comprises the following steps:
scanning the colors of the pixels of the picture to be converted from left to right column by column, if the colors of all the pixels of a scanned column are the same, judging that the scanned column belongs to the left redundant part, and if not, stopping scanning;
the step of determining the right redundant part of the picture to be converted comprises the following steps:
scanning the colors of the pixels of the picture to be converted from right to left column by column, if the colors of all the pixels of a scanned column are the same, judging that the scanned column belongs to the right redundant part, and if not, stopping scanning;
the step of determining the upper side redundant part of the picture to be converted comprises the following steps:
scanning the colors of the pixels of the picture to be converted line by line from top to bottom, if the colors of all the pixels of a scanned line are the same, judging that the scanned line belongs to the upper side redundant part, and if not, stopping scanning;
the step of determining the lower redundant part of the picture to be converted comprises the following steps:
and scanning the colors of the pixels of the picture to be converted line by line from bottom to top, if the colors of all the pixels of a scanned line are the same, judging that the scanned line belongs to the lower side redundant part, and otherwise, stopping scanning.
In the picture conversion method, when the aspect ratio of the picture to be converted is greater than a first set value, the left redundant part and the right redundant part of the picture to be converted are determined;
and when the aspect ratio of the picture to be converted is smaller than a second set value, judging the upper redundant part and the lower redundant part of the picture to be converted.
In the picture conversion method according to the present invention, the redundant portion further includes at least one of a column redundant portion and a row redundant portion;
the step of determining the column redundancy part of the picture to be converted comprises the following steps:
scanning the colors of the pixels of the picture to be converted column by column, and if the colors of the pixels of the corresponding rows of two adjacent scanned columns are the same, judging that the two adjacent scanned columns belong to the column redundancy part;
the step of determining the row redundancy part of the picture to be converted comprises the following steps:
and scanning the colors of the pixels of the picture to be converted line by line, and if the colors of the pixels of the corresponding columns of two adjacent scanned lines are the same, judging that the two adjacent scanned lines belong to the line redundancy part.
In the picture conversion method, when the aspect ratio of the picture to be converted is greater than a third set value, the column redundancy part of the picture to be converted is judged;
and when the aspect ratio of the picture to be converted is smaller than a fourth set value, judging the row redundancy part of the picture to be converted.
In the image conversion method of the present invention, the step of scanning the color of the pixel of the image to be converted and determining the redundant portion of the image to be converted includes the steps of:
and judging whether to determine the redundant part of the picture to be converted or not according to the aspect ratio, the width and the height of the picture to be converted.
In the picture conversion method, if the aspect ratio of the picture to be converted is greater than a fifth set value and the width of the picture to be converted is greater than a sixth set value, determining a redundant part of the picture to be converted; or
And if the aspect ratio of the picture to be converted is smaller than a seventh set value and the height of the picture to be converted is larger than an eighth set value, determining a redundant part of the picture to be converted.
In the image conversion method of the present invention, the step of performing image reduction on the cut-down image to obtain the converted image specifically includes:
and abbreviating the cut picture according to the size ratio of the webpage picture to the corresponding mobile phone picture to obtain a converted picture.
The present invention also relates to a picture conversion apparatus, comprising:
the redundant scanning module is used for determining a redundant part of the picture to be converted;
the cutting module is used for cutting the redundant part of the picture to be converted to obtain a cut picture; and
and the abbreviating module is used for abbreviating the cut picture to obtain the converted picture.
In the image conversion device of the present invention, the redundant scanning module is specifically configured to scan colors of pixels of an image to be converted, and determine a redundant portion of the image to be converted according to a scanning result.
In the picture conversion apparatus of the present invention, the redundant portion includes at least one of a column area redundant portion and a row area redundant portion;
the redundant scan module includes:
the column region redundancy scanning submodule is used for scanning the pixel colors of the picture to be converted column by column according to regions, and if the colors of all pixels of a scanned column are the same, the scanned column is judged to belong to the column region redundancy part; and
and the line region redundancy scanning sub-module is used for scanning the pixel colors of the picture to be converted line by line according to regions, and if the colors of all pixels of a scanned line are the same, judging that the scanned line belongs to the line region redundancy part.
In the picture conversion apparatus of the present invention, the column area redundant portion includes at least one of a left redundant portion and a right redundant portion, and the row area redundant portion includes at least one of an upper redundant portion and a lower redundant portion;
the column region redundancy scanning sub-module comprises:
the left redundant scanning unit is used for scanning the colors of the pixels of the picture to be converted from left to right column by column, if the colors of all the pixels of a scanned column are the same, the scanned column is judged to belong to the left redundant part, and if not, the scanning is stopped; and
the right redundant scanning unit is used for scanning the colors of the pixels of the picture to be converted from right to left column by column, if the colors of all the pixels of a scanned column are the same, the scanned column is judged to belong to the right redundant part, and if not, the scanning is stopped;
the row area redundancy scanning sub-module comprises:
the upper side redundant scanning unit is used for scanning the colors of the pixels of the picture to be converted line by line from top to bottom, if the colors of all the pixels of a scanned line are the same, the scanned line is judged to belong to the upper side redundant part, and if not, the scanning is stopped; and
and the lower side redundant scanning unit is used for scanning the colors of the pixels of the picture to be converted line by line from bottom to top, if the colors of all the pixels of a scanned line are the same, the scanned line is judged to belong to the lower side redundant part, and if not, the scanning is stopped.
In the picture conversion apparatus of the present invention, when the aspect ratio of the picture to be converted is greater than a first set value, the left redundant scanning unit determines the left redundant portion of the picture to be converted, and the right redundant scanning unit determines the right redundant portion of the picture to be converted;
when the aspect ratio of the picture to be converted is smaller than a second set value, the upper redundant scanning unit judges the upper redundant part of the picture to be converted, and the lower redundant scanning unit judges the lower redundant part of the picture to be converted.
In the picture conversion apparatus of the present invention, the redundant portion further includes at least one of a column redundant portion and a row redundant portion;
the redundant scan module further comprises:
the column redundancy scanning unit is used for scanning the colors of the pixels of the picture to be converted column by column, and if the colors of the pixels of the corresponding rows of two adjacent scanned columns are the same, the two adjacent scanned columns are judged to belong to the column redundancy part; and
and the line redundancy scanning unit is used for scanning the colors of the pixels of the picture to be converted line by line, and if the colors of the pixels of the corresponding columns of two adjacent scanned lines are the same, judging that the two adjacent scanned lines belong to the line redundancy part.
In the picture conversion apparatus of the present invention, when the aspect ratio of the picture to be converted is greater than a third setting value, the column redundancy scanning unit determines the column redundancy part of the picture to be converted;
when the aspect ratio of the picture to be converted is smaller than a fourth set value, the line redundancy scanning unit judges the line redundancy part of the picture to be converted.
In the picture conversion apparatus of the present invention, the picture conversion apparatus further includes:
and the cutting judging module is used for judging whether to determine the redundant part of the picture to be converted according to the aspect ratio, the width and the height of the picture to be converted.
In the image conversion apparatus of the present invention, the cutting determination module is specifically configured to determine a redundant portion of the image to be converted if the aspect ratio of the image to be converted is greater than a fifth set value and the width of the image to be converted is greater than a sixth set value; or if the aspect ratio of the picture to be converted is smaller than a seventh set value and the height of the picture to be converted is larger than an eighth set value, determining the redundant part of the picture to be converted.
In the image conversion device of the present invention, the abbreviating module is specifically configured to abbreviate the cropped image according to a size ratio between a web page image and a corresponding mobile phone image, so as to obtain a converted image.
Compared with the existing picture conversion method and device, the picture conversion method and device provided by the invention can be used for judging the redundant part of the original picture and cutting the redundant part of the original picture, so that the technical problem that the text content in the picture converted by using the existing picture conversion method and device is possibly unclear is solved.
In order to make the aforementioned and other objects of the present invention more comprehensible, preferred embodiments accompanied with figures are described in detail below:
drawings
Fig. 1 is a schematic flow chart of image conversion according to a conventional conversion method;
FIG. 2 is a flow chart of a first preferred embodiment of the picture conversion method of the present invention;
FIG. 3 is a schematic flow chart illustrating a picture conversion process according to the present invention;
FIG. 4 is a second flowchart illustrating a picture conversion process according to the picture conversion method of the present invention;
FIG. 5 is a third schematic flowchart illustrating a picture conversion process according to the picture conversion method of the present invention;
FIG. 6 is a fourth flowchart illustrating a picture conversion process according to the picture conversion method of the present invention;
FIG. 7 is a flowchart illustrating a second preferred embodiment of a picture conversion method according to the present invention;
FIG. 8 is a schematic structural diagram of a first preferred embodiment of a picture conversion apparatus according to the present invention;
FIG. 9 is a schematic structural diagram of a second preferred embodiment of a picture conversion apparatus according to the present invention;
wherein the reference numerals are as follows:
81. a redundant scanning module;
82. a cutting module;
83. a abbreviating module;
91. and a cutting judgment module.
Detailed Description
The following description of the embodiments refers to the accompanying drawings for illustrating the specific embodiments in which the invention may be practiced. In the present invention, directional terms such as "up", "down", "front", "back", "left", "right", "inner", "outer", "side", etc. refer to directions of the attached drawings. Accordingly, the directional terms used are used for explanation and understanding of the present invention, and are not used for limiting the present invention.
In the drawings, elements having similar structures are denoted by the same reference numerals.
Referring to fig. 2, fig. 3, fig. 4, fig. 5 and fig. 6, fig. 2 is a flowchart illustrating a first preferred embodiment of a picture conversion method according to the present invention, fig. 3 is a flowchart illustrating one of the processes of performing picture conversion according to the picture conversion method of the present invention, fig. 4 is a second flowchart illustrating the process of performing picture conversion according to the picture conversion method of the present invention, fig. 5 is a third flowchart illustrating the process of performing picture conversion according to the picture conversion method of the present invention, and fig. 6 is a fourth flowchart illustrating the process of performing picture conversion according to the picture conversion method of the present invention. The picture conversion method comprises the following steps:
step 201, scanning the color of the pixel of the picture to be converted, determining the redundant part of the picture to be converted, and turning to step 202;
step 202, cutting redundant parts of the picture to be converted to obtain a cut picture, and turning to step 203;
step 203, carrying out picture abbreviating on the cut picture to obtain a converted picture;
the picture conversion method ends in step 203.
The redundant part of the picture to be converted comprises at least one of a column area redundant part and a row area redundant part, the column area redundant part comprises at least one of a left redundant part and a right redundant part, and the row area redundant part comprises at least one of an upper redundant part and a lower redundant part.
The following describes a process of cutting the left redundant portion and the right redundant portion of the picture to be converted and completing the picture conversion in the picture conversion method according to the present invention with reference to fig. 3.
The aspect ratio of the first to-be-converted picture in fig. 3 is relatively large (a first setting value may be set to determine the aspect ratio here), that is, the width of the to-be-converted picture is far greater than the height of the to-be-converted picture, for example, if the picture conversion is performed according to the existing conversion method, the height of the converted picture is too small, which causes unclear text content in the converted picture, so the picture conversion method of the present invention cuts the picture in the width direction, which is specifically as follows:
in step 201, scanning the colors of the pixels of the picture to be converted from left to right column by column, and if the colors of all the pixels of a scanned column are the same, determining that the scanned column belongs to a left redundant part; then continuing to scan a column of adjacent pixels on the right, and judging a redundant part on the left; if the colors of the pixels in the scanned columns are different, stopping scanning, so that all the scanned columns scanned on the left side of the picture to be converted belong to a left redundant part in the redundant parts of the picture to be converted;
then scanning the colors of the pixels of the picture to be converted from right to left column by column, and if the colors of all the pixels of a scanned column are the same, judging that the scanned column belongs to a right redundant part; then continuing to scan pixels in a left column adjacent to the left column, and judging a redundant part on the right side; if the pixel colors in the scanned columns are different, the scanning is stopped, so that all the scanned columns scanned on the right side of the picture to be converted belong to the right redundant part in the redundant part of the picture to be converted.
In step 202, the left redundant portion and the right redundant portion of the first picture in fig. 3 to be converted are clipped to obtain a clipped picture, such as the second picture in fig. 3.
In step 203, the clipped picture (the second picture in fig. 3) is subjected to picture reduction to obtain a final converted picture (e.g., the third picture in fig. 3). The picture is suitable for being displayed on the mobile terminal in size, and the text content on the picture is clearly visible.
Of course, the redundant part of the column area may be scanned from left to right or from right to left according to the area, and is not necessarily scanned from the edge of the picture to be converted.
The following describes a process of cutting the upper redundant portion and the lower redundant portion of the picture to be converted and completing the picture conversion in the picture conversion method according to the present invention with reference to fig. 4.
The width-height ratio of the first to-be-converted picture in fig. 4 is smaller (a second setting value may be set to determine the width-height ratio), that is, the height of the to-be-converted picture is far greater than the width of the to-be-converted picture, for example, if the width of the converted picture is too small by performing picture conversion according to the existing conversion method, the text content in the converted picture is unclear, and therefore, the picture conversion method of the present invention may cut the picture in the height direction, specifically as follows:
in step 201, scanning the colors of the pixels of the picture to be converted line by line from top to bottom, and if the colors of all the pixels of a scanned line are the same, determining that the scanned line belongs to the upper side redundant part; then continuing to scan the adjacent lower line of pixels and judging the redundant part on the upper side; stopping scanning if the colors of the pixels in the scanned lines are different, so that all the scanned lines scanned on the upper side of the picture to be converted belong to the upper redundant part in the redundant part of the picture to be converted;
then, scanning the colors of the pixels of the picture to be converted line by line from bottom to top, and if the colors of all the pixels of a scanned line are the same, judging that the scanned line belongs to a lower side redundant part; then, continuously scanning the adjacent upper line of pixels, and judging the lower redundant part; if the pixel colors in the scanned lines are different, the scanning is stopped, so that all the scanned lines scanned at the lower side of the picture to be converted belong to the lower redundant part in the redundant part of the picture to be converted.
In step 202, the upper redundant portion and the lower redundant portion of the first picture in fig. 4 to be converted are cut to obtain a cut picture, such as the second picture in fig. 4.
In step 203, the clipped picture (the second picture in fig. 4) is subjected to picture reduction to obtain a final converted picture (e.g., the third picture in fig. 4). The picture is suitable for being displayed on the mobile terminal in size, and the text content on the picture is clearly visible.
Of course, the redundant part of the row area may be scanned from top to bottom or from bottom to top by area, and it is not necessary to start scanning from the edge of the picture to be converted.
The following describes a process of cutting the column redundancy in the width direction of the picture to be converted and completing the picture conversion in the picture conversion method according to the present invention with reference to fig. 5.
The aspect ratio of the first to-be-converted picture in fig. 5 is relatively large (a third setting value may be set to determine the aspect ratio), that is, the width of the to-be-converted picture is far greater than the height of the to-be-converted picture, for example, if the picture conversion is performed according to the existing conversion method, the height of the converted picture is too small, which causes unclear text content in the converted picture, and therefore, the picture conversion method of the present invention may cut the picture in the width direction, which is specifically as follows:
in step 201, scanning the color of the pixels of the picture to be converted column by column, and if the color of the pixels in the corresponding rows of two adjacent scanned columns is the same, determining that the two adjacent scanned columns belong to the column redundancy part; and then, continuing to scan the pixels of other columns, and judging the redundant parts of the columns until all the pixels of the picture to be converted are scanned. In this way, the column redundancy part among the redundancy parts of the picture to be converted can be determined.
In step 202, the column redundancy part (mainly the part located in the middle of the picture to be converted) of the first picture to be converted in fig. 5 is cut, so as to obtain a cut picture, such as the second picture in fig. 5.
In step 203, the cut-down picture (the second picture in fig. 5) may be subjected to picture conversion according to the size ratio between the picture to be converted (e.g., a web page picture) and the corresponding converted picture (e.g., a mobile phone picture), so as to obtain a final converted picture (e.g., the third picture in fig. 5). The picture is suitable for being displayed on the mobile terminal in size, and the text content on the picture is clearly visible.
The following describes a process of cutting down a row redundancy portion in a height direction of a picture to be converted and completing picture conversion in the picture conversion method according to the present invention with reference to fig. 6.
The width-height ratio of the first to-be-converted picture in fig. 6 is small (a fourth setting value may be set to determine the width-height ratio here), that is, the height of the to-be-converted picture is far greater than the width of the to-be-converted picture, for example, if the width of the converted picture is too small by performing picture conversion according to the existing conversion method, the text content in the converted picture is unclear, and therefore, the picture conversion method of the present invention may cut the picture in the height direction, which is specifically as follows:
in step 201, scanning the colors of the pixels of the picture to be converted line by line, and if the colors of the pixels in the corresponding columns of two adjacent scanned lines are the same, determining that the two adjacent scanned lines belong to a line redundancy part; and then continuing to scan the pixels of other rows, and judging the row redundancy part until all the pixels of the picture to be converted are scanned. In this way, the row redundancy part among the redundancy parts of the picture to be converted can be determined.
In step 202, the row redundant portion (mainly the portion located in the middle of the picture to be converted) of the first picture to be converted in fig. 6 is cut, so as to obtain a cut picture, such as the second picture in fig. 6.
In step 203, the clipped picture (the second picture in fig. 6) is subjected to picture conversion, so as to obtain a final converted picture (e.g., the third picture in fig. 6). The picture is suitable for being displayed on the mobile terminal in size, and the text content on the picture is clearly visible.
How to perform the determination (decision) process of the left redundant portion, the right redundant portion, the upper redundant portion, the lower redundant portion, the column redundant portion, and the row redundant portion of the redundant portions of the picture to be converted is specifically described above by fig. 3 to 6. It should be noted that, for a picture to be converted with a large aspect ratio, the left redundant portion, the right redundant portion and the column redundant portion are generally determined at the same time, and a specific method is as shown in the embodiment of redundant portion determination corresponding to fig. 3 and fig. 5. For a picture to be converted with a small aspect ratio, the determination of the upper redundant portion, the lower redundant portion and the row redundant portion is generally performed at the same time, and a specific method is shown in the embodiment of the redundant portion determination corresponding to fig. 4 and fig. 6.
For some special pictures, although the aspect ratio is not particularly large or small, in order to reduce the size of the converted picture and achieve the best display effect on the mobile terminal, the above determination of one or more redundant portions may be used, and the redundant portion may be cut, such as the left redundant portion, the right redundant portion, the upper redundant portion, and the lower redundant portion, to remove the blank around the picture to be converted.
When the redundant part of the picture to be converted is cut, in order to avoid that the text content of the cut picture is too crowded so as to influence the beauty of the converted picture, the redundant part can be partially cut instead of being completely cut, for example, a set number of pixel rows or pixel columns of the redundant part are left, so that the normal gap between the texts is ensured. The present invention is not limited in the scope of protection as long as the determination of the redundant portion of the picture to be converted and the cutting of the redundant portion in the picture conversion method of the present invention are used, and the number of the cutting of the redundant portion and how to cut the redundant portion are not limited in the scope of protection of the present invention.
Referring to fig. 7, fig. 7 is a flowchart illustrating a picture conversion method according to a second preferred embodiment of the invention. The picture conversion method comprises the following steps:
step 701, judging whether to determine a redundant part of the picture to be converted according to the aspect ratio, the width and the height of the picture to be converted, if so, turning to step 702, and otherwise, turning to step 704;
step 702, scanning the color of the pixel of the picture to be converted, determining the redundant part of the picture to be converted, and turning to step 703;
step 703, cutting the redundant part of the picture to be converted to obtain a cut picture, and going to step 704;
step 704, carrying out picture abbreviating on the cut picture to obtain a converted picture;
the picture conversion method ends in step 704.
The present preferred embodiment differs from the first preferred embodiment described above in that: before the redundant part of the picture to be converted is judged and cut, whether the picture to be converted is cut or not is judged, so that the picture to be converted which does not need to be cut can be prevented from being cut, and the processing resource of a server is saved. The process of determining whether to perform clipping is specifically as follows:
if the aspect ratio of the picture to be converted is greater than the fifth set value and the width of the picture to be converted is greater than the sixth set value, that is, the aspect ratio of the picture to be converted is greater and the width of the picture to be converted is greater. After the pictures to be converted are reduced in proportion, the height of the reduced pictures is too small, so that the definition of the text content is affected, and therefore redundant parts (mainly, a left redundant part, a right redundant part and a column redundant part) of the pictures to be converted are cut down, so that the reading effect of the converted pictures is improved. The fifth setting value and the sixth setting value can be adjusted according to the actual use effect of the user.
If the aspect ratio of the picture to be converted is smaller than the seventh setting value and the height of the picture to be converted is larger than the eighth setting value, that is, the aspect ratio of the picture to be converted is smaller and the height of the picture to be converted is larger, so that after the picture to be converted is reduced in proportion, the width of the reduced picture is too small, thereby affecting the definition degree of the text content, and therefore, redundant parts (mainly an upper redundant part, a lower redundant part and a line redundant part) of the picture to be converted are cut down to improve the reading effect of the converted picture. The seventh setting value and the eighth setting value can be adjusted according to the actual use effect of the user.
If the aspect ratio of the picture to be converted is greater than the seventh setting value and less than the fifth setting value, the aspect ratio of the picture to be converted is greater than the fifth setting value but the width is less than the sixth setting value or the aspect ratio of the picture to be converted is less than the seventh setting value but the height is less than the eighth setting value, that is, the picture to be converted is directly subjected to the thumbnail processing without being subjected to the above reduction, and the influence on the definition degree of the text content in the thumbnail picture is not large, so that the picture to be converted can be directly subjected to the picture thumbnail processing without being subjected to the judgment and reduction of the redundant part, and the processing resources of the server are saved.
Referring to fig. 8, fig. 8 is a schematic structural diagram of a picture conversion device according to a first preferred embodiment of the present invention. The picture conversion apparatus includes a redundant scan module 81, a cropping module 82, and a thumbnail module 83. The redundant scanning module 81 is configured to scan colors of pixels of the picture to be converted, and determine a redundant portion of the picture to be converted; the cutting module 82 is configured to cut a redundant portion of the picture to be converted to obtain a cut picture; the abbreviating module 83 is configured to crop redundant parts of the picture to be converted, so as to obtain a cropped picture.
The redundant part of the picture to be converted comprises at least one of a column area redundant part and a row area redundant part, the column area redundant part comprises at least one of a left redundant part and a right redundant part, and the row area redundant part comprises at least one of an upper redundant part and a lower redundant part.
The redundant scanning module 81 includes a column area redundant scanning sub-module, a row area redundant scanning sub-module, a column redundant scanning unit, and a row redundant scanning unit.
The column region redundancy scanning submodule is used for scanning the pixel colors of the picture to be converted column by column according to regions, and if the colors of all pixels of a scanned column are the same, the scanned column is judged to belong to the column region redundancy part.
The line area redundancy scanning submodule is used for scanning the pixel colors of the picture to be converted line by line according to the area, and if the colors of all pixels of a scanned line are the same, the scanned line is judged to belong to the line area redundancy part.
The column region redundancy scanning submodule comprises a left redundancy scanning unit and a right redundancy scanning unit; the row area redundancy scanning submodule comprises an upper redundancy scanning unit and a lower redundancy scanning unit.
The left redundant scanning unit is used for scanning the colors of the pixels of the picture to be converted from left to right column by column, if the colors of all the pixels of a scanned column are the same, the scanned column is judged to belong to the left redundant part, and if not, the scanning is stopped.
The right redundant scanning unit is used for scanning the colors of the pixels of the picture to be converted from right to left column by column, if the colors of all the pixels of a scanned column are the same, the scanned column is judged to belong to the right redundant part, and if not, the scanning is stopped.
The upper side redundant scanning unit is used for scanning the colors of the pixels of the picture to be converted line by line from top to bottom, if the colors of all the pixels of a scanned line are the same, the scanned line is judged to belong to the upper side redundant part, and if not, the scanning is stopped.
The lower side redundant scanning unit is used for scanning the colors of the pixels of the picture to be converted line by line from bottom to top, if the colors of all the pixels of a scanned line are the same, the scanned line is judged to belong to the lower side redundant part, and if not, the scanning is stopped.
The column redundancy scanning unit is used for scanning the colors of the pixels of the picture to be converted column by column, and if the colors of the pixels of the corresponding rows of two adjacent scanned columns are the same, the two adjacent scanned columns are judged to belong to the column redundancy part.
The line redundancy scanning unit is used for scanning the colors of the pixels of the picture to be converted line by line, and if the colors of the pixels of the corresponding columns of two adjacent scanned lines are the same, the two adjacent scanned lines are judged to belong to the line redundancy part.
The specific working principle of the left redundant scan cell and the right redundant scan cell is shown as step 201 in the specific embodiment corresponding to fig. 3; the specific working principle of the upper redundant scan unit and the lower redundant scan unit is shown as step 201 in the specific embodiment corresponding to fig. 4; the operation principle of the column redundancy scan unit is shown as step 201 in the embodiment corresponding to fig. 5, and the operation principle of the row redundancy scan unit is shown as step 201 in the embodiment corresponding to fig. 6.
It should be noted that, for a picture to be converted with a large aspect ratio, the left redundant scan unit is generally used to determine the left redundant portion, the right redundant scan unit is generally used to determine the right redundant portion, and the column redundant scan unit is generally used to determine the column redundant portion. For a picture to be converted with a small aspect ratio, the upper redundant scanning unit is generally used for determining the upper redundant part, the lower redundant scanning unit is generally used for determining the lower redundant part, and the line redundant scanning unit is generally used for determining the line redundant part.
Referring to fig. 9, fig. 9 is a schematic structural diagram of a picture conversion device according to a second preferred embodiment of the invention. The picture conversion apparatus in the preferred embodiment further includes a clipping determination module 91, and the clipping determination module 91 is configured to determine whether to determine a redundant portion of the picture to be converted according to the aspect ratio, the width, and the height of the picture to be converted.
The clipping determination module 91 can determine whether to clip the to-be-converted picture before the redundant portion of the to-be-converted picture is determined and clipped, so that clipping of the to-be-converted picture which does not need clipping can be avoided, and processing resources of the server can be saved. The judgment process of the cut judgment module 91 is as follows:
if the aspect ratio of the picture to be converted is greater than the fifth setting value and the width of the picture to be converted is greater than the sixth setting value, redundant parts (mainly, a left redundant part, a right redundant part and a column redundant part) of the picture to be converted are cut. The fifth setting value and the sixth setting value can be adjusted according to the actual use effect of the user.
If the aspect ratio of the picture to be converted is smaller than the seventh setting value and the height of the picture to be converted is larger than the eighth setting value, the redundant parts (mainly the upper redundant part, the lower redundant part and the row redundant part) of the picture to be converted are cut. The seventh setting value and the eighth setting value can be adjusted according to the actual use effect of the user.
If the aspect ratio of the picture to be converted is greater than the seventh setting value and less than the fifth setting value, the aspect ratio of the picture to be converted is greater than the fifth setting value but the width is less than the sixth setting value or the aspect ratio of the picture to be converted is less than the seventh setting value but the height is less than the eighth setting value, so that the picture to be converted can be directly subjected to the picture reduction processing without judging and cutting redundant parts, and processing resources of a server are saved.
The picture conversion method and the picture conversion device judge the redundant part of the original picture and cut the redundant part of the original picture, and solve the technical problem that the text content in the picture converted by the conventional picture conversion method and the conventional picture conversion device is possibly unclear.
In summary, although the present invention has been described with reference to the preferred embodiments, the above-described preferred embodiments are not intended to limit the present invention, and those skilled in the art can make various changes and modifications without departing from the spirit and scope of the present invention, therefore, the scope of the present invention shall be determined by the appended claims.

Claims (14)

1. A picture conversion method, comprising the steps of:
if the aspect ratio of the picture to be converted is greater than a fifth set value and the width of the picture to be converted is greater than a sixth set value, scanning the colors of the pixels of the picture to be converted, wherein the colors of the pixels of the picture to be converted are scanned column by column, if the colors of the pixels of the corresponding rows of two adjacent scanned columns are the same, judging that the two adjacent scanned columns belong to a column redundancy part, then continuing to scan the pixels of other columns, and judging the column redundancy part until all the pixels of the picture to be converted are scanned; alternatively, the first and second electrodes may be,
if the aspect ratio of the picture to be converted is smaller than a seventh set value and the height of the picture to be converted is larger than an eighth set value, scanning the colors of the pixels of the picture to be converted, wherein the colors of the pixels of the picture to be converted are scanned line by line, if the colors of the pixels of the corresponding columns of two adjacent scanned lines are the same, judging that the two adjacent scanned lines belong to a line redundancy part, then continuing to scan the pixels of other lines, and judging the line redundancy part until all the pixels of the picture to be converted are scanned;
determining a redundant part of the picture to be converted;
cutting the redundant part of the picture to be converted to obtain a cut picture; and
carrying out picture abbreviative operation on the cut picture to obtain a converted picture;
if the aspect ratio of the picture to be converted is greater than a seventh setting value and less than a fifth setting value, the aspect ratio of the picture to be converted is greater than the fifth setting value but the width is less than a sixth setting value, or the aspect ratio of the picture to be converted is less than the seventh setting value but the height is less than an eighth setting value, the picture to be converted is not subjected to judgment and cutting of redundant parts, and picture reduction processing is directly performed.
2. The picture conversion method according to claim 1,
the redundant part comprises at least one of a column area redundant part and a row area redundant part; wherein:
the step of determining the column area redundant part of the picture to be converted comprises the following steps:
scanning the pixel colors of the picture to be converted column by column according to the region, and if the colors of all pixels of a scanned column are the same, judging that the scanned column belongs to the redundant part of the column region;
the step of determining the row region redundant part of the picture to be converted comprises the following steps:
and scanning the pixel colors of the picture to be converted line by line according to the region, and if the colors of all pixels of a scanned line are the same, judging that the scanned line belongs to the line region redundant part.
3. The picture conversion method according to claim 2,
the column region redundancy part includes at least one of a left redundancy part and a right redundancy part, and the row region redundancy part includes at least one of an upper redundancy part and a lower redundancy part; wherein:
the step of determining the left redundant part of the picture to be converted comprises the following steps:
scanning the colors of the pixels of the picture to be converted from left to right column by column, if the colors of all the pixels of a scanned column are the same, judging that the scanned column belongs to the left redundant part, and if not, stopping scanning;
the step of determining the right redundant part of the picture to be converted comprises the following steps:
scanning the colors of the pixels of the picture to be converted from right to left column by column, if the colors of all the pixels of a scanned column are the same, judging that the scanned column belongs to the right redundant part, and if not, stopping scanning;
the step of determining the upper side redundant part of the picture to be converted comprises the following steps:
scanning the colors of the pixels of the picture to be converted line by line from top to bottom, if the colors of all the pixels of a scanned line are the same, judging that the scanned line belongs to the upper side redundant part, and if not, stopping scanning;
the step of determining the lower redundant part of the picture to be converted comprises the following steps:
and scanning the colors of the pixels of the picture to be converted line by line from bottom to top, if the colors of all the pixels of a scanned line are the same, judging that the scanned line belongs to the lower side redundant part, and otherwise, stopping scanning.
4. The picture conversion method according to claim 3,
when the aspect ratio of the picture to be converted is larger than a first set value, judging the left redundant part and the right redundant part of the picture to be converted;
and when the aspect ratio of the picture to be converted is smaller than a second set value, judging the upper redundant part and the lower redundant part of the picture to be converted.
5. The picture conversion method according to claim 1, wherein the redundant portion further includes at least one of a column redundant portion and a row redundant portion;
the step of determining the column redundancy part of the picture to be converted comprises the following steps:
scanning the colors of the pixels of the picture to be converted column by column, and if the colors of the pixels of the corresponding rows of two adjacent scanned columns are the same, judging that the two adjacent scanned columns belong to the column redundancy part;
the step of determining the row redundancy part of the picture to be converted comprises the following steps:
and scanning the colors of the pixels of the picture to be converted line by line, and if the colors of the pixels of the corresponding columns of two adjacent scanned lines are the same, judging that the two adjacent scanned lines belong to the line redundancy part.
6. The picture conversion method according to claim 5,
when the aspect ratio of the picture to be converted is larger than a third set value, judging the column redundancy part of the picture to be converted;
and when the aspect ratio of the picture to be converted is smaller than a fourth set value, judging the row redundancy part of the picture to be converted.
7. The method according to claim 1, wherein the step of performing the picture reduction on the cropped picture to obtain the converted picture specifically comprises:
and abbreviating the cut picture according to the size ratio of the webpage picture to the corresponding mobile phone picture to obtain a converted picture.
8. A picture conversion apparatus, comprising:
a cropping determination module to: if the aspect ratio of the picture to be converted is greater than a fifth set value and the width of the picture to be converted is greater than a sixth set value, or if the aspect ratio of the picture to be converted is less than a seventh set value and the height of the picture to be converted is greater than an eighth set value, determining a redundant part of the picture to be converted;
the redundant scanning module is used for scanning the colors of the pixels of the picture to be converted, wherein the colors of the pixels of the picture to be converted are scanned column by column, if the colors of the pixels of the corresponding rows of two adjacent scanned columns are the same, the two adjacent scanned columns are judged to belong to a column redundant part, then the pixels of other columns are continuously scanned, and the judgment of the column redundant part is carried out until all the pixels of the picture to be converted are scanned completely; alternatively, the first and second electrodes may be,
if the colors of the pixels of the corresponding columns of the two adjacent scanned rows are the same, judging that the two adjacent scanned rows belong to a row redundancy part, then continuing to scan the pixels of other rows, judging the row redundancy part until all the pixels of the picture to be converted are scanned, and determining the redundancy part of the picture to be converted;
the cutting module is used for cutting the redundant part of the picture to be converted to obtain a cut picture; and
and the abbreviating module is used for abbreviating the cut picture to obtain the converted picture, and if the aspect ratio of the picture to be converted is greater than a seventh set value and less than a fifth set value, the aspect ratio of the picture to be converted is greater than the fifth set value and the width is less than a sixth set value, or the aspect ratio of the picture to be converted is less than the seventh set value and the height is less than an eighth set value, the picture to be converted is not subjected to judgment and cutting of redundant parts, and the picture is directly subjected to abbreviating treatment.
9. The picture conversion device according to claim 8,
the redundant part comprises at least one of a column area redundant part and a row area redundant part;
the redundant scan module includes:
the column region redundancy scanning submodule is used for scanning the pixel colors of the picture to be converted column by column according to regions, and if the colors of all pixels of a scanned column are the same, the scanned column is judged to belong to the column region redundancy part; and
and the line region redundancy scanning sub-module is used for scanning the pixel colors of the picture to be converted line by line according to regions, and if the colors of all pixels of a scanned line are the same, judging that the scanned line belongs to the line region redundancy part.
10. The picture conversion device according to claim 9,
the column region redundancy part includes at least one of a left redundancy part and a right redundancy part, and the row region redundancy part includes at least one of an upper redundancy part and a lower redundancy part;
the column region redundancy scanning sub-module comprises:
the left redundant scanning unit is used for scanning the colors of the pixels of the picture to be converted from left to right column by column, if the colors of all the pixels of a scanned column are the same, the scanned column is judged to belong to the left redundant part, and if not, the scanning is stopped; and
the right redundant scanning unit is used for scanning the colors of the pixels of the picture to be converted from right to left column by column, if the colors of all the pixels of a scanned column are the same, the scanned column is judged to belong to the right redundant part, and if not, the scanning is stopped;
the row area redundancy scanning sub-module comprises:
the upper side redundant scanning unit is used for scanning the colors of the pixels of the picture to be converted line by line from top to bottom, if the colors of all the pixels of a scanned line are the same, the scanned line is judged to belong to the upper side redundant part, and if not, the scanning is stopped; and
and the lower side redundant scanning unit is used for scanning the colors of the pixels of the picture to be converted line by line from bottom to top, if the colors of all the pixels of a scanned line are the same, the scanned line is judged to belong to the lower side redundant part, and if not, the scanning is stopped.
11. The picture conversion apparatus according to claim 10,
when the aspect ratio of the picture to be converted is larger than a first set value, the left redundant scanning unit judges the left redundant part of the picture to be converted, and the right redundant scanning unit judges the right redundant part of the picture to be converted;
when the aspect ratio of the picture to be converted is smaller than a second set value, the upper redundant scanning unit judges the upper redundant part of the picture to be converted, and the lower redundant scanning unit judges the lower redundant part of the picture to be converted.
12. The picture conversion device according to claim 8,
the redundant portion further comprises at least one of a column redundant portion and a row redundant portion;
the redundant scan module further comprises:
the column redundancy scanning unit is used for scanning the colors of the pixels of the picture to be converted column by column, and if the colors of the pixels of the corresponding rows of two adjacent scanned columns are the same, the two adjacent scanned columns are judged to belong to the column redundancy part; and
and the line redundancy scanning unit is used for scanning the colors of the pixels of the picture to be converted line by line, and if the colors of the pixels of the corresponding columns of two adjacent scanned lines are the same, judging that the two adjacent scanned lines belong to the line redundancy part.
13. The picture conversion device according to claim 12,
when the aspect ratio of the picture to be converted is larger than a third set value, the column redundancy scanning unit judges the column redundancy part of the picture to be converted;
when the aspect ratio of the picture to be converted is smaller than a fourth set value, the line redundancy scanning unit judges the line redundancy part of the picture to be converted.
14. The image conversion apparatus according to claim 8, wherein the abbreviating module is specifically configured to abbreviate the cropped image according to a size ratio between a web page image and a corresponding mobile phone image, so as to obtain the converted image.
CN201210315470.8A 2012-08-30 2012-08-30 Picture conversion method and device Active CN103678300B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201210315470.8A CN103678300B (en) 2012-08-30 2012-08-30 Picture conversion method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201210315470.8A CN103678300B (en) 2012-08-30 2012-08-30 Picture conversion method and device

Publications (2)

Publication Number Publication Date
CN103678300A CN103678300A (en) 2014-03-26
CN103678300B true CN103678300B (en) 2020-02-07

Family

ID=50315907

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201210315470.8A Active CN103678300B (en) 2012-08-30 2012-08-30 Picture conversion method and device

Country Status (1)

Country Link
CN (1) CN103678300B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107748644A (en) * 2017-11-20 2018-03-02 珠海市魅族科技有限公司 A kind of sectional drawing display methods and equipment, terminal and readable storage medium storing program for executing

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1670758A (en) * 2004-03-17 2005-09-21 德鑫科技股份有限公司 Automatic cutting method for digital image

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100787977B1 (en) * 2006-03-30 2007-12-24 삼성전자주식회사 Apparatus and method for controlling size of user data in a portable terminal
CN101146128A (en) * 2007-10-30 2008-03-19 杨金钰 Method for allowing small-screen mobile terminal to access and browse WWW websites
US8326078B2 (en) * 2009-01-27 2012-12-04 Hewlett-Packard Development Company, L.P. System and method for removing artifacts from a digitized document
CN101547323B (en) * 2009-04-30 2011-04-13 华为终端有限公司 Image conversion method, device and display system
CN102201053B (en) * 2010-12-10 2013-07-24 上海合合信息科技发展有限公司 Method for cutting edge of text image

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1670758A (en) * 2004-03-17 2005-09-21 德鑫科技股份有限公司 Automatic cutting method for digital image

Also Published As

Publication number Publication date
CN103678300A (en) 2014-03-26

Similar Documents

Publication Publication Date Title
CN110837617B (en) Webpage self-adaptive layout method, server and computer readable storage medium
CN107885848B (en) Webpage screen capturing method based on web technology
CN102254302B (en) Picture trimming system and method thereof
CN107092684A (en) Image processing method and device, storage medium
JP2008192159A (en) Browser program, method and device for performing table layout
CN105069060B (en) HTML document paging typesetting method
CN102810043A (en) Method, system and information terminal for displaying weather information of mobile terminal
CN102789448A (en) Electronic data typesetting method and device
CN103186505B (en) A kind of method and apparatus determining display mode of electronic document
CN103678300B (en) Picture conversion method and device
US11985287B2 (en) Image processing method, image processing device, electronic apparatus and storage medium
CN103870444A (en) Image cutting method and system for image type texts
CN105791524B (en) A kind of method and device adjusting page font
CN105389308A (en) Display processing method and device for web pages
CN106843626A (en) A kind of content share method in instant video call
CN113762235A (en) Method and device for detecting page overlapping area
US8913072B2 (en) Method and terminal for implementing display cache
CN112199149A (en) Interface rendering method and device and electronic equipment
CN105589883B (en) Method and device for displaying page elements of webpage
CN107797972B (en) Method and terminal for displaying characters
US20070274594A1 (en) Outline definition apparatus and outline definition method, and image processing apparatus
CN106780306B (en) Reconstruction draft generation method and device
CN106997267B (en) Method and device for controlling display of terminal
CN106488314A (en) A kind of barrage rendering intent
CN106385616B (en) A kind of display methods and device for video screen

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
EXSB Decision made by sipo to initiate substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant