Disclosure of Invention
The invention mainly aims to provide a method, a terminal and a readable storage medium for converting a document into a picture, and aims to solve the technical problem of how to obtain pictures with rich and variable styles through document conversion in the prior art and avoid secondary processing of a user.
In order to achieve the above object, the present invention provides a method for converting a document into a picture, which is applied to a message consumption end, and the method for converting a document into a picture includes:
acquiring a document to be converted, and converting the document to be converted into an intermediate document in a preset format based on a preset intermediate component;
converting the intermediate document into an intermediate picture based on a preset conversion component, and acquiring a to-be-converted style corresponding to the to-be-converted document;
and identifying a pattern position corresponding to the pattern to be converted in the intermediate picture, and processing the picture content of the intermediate picture at the pattern position based on the pattern to be converted to obtain a converted final picture.
Optionally, the step of converting the intermediate document into the intermediate picture based on the preset conversion component includes:
identifying whether the intermediate document is a multi-page document or not based on a preset conversion component, and if so, outputting first inquiry information whether the intermediate document is converted into a single picture or not;
if positive response information corresponding to the first inquiry information is received, merging and converting the intermediate document into a single intermediate picture based on the preset conversion component;
and if negative response information corresponding to the first inquiry information is received, identifying a paging identifier of the intermediate document based on the preset conversion component, and converting the intermediate document into a plurality of intermediate pictures according to the paging identifier.
Optionally, the step of converting the intermediate document into the intermediate picture based on the preset conversion component includes:
identifying blank areas in the intermediate document based on a preset conversion component, and identifying size information and color information of the intermediate document after cutting the blank areas from the intermediate document;
outputting second inquiry information whether to adjust the size information and the color information based on the preset conversion component, and outputting a size and color adjustment dialog box if positive response information corresponding to the second inquiry information is received;
after a size adjustment parameter and/or a color adjustment parameter are/is acquired based on the size and color adjustment dialog box, converting the intermediate document into an intermediate image based on a preset conversion component by using the size adjustment parameter and/or the color adjustment parameter;
and if negative response information corresponding to the second inquiry information is received, converting the intermediate document into an intermediate picture by using the size information and the color information based on a preset conversion component.
Optionally, the processing the picture content of the intermediate picture at the pattern position to obtain a converted final picture includes:
processing the picture content of the intermediate picture on the pattern position to obtain an intermediate picture to be detected, detecting whether the resolution value of the intermediate picture to be detected is matched with a preset reference resolution, and if the resolution value of the intermediate picture to be detected is matched with the preset reference resolution, generating the intermediate picture to be detected into a final picture;
if the resolution value is not matched with the preset reference resolution, the resolution value of the intermediate picture to be detected is adjusted based on a preset picture instruction until the resolution value is adjusted to be matched with the preset reference resolution, and the intermediate picture to be detected is generated into a final picture.
Optionally, the step of detecting whether the resolution value of the intermediate picture to be detected matches a preset reference resolution includes:
receiving a resolution setting value and setting the resolution setting value as the preset reference resolution;
the step of detecting whether the resolution value of the intermediate picture to be detected is matched with a preset reference resolution includes:
comparing the detected resolution value of the intermediate picture to be detected with the preset reference resolution, and judging whether the resolution value is greater than or equal to the preset reference resolution or not;
if the resolution value is greater than or equal to the preset reference resolution, judging that the resolution value is matched with the preset reference resolution;
and if the resolution value is smaller than the preset reference resolution, judging that the resolution value is not matched with the preset reference resolution.
Optionally, the preset picture instruction is a resolution adjustment instruction, and the step of adjusting the resolution value of the intermediate picture to be detected based on the preset picture instruction includes:
acquiring a resolution to be adjusted based on the resolution adjustment instruction, and judging whether the resolution to be adjusted is smaller than the resolution setting value;
if the resolution ratio is smaller than the resolution ratio set value, outputting prompt information for reacquiring the resolution ratio to be adjusted until the resolution ratio to be adjusted is larger than or equal to the resolution ratio set value;
and if the resolution to be adjusted is greater than or equal to the resolution setting value, adjusting the resolution value of the intermediate picture to be detected with the resolution to be adjusted based on the resolution adjusting instruction.
Optionally, the step of obtaining the document to be converted and converting the document to be converted into the intermediate document in the preset format based on the preset intermediate component includes:
when the document to be converted is obtained, calling a preset intermediate component to identify the document type of the document to be converted, and judging whether the document type is a preset type supporting conversion or not;
and if the document is a preset type supporting conversion, converting the document to be converted into an intermediate document in a preset format based on a preset intermediate component.
Optionally, the preset types at least include a word document type, a PPT document type, and an Excel document type.
Further, to achieve the above object, the present invention also provides a terminal for converting a document into a picture, including: a memory, a processor and a control program stored on the memory and executable on the processor, the control program, when executed by the processor, implementing the steps of the method of converting a document into a picture as described above.
Further, to achieve the above object, the present invention also provides a readable storage medium, on which a control program is stored, which when executed by a processor implements the steps of the method for converting a document into a picture as described above.
After a document to be converted is obtained, the document to be converted is converted into an intermediate document with a preset format through a preset intermediate component, the intermediate document is converted into an intermediate picture through the preset conversion component, a style to be converted corresponding to the document to be converted is obtained, a style position corresponding to the style to be converted in the intermediate picture is further identified, and picture content of the intermediate picture on the style position is processed according to the style to be converted to obtain a converted final picture. Therefore, the pictures with rich styles are obtained by acquiring the styles to be converted corresponding to the documents to be converted and processing the style positions needing style setting in the documents to be converted according to the styles to be converted, secondary processing of the pictures by a user is avoided, accurate conversion of the pictures is realized, and the efficiency of picture conversion processing is improved.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
The invention provides a terminal for converting a document into a picture.
Referring to fig. 1, fig. 1 is a schematic structural diagram of a hardware operating environment according to an embodiment of the terminal for converting a document into a picture.
As shown in fig. 1, the terminal for converting a document into a picture may include a processor 1001, such as a CPU, a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. Wherein a communication bus 1002 is used to enable connective communication between these components. The user interface 1003 may include a Display screen (Display), an input unit such as a Keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface, a wireless interface. The network interface 1004 may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface). The memory 1005 may be a high-speed RAM memory or a non-volatile memory (e.g., a magnetic disk memory). The memory 1005 may alternatively be a memory device separate from the processor 1001 described above.
Those skilled in the art will appreciate that the hardware configuration of the terminal for converting a document into a picture shown in fig. 1 does not constitute a limitation of the terminal for converting a document into a picture, and may include more or less components than those shown, or combine some components, or arrange different components.
As shown in fig. 1, a memory 1005, which is a readable storage medium, may include therein an operating system, a network communication module, a user interface module, and a control program. The operating system is a program for managing and controlling a terminal for converting a document into a picture and software resources, and supports the operation of a network communication module, a user interface module, a control program and other programs or software; the network communication module is used to manage and control the network interface 1004; the user interface module is used to manage and control the user interface 1003.
In the terminal hardware structure for converting a document into a picture shown in fig. 1, the network interface 1004 is mainly used for connecting to a background server and communicating with the background server; the user interface 1003 is mainly used for connecting a client (user side) and performing data communication with the client; the processor 1001 may call the control program stored in the memory 1005 and perform the following operations:
acquiring a document to be converted, and converting the document to be converted into an intermediate document in a preset format based on a preset intermediate component;
converting the intermediate document into an intermediate picture based on a preset conversion component, and acquiring a to-be-converted style corresponding to the to-be-converted document;
and identifying a pattern position corresponding to the pattern to be converted in the intermediate picture, and processing the picture content of the intermediate picture at the pattern position based on the pattern to be converted to obtain a converted final picture.
Further, the step of converting the intermediate document into the intermediate picture based on the preset conversion component comprises:
identifying whether the intermediate document is a multi-page document or not based on a preset conversion component, and if so, outputting first inquiry information whether the intermediate document is converted into a single picture or not;
if positive response information corresponding to the first inquiry information is received, merging and converting the intermediate document into a single intermediate picture based on the preset conversion component;
and if negative response information corresponding to the first inquiry information is received, identifying a paging identifier of the intermediate document based on the preset conversion component, and converting the intermediate document into a plurality of intermediate pictures according to the paging identifier.
Further, the step of converting the intermediate document into the intermediate picture based on the preset conversion component comprises:
identifying blank areas in the intermediate document based on a preset conversion component, and identifying size information and color information of the intermediate document after cutting the blank areas from the intermediate document;
outputting second inquiry information whether to adjust the size information and the color information based on the preset conversion component, and outputting a size and color adjustment dialog box if positive response information corresponding to the second inquiry information is received;
after a size adjustment parameter and/or a color adjustment parameter are/is acquired based on the size and color adjustment dialog box, converting the intermediate document into an intermediate image based on a preset conversion component by using the size adjustment parameter and/or the color adjustment parameter;
and if negative response information corresponding to the second inquiry information is received, converting the intermediate document into an intermediate picture by using the size information and the color information based on a preset conversion component.
Further, the step of processing the picture content of the intermediate picture at the pattern position to obtain a converted final picture includes:
processing the picture content of the intermediate picture on the pattern position to obtain an intermediate picture to be detected, detecting whether the resolution value of the intermediate picture to be detected is matched with a preset reference resolution, and if the resolution value of the intermediate picture to be detected is matched with the preset reference resolution, generating the intermediate picture to be detected into a final picture;
if the resolution value is not matched with the preset reference resolution, the resolution value of the intermediate picture to be detected is adjusted based on a preset picture instruction until the resolution value is adjusted to be matched with the preset reference resolution, and the intermediate picture to be detected is generated into a final picture.
Further, the step of detecting whether the resolution value of the intermediate picture to be detected is matched with a preset reference resolution or not is performed; the processor 1001 may call the control program stored in the memory 1005 and perform the following operations:
receiving a resolution setting value and setting the resolution setting value as the preset reference resolution;
the step of detecting whether the resolution value of the intermediate picture to be detected is matched with a preset reference resolution includes:
comparing the detected resolution value of the intermediate picture to be detected with the preset reference resolution, and judging whether the resolution value is greater than or equal to the preset reference resolution or not;
if the resolution value is greater than or equal to the preset reference resolution, judging that the resolution value is matched with the preset reference resolution;
and if the resolution value is smaller than the preset reference resolution, judging that the resolution value is not matched with the preset reference resolution.
Further, the preset picture instruction is a resolution adjustment instruction, and the step of adjusting the resolution value of the intermediate picture to be detected based on the preset picture instruction includes:
acquiring a resolution to be adjusted based on the resolution adjustment instruction, and judging whether the resolution to be adjusted is smaller than the resolution setting value;
if the resolution ratio is smaller than the resolution ratio set value, outputting prompt information for reacquiring the resolution ratio to be adjusted until the resolution ratio to be adjusted is larger than or equal to the resolution ratio set value;
and if the resolution to be adjusted is greater than or equal to the resolution setting value, adjusting the resolution value of the intermediate picture to be detected with the resolution to be adjusted based on the resolution adjusting instruction.
Further, the step of obtaining the document to be converted and converting the document to be converted into the intermediate document in the preset format based on the preset intermediate component includes:
when the document to be converted is obtained, calling a preset intermediate component to identify the document type of the document to be converted, and judging whether the document type is a preset type supporting conversion or not;
and if the document is a preset type supporting conversion, converting the document to be converted into an intermediate document in a preset format based on a preset intermediate component.
Further, the preset types at least comprise a word document type, a PPT document type and an Excel document type.
The implementation of the terminal for converting a document into a picture according to the present invention is substantially the same as the following embodiments of the method for converting a document into a picture, and will not be described herein again.
The invention provides a method for converting a document into a picture, and referring to fig. 2, fig. 2 is a schematic flow chart of a first embodiment of the method for converting the document into the picture.
While a logical order is shown in the flow chart, in some cases, the steps shown or described may be performed in an order different than that shown or described herein. Specifically, the method for converting a document into a picture of the embodiment includes:
step S10, acquiring a document to be converted, and converting the document to be converted into an intermediate document in a preset format based on a preset intermediate component;
the method for converting the document into the picture is applied to terminals such as smart phones, tablet computers, mobile computers and desktop computers, and is suitable for converting the document into pictures of various styles through components preset in the terminals. The preset component is preferably Java-COM middleware, and the COM component and the win32 library are called in the application to convert the document into pictures with various styles.
Further, in this embodiment, the preset components are divided into a preset intermediate component and a preset conversion component according to different functions, the document to be converted into the picture is used as the document to be converted, and the document to be converted is converted into the intermediate file in the preset format through the preset intermediate component. The preset Format is a Format set in advance according to requirements, and is preferably a pdf (Portable Document Format) Format. And, the transformation of the default middle component is substantially realized by the instruction therein, such as "dispatch. invoke" (presentations, "SaveAs", dispatch. method, new Object [ ] { destPath, new variable (32) }, new int [1]) of the default middle component; the "instruction implements the conversion of the document to be converted into an intermediate document of pdf and saves it for subsequent use.
In addition, the preset intermediate component of the embodiment preferably supports the conversion of the document to be converted with the specific format into the picture, so that before the document to be converted is converted into the intermediate document, it is determined whether the document to be converted has the specific format. Specifically, the step of obtaining the document to be converted and converting the document to be converted into the intermediate document in the preset format based on the preset intermediate component includes:
step S11, when the document to be converted is obtained, calling a preset intermediate component to identify the document type of the document to be converted, and judging whether the document type is a preset type supporting conversion;
step S12, if the document is a preset type supporting conversion, converting the document to be converted into an intermediate document in a preset format based on a preset intermediate component.
Further, the format types supporting conversion are preset as preset types, and the preset types at least comprise a word document type, a PPT document type and an Excel document type. And then for the obtained document to be converted, calling a preset intermediate component to identify the document type of the document to be converted, comparing the identified document type with a preset type, and determining whether the document type is the preset type supporting conversion or not by judging whether the document type exists in the preset type or not.
Furthermore, if the document type is determined to be the same as a certain preset type, the document type is the preset type supporting conversion, so that the document to be converted can be processed through the preset intermediate component and converted into the intermediate document in the preset format. Namely, converting a Word type document to be converted into a pdf format intermediate document, or converting a PPT type document to be converted into a pdf format intermediate document, or converting an Excel type document to be converted into a pdf format intermediate document, etc.
Otherwise, if the document type is judged to be different from all the preset types, the document type is the preset type which does not support conversion. And outputting prompt information that the document to be converted is a document type which does not support conversion. In addition, in order to better meet the conversion requirement, a secondary conversion mechanism can be preset, the document type which does not support conversion is converted into the document type which supports conversion through the secondary conversion mechanism, and then the document which supports conversion is converted.
However, for the second-level conversion, it is also necessary to determine whether the document type that does not support conversion can be converted into the document type that supports conversion, and only the document type that can support conversion can be converted into an intermediate document through a second-order conversion mechanism, and then converted into a picture. For example, for document types m1, m2, m3, and m4 that do not belong to preset types, m1 and m2 may be converted into word types, and m3 and m4 may be converted into PPT types; although m1, m2, m3 and m4 belong to types which do not support conversion, through a two-level conversion mechanism, m1 and m2 can be converted into word types, m3 and m4 can be converted into PPT types, so that the converted document types are types which support conversion, and then the converted document is converted through a preset intermediate component, and the intermediate document in the preset pdf format is obtained and is continuously converted into pictures.
Step S20, converting the intermediate document into an intermediate picture based on a preset conversion component, and acquiring a to-be-converted style corresponding to the to-be-converted document;
further, the preset conversion component is preferably set as an ICEpdf component, and for the intermediate document, the intermediate picture can be obtained through the conversion operation of the preset conversion component. In addition, different users have requirements for obtaining different styles of pictures, such as some users need to obtain pictures with specific border patterns, other users need to obtain pictures with lovely images, and the like. Therefore, in order to meet the picture requirements of different users, a plurality of types of conversion styles are preset, and the various conversion styles preferably support editing, such as adding characters, replacing patterns or figures and the like aiming at the conversion styles. For the document to be converted which needs to be converted into the picture, the user can select a specific conversion style required by the user as the style to be converted corresponding to the document to be converted. After the intermediate document is converted into the intermediate image, the to-be-converted style corresponding to the to-be-converted document is acquired, so that the intermediate image is processed according to the to-be-converted style, and the image with the required style is acquired.
Step S30, identifying a pattern position in the intermediate picture corresponding to the pattern to be converted, and processing the picture content of the intermediate picture at the pattern position based on the pattern to be converted to obtain a converted final picture.
Understandably, different conversion patterns are added for different positions of the picture, for example, for a conversion pattern of a frame pattern, a pattern is added for a frame of the picture, and for a conversion pattern of a left side pattern, a pattern is added for a left side of the picture. Therefore, for the pattern to be converted, the position of the pattern to be converted in the intermediate picture is identified according to the type of the pattern to be converted, the position is used as the pattern position corresponding to the pattern to be converted in the intermediate picture, and then the picture content of the intermediate picture in the pattern position is processed according to the content of the pattern to be converted, so that the converted final picture is obtained. If the content is the panda pattern, adding the panda pattern on the pattern position to cover the picture content on the pattern position; or the content is embedded with characters on the style position, and then the corresponding character content is embedded in the picture content of the style position. Therefore, the intermediate picture is processed in the required to-be-converted style, the document to be converted is directly converted into the picture in the required style, the secondary processing of the converted picture is avoided, and the efficiency of obtaining the required picture is improved.
According to the method for converting the document into the picture, after the document to be converted, which needs to be converted, is obtained, the document to be converted is converted into the intermediate document with the preset format through the preset intermediate component, the intermediate document is converted into the intermediate picture through the preset conversion component, the to-be-converted style corresponding to the document to be converted is obtained, the style position corresponding to the to-be-converted style in the intermediate picture is further identified, the picture content of the intermediate picture on the style position is processed according to the to-be-converted style, and the converted final picture is obtained. Therefore, the pictures with rich styles are obtained by acquiring the styles to be converted corresponding to the documents to be converted and processing the style positions needing style setting in the documents to be converted according to the styles to be converted, secondary processing of the pictures by a user is avoided, accurate conversion of the pictures is realized, and the efficiency of picture conversion processing is improved.
Further, based on the first embodiment of the method for converting the document into the picture, the second embodiment of the method for converting the document into the picture is provided.
The second embodiment of the method for converting a document into a picture is different from the first embodiment of the method for converting a document into a picture in that the step of converting the intermediate document into an intermediate picture based on a preset conversion component comprises:
step S21, identifying whether the intermediate document is a multi-page document based on a preset conversion component, and if the intermediate document is the multi-page document, outputting first inquiry information whether the intermediate document is converted into a single picture;
step S22, if an acknowledgement corresponding to the first query information is received, merging and converting the intermediate document into a single intermediate picture based on the preset conversion component;
step S23, if negative response information corresponding to the first query information is received, identifying a paging identifier of the intermediate document based on the preset conversion component, and converting the intermediate document into a plurality of intermediate pictures according to the paging identifier.
Understandably, the document to be converted may be a multi-page document including a plurality of pages, or may be a single-page document including only one page, so that the converted intermediate document may correspond to the multi-page document including a plurality of pages, or may be the single-page document including one page. For the multi-page document, each page can be converted into a separate picture respectively, and can also be combined and converted into a whole picture. Therefore, whether the intermediate document is a multi-page document is firstly identified through a preset conversion assembly, if the intermediate document is the multi-page document, first inquiry information is output on a display interface of the terminal, and whether each page of the intermediate document is converted into an integral single picture is inquired. If the intermediate document is identified not as a multi-page document but as a single-page document including only one page, it is directly converted into an intermediate picture through a preset conversion group.
Furthermore, the user checks the first inquiry information and replies to the first inquiry information according to the requirement, and the terminal receives the reply information and identifies the type of the reply information. If the reply information is information for determining to output the whole single picture, the fact that the positive response information corresponding to the first inquiry information is received is judged, and then the intermediate document is merged through the preset conversion assembly, so that the whole intermediate document is converted into a single intermediate picture. On the other hand, if the reply message is a message that the entire single picture is negatively outputted, it is determined that the negative response message corresponding to the first inquiry message is received. Then, identifying the paging identification among the pages of the intermediate document through a preset conversion component, and splitting the intermediate document into a plurality of pages according to the paging identifications; and then each page is respectively converted into an intermediate picture to obtain a plurality of intermediate pictures, so that one intermediate picture corresponds to one page.
Understandably, whether the intermediate document contains one page or a plurality of pages, there may be a case where the content on a certain page occupies only a small part of the entire page, so that there is a large amount of blank area on the page. Therefore, in order to avoid a large amount of blank areas in the converted picture, the blank areas in the document need to be processed before conversion. Specifically, the step of converting the intermediate document into the intermediate picture based on the preset conversion component includes:
step S24, identifying blank areas in the intermediate document based on a preset conversion component, cutting the blank areas from the intermediate document, and identifying size information and color information of the intermediate document;
step S25, outputting second query information whether to adjust the size information and the color information based on the preset conversion component, and outputting a size and color adjustment dialog box if positive response information corresponding to the second query information is received;
step S26, after acquiring the size adjustment parameter and/or the color adjustment parameter based on the size and color adjustment dialog box, converting the intermediate document into an intermediate picture based on a preset conversion component by using the size adjustment parameter and/or the color adjustment parameter;
step S27, if receiving a negative response message corresponding to the second query message, converting the intermediate document into an intermediate picture with the size information and the color information based on a preset conversion component.
Further, before the intermediate document is converted into the intermediate image through the preset conversion component, the preset conversion component identifies a blank area in the intermediate document and identifies an area of the blank area. Meanwhile, a preset threshold value representing the size of the area is preset, the identified area is compared with the preset threshold value, whether the area of the area is larger than the preset threshold value or not is judged, and if the area of the area is larger than the preset threshold value, the fact that the area of the blank area is too large needs to be cut is indicated. Otherwise, if the area of the region is not larger than the preset threshold, the shearing operation is not needed.
Further, for the cut intermediate document, the cut size information and color information are identified, and second query information whether to adjust the size information and the color information is output in consideration of different users having different requirements for converting the color and the size of the picture. And if the user has a requirement for adjusting any one of the size information and the color information, replying the second inquiry information with information for determining adjustment, and if the user does not have the requirement for adjusting, replying the second inquiry information with information which is not adjusted. The determination adjustment information of the reply is taken as positive response information corresponding to the second inquiry information, and the non-adjustment information of the reply is taken as negative response information corresponding to the second inquiry information.
Further, when the acknowledgement message is received, it is indicated that the user has a need to adjust the recognized size information and color information, and the size-color adjustment dialog box is output. The method comprises the steps that a user inputs required size adjustment parameters and/or color adjustment parameters in a size and color adjustment dialog box, a preset conversion component converts an intermediate document into an intermediate picture according to the size adjustment parameters and/or the color adjustment parameters after the preset conversion component obtains the size adjustment parameters and/or the color adjustment parameters, and the intermediate picture obtained through conversion has the size adjustment parameters and/or the color adjustment parameters. On the contrary, if the negative response information is received, it indicates that the user does not have the requirement for adjusting the identified size information and color information, so the preset conversion component directly converts the intermediate document into the intermediate picture by taking the size information and the color information as the basis, and the size and the color of the intermediate picture obtained at this time are respectively consistent with the size information and the color information.
In the present embodiment, the identification of the blank region in the intermediate document is performed for the blank region in the page of the intermediate document, and if the intermediate document includes one page, the blank region in the page is identified, and if the intermediate document includes a plurality of pages, the blank region in each page is identified. Similarly, the blank area is cut from the intermediate document as a cutting operation for the blank area within the page, and the second query information is also a query to the user for the size information and color information of the cut page.
In addition, the size information and the color information of the uncut page can be inquired according to second inquiry information, the size information and the color information of the uncut page are identified, information inquiring whether to adjust the size information and the color information is added into the second inquiry information, and if positive response information is obtained, an input box for adjusting the size information and the color information is displayed in an output size and color adjusting dialog box, so that each converted picture meets the requirements of a user.
The multi-page intermediate document of the embodiment can be converted into an integral single intermediate picture, and can also be converted into a plurality of intermediate pictures page by page; moreover, an identification mechanism is arranged on the blank area in the page, and when the condition that the blank area is too large and the effect of the converted intermediate picture is influenced is identified, the blank area is cut; in addition, the size and color of the converted intermediate picture are also supported to be adjusted. Therefore, the intermediate document is converted into the intermediate picture from multiple dimensions such as conversion type, conversion effect, conversion size and color, and the final picture meeting the user requirement is obtained from the accurately converted intermediate picture.
Further, referring to fig. 3, a third embodiment of the method for converting a document into a picture according to the present invention is provided based on the first or second embodiment of the method for converting a document into a picture according to the present invention.
The third embodiment of the method for converting a document into a picture is different from the first or second embodiment of the method for converting a document into a picture in that the step of processing the picture content of the intermediate picture at the style position to obtain a converted final picture comprises the following steps:
step S31, processing the picture content of the intermediate picture on the pattern position to obtain an intermediate picture to be detected, detecting whether the resolution value of the intermediate picture to be detected is matched with a preset reference resolution, and if the resolution value of the intermediate picture to be detected is matched with the preset reference resolution, generating the intermediate picture to be detected into a final picture;
in the embodiment, the final picture obtained by conversion is ensured to be a high-definition picture by adjusting the resolution. Specifically, a preset reference resolution representing high-definition resolution is preset, the picture content of the intermediate picture at a preset position is processed according to the pattern to be converted, the obtained picture is used as the intermediate picture to be detected, the resolution value of the intermediate picture to be detected is detected, the detected resolution value is compared with the preset reference resolution, whether the two pictures are matched or not is judged, if the two pictures are matched, the resolution of the intermediate picture to be detected meets the requirement of high-definition resolution, and the intermediate picture to be detected belongs to the high-definition picture, so that the intermediate picture to be detected is generated into a final picture. On the contrary, if the resolution value of the intermediate picture to be detected does not match the preset reference resolution, it indicates that the resolution of the intermediate picture to be detected does not meet the requirement of high definition resolution, and the resolution needs to be adjusted.
Considering that different users or devices have different high definition degrees on high definition pictures, the preset operation of the preset reference resolution may be set by the terminal before the picture conversion. Specifically, the step of detecting whether the resolution value of the intermediate picture to be detected matches a preset reference resolution includes:
step S311, receiving a resolution setting value, and setting the resolution setting value as the preset reference resolution;
the step of detecting whether the resolution value of the intermediate picture to be detected is matched with a preset reference resolution includes:
step S312, comparing the detected resolution value of the intermediate picture to be detected with the preset reference resolution, and judging whether the resolution value is greater than or equal to the preset reference resolution;
step 313, if the resolution value is greater than or equal to the preset reference resolution, determining that the resolution value is matched with the preset reference resolution;
in step S314, if the resolution value is smaller than the preset reference resolution, it is determined that the resolution value is not matched with the preset reference resolution.
Further, a user triggers a resolution setting interface through a terminal, a required resolution setting value is input in the setting interface, and the terminal receives the resolution setting value and takes the resolution setting value as a preset reference resolution. And comparing the detected resolution value of the intermediate picture to be detected with the preset reference resolution, and judging whether the detected resolution value is greater than or equal to the preset reference resolution. If the resolution is larger than or equal to the preset reference resolution, the resolution of the intermediate picture to be detected meets the requirement of high-definition resolution, and therefore the two pictures are judged to be matched. On the contrary, if the detected resolution value is smaller than the preset reference resolution value, it is indicated that the resolution of the intermediate picture to be detected does not reach the requirement of high resolution, so that the two are judged to be not matched, and the resolution of the intermediate picture to be detected needs to be adjusted.
Step S32, if the resolution value does not match the preset reference resolution, adjusting the resolution value of the intermediate picture to be detected based on a preset picture instruction until the resolution value is adjusted to match the preset reference resolution, and generating the intermediate picture to be detected as a final picture.
Furthermore, a preset picture instruction for adjusting the picture resolution is preset, and if the detected resolution value is not matched with the preset reference resolution, the preset picture instruction is called, and the resolution value of the intermediate picture to be detected is adjusted through the preset picture instruction. And comparing the adjusted resolution value with a preset reference resolution, judging whether the two are matched, if so, generating the intermediate picture to be detected into a final picture, if not, continuing to adjust according to a preset picture instruction, and repeating the steps until the resolution value is adjusted to be matched with the preset reference resolution, and generating the intermediate picture to be detected into the final picture.
Further, the preset picture instruction of this embodiment is preferably a resolution adjustment instruction, such as a scale instruction, and the step of adjusting the resolution value of the to-be-detected intermediate picture based on the preset picture instruction includes:
step S321, obtaining a resolution to be adjusted based on the resolution adjustment instruction, and determining whether the resolution to be adjusted is smaller than the resolution setting value;
step S322, if the resolution ratio is smaller than the resolution ratio setting value, outputting the prompt information for reacquiring the resolution ratio to be adjusted until the resolution ratio to be adjusted is larger than or equal to the resolution ratio setting value;
step S323, if the resolution to be adjusted is greater than or equal to the resolution setting value, adjusting the resolution value of the intermediate picture to be detected with the resolution to be adjusted based on the resolution adjustment instruction.
Furthermore, the resolution required by the user is used as the resolution to be adjusted, the resolution to be adjusted is obtained through the resolution adjustment instruction, the obtained resolution to be adjusted is compared with a resolution setting value (namely, a preset reference resolution), and whether the resolution to be adjusted is smaller than the resolution setting value or not is judged. If the resolution is smaller than the resolution setting value, the intermediate picture with the resolution value still does not meet the requirement of high-definition resolution, and therefore prompt information for reacquiring the resolution to be adjusted is output to prompt that the resolution to be adjusted is adjusted to a larger value until the resolution is larger than or equal to the resolution setting value. If the resolution to be adjusted is determined to be not less than the resolution setting value through comparison, the intermediate picture to be detected with the resolution value meets the requirement of high-definition resolution. Therefore, the resolution value of the intermediate picture to be detected is adjusted through the stool rate adjusting instruction, and the resolution value is adjusted to be the resolution to be adjusted, so that the adjusted intermediate picture to be detected becomes a high-definition picture, and a final picture meeting the user requirement is obtained.
In this embodiment, for the intermediate picture to be detected obtained through pattern processing, whether the resolution of the intermediate picture to be detected reaches the high-definition resolution required by the user is detected, if the resolution of the intermediate picture to be detected reaches the high-definition resolution required by the user, the intermediate picture to be detected is generated into a final picture, otherwise, the resolution value of the intermediate picture to be detected is adjusted to reach the high-definition resolution required by the user, and the final picture is obtained. Therefore, the final picture obtained by conversion is ensured to be the high-definition picture required by the user, and the use of the user is facilitated.
The embodiment of the invention also provides a readable storage medium. The readable storage medium has stored thereon a control program which, when executed by the processor, implements the steps of the method of converting a document into a picture as described above.
The readable storage medium of the present invention may be a computer-readable storage medium, and the specific implementation manner of the readable storage medium of the present invention is basically the same as that of each embodiment of the method for converting a document into a picture, and will not be described herein again.
The present invention is described in connection with the accompanying drawings, but the present invention is not limited to the above embodiments, which are only illustrative and not restrictive, and those skilled in the art can make various changes without departing from the spirit and scope of the invention as defined by the appended claims, and all changes that come within the meaning and range of equivalency of the specification and drawings that are obvious from the description and the attached claims are intended to be embraced therein.