Typesetting processing method based on electronic book, electronic device and storage medium

By identifying and combining the positional relationships of multiple picture elements in the e-book and generating screenshots, the problem of image composition in e-book typesetting is solved, the efficiency and accuracy of the layout are improved, and the final layout content and the original content are ensured. consistency.

CN112100979BActive Publication Date: 2025-01-03ZHANGYUE TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202010972641.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-09-16
Publication Date
2025-01-03
Estimated Expiration
2040-09-16

AI Technical Summary

Technical Problem

During the e-book layout process, images composed of multiple image elements can easily destroy the original composition when directly parsing and typing, resulting in inconsistent with the original content.

Method used

By analyzing the e-book page, we can determine whether multiple image elements are fragmented pictures, and merge them to generate screenshots to preserve the original composition and ensure the consistency of the layout content.

Benefits of technology

有效识别并处理由多个图片元素构成的整体图片,保留原有构图方式,提升了排版的效率和准确性,使最终排版内容与电子书原始内容一致。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112100979B_ABST
    Figure CN112100979B_ABST
Patent Text Reader

Abstract

The present invention discloses a typesetting processing method based on an electronic book, an electronic device and a storage medium, the method comprising: obtaining a picture element obtained by parsing an original book page of an electronic book; when the number of picture elements contained in the original book page is multiple, judging whether each picture element belongs to a fragmented picture according to the positional relationship between the multiple picture elements; if so, merging the multiple picture elements belonging to the fragmented picture to obtain a target picture area containing the merged multiple picture elements; performing a screenshot processing on the target picture area to obtain a screenshot picture corresponding to the target picture area, and generating page typesetting content corresponding to the original book page according to the screenshot picture. This method can identify an integral picture composed of multiple picture elements, and retain the composition method of the picture itself, so that the typesetting content is consistent with the original content of the electronic book, thereby improving the efficiency and accuracy of typesetting.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computers, and in particular to a typesetting processing method, electronic equipment and storage medium based on an electronic book. Background Art

[0002] In the e-book typesetting process, it is necessary to identify the e-book manuscript for typesetting, and realize the typesetting of customized effects through streaming typesetting according to the recognition results. Among them, the e-book manuscript is usually in a non-editable format such as PDF. In the process of identifying the e-book manuscript, various page elements in the manuscript can be automatically identified, including text elements, picture elements and other types. Then, according to the recognition results, it is automatically converted to the streaming document to realize customized typesetting.

[0003] However, in the process of implementing the present invention, the inventors found that the above-mentioned solutions in the prior art have at least the following defects: in order to enrich the display effect of the pictures, some pictures in the electronic book are not composed of a single picture element, but are composed of multiple picture elements or other types of page elements. Accordingly, if the layout is directly performed according to the various page elements obtained by the analysis, the composition method of the picture itself will be destroyed, so that the final layout content is inconsistent with the original content of the electronic book. Summary of the invention

[0004] In view of the above problems, the present invention is proposed to provide an electronic book-based typesetting processing method, electronic device and storage medium that overcome the above problems or at least partially solve the above problems.

[0005] According to one aspect of the present invention, a typesetting processing method based on an electronic book is provided, comprising:

[0006] Obtain the image element obtained by parsing the original book page of the e-book;

[0007] When the original book page contains multiple picture elements, judging whether each picture element belongs to a fragmented picture according to the positional relationship between the multiple picture elements;

[0008] If yes, merge the multiple image elements belonging to the fragmented image to obtain a target image region including the merged multiple image elements;

[0009] Screenshot processing is performed on the target image area to obtain a screenshot image corresponding to the target image area, and page layout content corresponding to the original book page is generated according to the screenshot image.

[0010] According to another aspect of the present invention, there is provided an electronic device, comprising: a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other via the communication bus;

[0011] The memory is used to store at least one executable instruction, and the executable instruction enables the processor to execute various operations in the method.

[0012] According to another aspect of the present invention, a computer storage medium is provided, wherein at least one executable instruction is stored in the storage medium, and the executable instruction enables the processor to perform each operation in the above method.

[0013] In the typesetting processing method, electronic device and storage medium based on e-books provided by the present invention, when the number of picture elements contained in the original book page is multiple, it is possible to judge whether each picture element belongs to a fragmented picture according to the positional relationship between the multiple picture elements, and merge the multiple picture elements belonging to the fragmented picture to obtain a target picture area containing the merged multiple picture elements, and obtain a screenshot picture corresponding to the target picture area through screenshot processing. Since the screenshot picture has been converted into a complete picture element, the composition method in the original picture will not be destroyed. It can be seen that this method can identify an integral picture composed of multiple picture elements and retain the composition method of the picture itself, so that the final typesetting content is consistent with the original content of the e-book, thereby improving the efficiency and accuracy of typesetting.

[0014] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented according to the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are listed below. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present invention. Moreover, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:

[0016] Figure 1 A flow chart of a typesetting processing method based on an electronic book provided by an embodiment of the present invention is shown;

[0017] Figure 2 A flow chart of a typesetting processing method based on an electronic book provided by another embodiment of the present invention is shown;

[0018] Figure 3A schematic structural diagram of an electronic device according to another embodiment of the present invention is shown. DETAILED DESCRIPTION

[0019] The exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.

[0020] Embodiment 1

[0021] Figure 1 FIG. 1 is a flow chart showing a typesetting method based on an electronic book provided by an embodiment of the present invention. Figure 1 As shown, the method comprises the following steps:

[0022] Step S110: obtaining image elements obtained by parsing the original book page of the electronic book.

[0023] Specifically, the original book page of the e-book refers to the page before typesetting, usually a layout page. The original book page can be parsed by a page parser to obtain various page elements contained in the page. In this step, it is necessary to extract picture elements of picture type from various types of page elements.

[0024] Step S120: when the original book page includes multiple picture elements, judging whether each picture element belongs to a fragmented picture according to the positional relationship between the multiple picture elements.

[0025] When there are multiple image elements in an original book page, the positional relationship between each image element is obtained, and whether each image element belongs to a fragmented image is determined based on the positional relationship. A fragmented image refers to a portion of the image content contained in a complete image. Since the illustrations in an e-book usually have more content, they are often spliced ​​into a large image through multiple small images. At this time, each small image is a fragmented image, and multiple fragmented images are used together to form a large image. Therefore, the positional relationship between each fragmented image is relatively fixed.

[0026] When making a specific judgment, it can be determined based on whether the position of each picture element is located in the middle of the page and whether it occupies the main area of ​​the page. Usually, the content that forms a picture alone is often displayed in the center and occupies the main area of ​​the page. Among them, the main area of ​​the page refers to: an area located in the middle of the page and the length of the area is not less than the first preset proportion of the total length of the page, and / or the width of the area is not less than the second preset proportion of the total width of the page. In addition, it can be further judged in combination with whether there are other picture elements in the adjacent area of ​​the picture element. If there are no other picture elements in the adjacent area of ​​a picture element, it means that the picture element does not belong to a fragmented picture. In short, the positional relationship in this embodiment includes various information such as the position coordinates of the picture element on the page, the proportion occupied by the picture element on the page, and the relative positional relationship between the picture element and other picture elements. The present invention does not limit the specific connotation of the positional relationship.

[0027] Step S130: If yes, merge the multiple picture elements belonging to the fragmented picture to obtain a target picture area including the merged multiple picture elements.

[0028] Since multiple picture elements belonging to fragmented pictures are used together to form a complete picture, it is necessary to merge the multiple picture elements belonging to the fragmented pictures to obtain a target picture area containing the merged multiple picture elements. During the merging process, the number and range of the picture elements to be merged can be further determined in combination with factors such as the editing order of each picture element and the interval distance between each picture element. The target picture area of ​​the merged multiple picture elements refers to the area corresponding to a complete picture composed of multiple picture elements belonging to the fragmented pictures.

[0029] Step S140: performing screenshot processing on the target image area to obtain a screenshot image corresponding to the target image area, and generating page layout content corresponding to the original book page according to the screenshot image.

[0030] Specifically, the screenshot image is taken as a complete image element, and typesetting is performed based on the complete image element and other page elements contained in the original book page to obtain page typesetting content corresponding to the original book page. Since the screenshot image completely retains the various page elements used to constitute the image in the form of an image, the problem of disrupting the composition is avoided.

[0031] It can be seen that this method can identify the overall picture composed of multiple picture elements and retain the composition of the picture itself, so that the final layout content is consistent with the original content of the e-book, thereby improving the efficiency and accuracy of typesetting.

[0032] Embodiment 2

[0033] Figure 2 FIG. 2 shows a flow chart of a typesetting processing method based on an electronic book provided by another embodiment of the present invention. Figure 2 As shown, the method comprises the following steps:

[0034] Step S200: obtaining page elements obtained by parsing the original book page of the electronic book.

[0035] Specifically, the original book page of the e-book refers to the page before typesetting, which is usually a layout page. The original book page can be parsed by a page parser to obtain various page elements contained in the original book page. In this embodiment, considering that the pictures of the e-book are usually not displayed across pages, the original book page refers to a single page in the e-book.

[0036] Step S210: extracting image elements from the parsed page elements.

[0037] Specifically, it is necessary to extract picture elements of image type from various types of page elements. Among them, page elements refer to the smallest units that constitute the page content, specifically including: text elements, picture elements and path elements. Among them, text elements refer to: elements composed of various types of texts such as English characters and Chinese characters. Picture elements refer to: elements composed of contents in various image formats such as jpg. Path elements refer to: elements composed of path lines, wherein the path lines are used to connect any two endpoints in the form of straight lines or curves. Since various types of page elements have corresponding attribute information, picture elements can be extracted according to the attribute information of the page elements.

[0038] Step S220: when the original book page contains a plurality of picture elements, judging whether each picture element belongs to a fragmented picture according to the positional relationship between the plurality of picture elements.

[0039] The main purpose of this step is to identify multiple fragmented images used to form a complete image in the e-book. Since the number of fragmented images must be multiple, if an original book page contains only one image element, then the image element is usually not a fragmented image. Accordingly, only when the number of image elements contained in an original book page is multiple, it is necessary to determine whether the multiple image elements belong to fragmented images.

[0040] Specifically, the judgment can be made in at least one of the following two ways:

[0041] In the first method, the element size of each image element is obtained, and whether the image element belongs to a fragmented image is determined based on the relative relationship between the element size and the page size of the original book page. This method mainly makes judgments based on size information. Among them, the element size of the image element includes: information such as the length and width of the image element. Correspondingly, the page size of the original book page also includes the page length and the page width. The relative relationship between the element size of the image element and the page size of the original book page mainly refers to: the proportion of the image element in the original book page. Since a single image is usually displayed in the center of the page and occupies a certain page space, the image element with a smaller proportion can be determined as a fragmented image by detecting the proportion of the image element in the page. In specific implementation, a ratio threshold, such as 20%, can be set. If the ratio between the element size of the image element and the page size of the original book page is less than the ratio threshold, it means that the image element is a fragmented image. Generally, small images used for splicing into large images are generally small in size. Therefore, fragmented images can be quickly and efficiently identified through size information.

[0042] In the second method, the position information of each picture element in the original book page is obtained, and whether at least two adjacent picture elements belong to a fragmented picture is determined based on the position information. The position information is represented by position coordinates, and it can be determined whether a picture element is in a centered state or a non-centered state based on the position information of each picture element in the original book page, and whether there are other adjacent picture elements around a picture element can be determined. Accordingly, whether the picture element is a fragmented picture can be determined based on whether the picture element is in a centered state and the interval distance between two adjacent picture elements. Generally, a picture element that is in a non-centered state and / or whose interval distance with an adjacent picture element is less than a preset interval threshold belongs to a fragmented picture.

[0043] The above two judgment methods can be used alone or in combination.

[0044] Step S230: If yes, merge the multiple picture elements belonging to the fragmented picture to obtain a target picture area including the merged multiple picture elements.

[0045] Since multiple fragmented images are used together to form a complete e-book illustration, the relative position relationship of each fragmented image in the e-book illustration is fixed. In order to ensure that the above relative position relationship is not disrupted during the typesetting process, it is necessary to merge multiple image elements belonging to the fragmented images to obtain a target image area containing the merged multiple image elements. The target image area refers to: the area corresponding to a complete e-book illustration composed of multiple fragmented images.

[0046] It can be seen that in order to ensure the correct typesetting of the e-book illustration, it is necessary to ensure that the page elements contained in the target image area are all page elements in the e-book illustration. That is, the target image area does not omit any page elements contained in the e-book illustration, and the target image area does not contain any page elements that do not belong to the e-book illustration.

[0047] In order to achieve the above purpose, in this step, the merging process can be performed according to the interval distance between each fragmented image. It is specifically implemented in the following way: at least two image elements belonging to the fragmented image whose position interval is less than the preset interval threshold are merged to obtain a candidate image area; it is determined whether the area range of the candidate image area needs to be adjusted; if so, the target image area is determined according to the area range of the adjusted candidate image area; if not, the target image area is directly determined according to the area range of the candidate image area. It can be seen that this method mainly performs two-by-two merging processes according to the position interval between two fragmented images, so that the fragmented images with closer intervals can be merged.

[0048] In the specific implementation, it is considered that there may be some interfering page elements in the candidate image area obtained by merging according to the position interval, for example, it may contain page elements that do not belong to the e-book illustration; or, it may also omit the page elements that belong to the e-book illustration. To this end, it is necessary to determine whether the area range of the candidate image area needs to be adjusted. In the specific implementation, it can be adjusted by the editing order of each image element in the original book page: after merging at least two image elements belonging to the fragmented image with a position interval less than a preset interval threshold to obtain the candidate image area, the editing order of each image element contained in the candidate image area in the original book page is obtained; according to the editing order, it is determined whether the area range of the candidate image area needs to be adjusted; if so, the target image area is determined according to the area range of the adjusted candidate image area. Among them, when determining whether the area range of the candidate image area needs to be adjusted according to the editing order, the editing order of each image element contained in the candidate image area is sorted, and it is determined whether the order interval between two image elements adjacent in order is greater than the preset order threshold; if so, at least one image element of the two image elements adjacent in order is removed from the candidate image area, and the area range of the candidate image area is adjusted according to the remaining image elements. Among them, the editing order refers to the order in which each page element is obtained in the original book page. Usually, the editing order of each element in the same picture should be continuous or not much different. Therefore, picture elements with a large difference in editing order may not belong to the picture. For example, if the editing order of multiple fragmented pictures in the candidate picture area corresponding to a picture is mostly distributed in the first interval, the first interval is between 1-100. At this time, if the editing order of a certain fragmented picture is in the second interval, the second interval is between 1000-1100, it is determined that the fragmented picture in the second interval does not belong to the picture content and should be eliminated.

[0049] In addition, in this embodiment, when determining whether the area range of the candidate image area needs to be adjusted, it can also be determined based on whether the candidate image area contains body text. Specifically, determine whether the candidate image area contains body text; if so, adjust the area range of the candidate image area based on the position of the body text. The candidate image area should not contain body text, so the page elements that conflict with the position of the body text should be removed from the candidate image area.

[0050] In addition, the inventor discovered during the process of implementing the present invention that some images further contain textual content, which is different from the main text and is part of the image. For example, in the layout text, the text and the image present a stacking effect, but in the streaming typesetting method, the text and the image will be laid out separately, and thus the stacking effect cannot be presented. At this time, in order to ensure that the text belonging to the image content can be divided into the candidate image area and maintain the stacking effect of the text and the image itself, the following method is used for processing:

[0051] When merging at least two image elements belonging to fragmented images whose position interval is less than a preset interval threshold to obtain a candidate image area, further obtain a text element obtained by parsing the original book page of the electronic book; obtain the first position information of at least two image elements belonging to fragmented images in the original book page, and the second position information of the text element in the original book page; determine whether there is a text element that overlaps with at least two image elements belonging to fragmented images according to the first position information and the second position information; if so, merge at least two image elements belonging to fragmented images and text elements that overlap with at least two image elements belonging to fragmented images together to obtain a candidate image area. Wherein, according to the attribute information of the page element, it can be determined whether a page element belongs to an image element or a text element, and for each page element, the position coordinate data of the page element can be obtained. Accordingly, when performing the merging process, for at least two picture elements belonging to the fragmented pictures whose position interval is less than the preset interval threshold, the first position information of the at least two picture elements belonging to the fragmented pictures in the original book page is obtained, so as to determine the position range of the at least two picture elements belonging to the fragmented pictures in the original book page; and the second position information of each text element in the original book page is obtained, and whether there is a text element that overlaps with the at least two picture elements belonging to the fragmented pictures is judged according to whether there is overlap between the first position information and the second position information. When the judgment result is yes, the text element that overlaps with the picture element needs to be merged into the candidate picture area. Wherein, overlap includes: full overlap or partial overlap, that is, the text may overlap with the picture element in its entirety, or the text may overlap with the picture element in part.

[0052] Wherein, when merging at least two picture elements belonging to a fragmented picture and text elements overlapping with at least two picture elements belonging to a fragmented picture, it is achieved in the following manner: first, determine a first rectangular area corresponding to at least two picture elements belonging to a fragmented picture, and a second rectangular area corresponding to text elements overlapping with at least two picture elements belonging to a fragmented picture; then, determine the circumscribed rectangle corresponding to the first rectangular area and the second rectangular area, and merge the picture elements and text elements contained in the circumscribed rectangle. Wherein, the first rectangular area corresponding to at least two picture elements belonging to a fragmented picture refers to: the first circumscribed rectangle corresponding to at least two picture elements belonging to a fragmented picture; accordingly, the second rectangular area corresponding to the text elements overlapping with at least two picture elements belonging to a fragmented picture refers to: the second circumscribed rectangle corresponding to the text element. Therefore, the circumscribed rectangle corresponding to the first rectangular area and the second rectangular area refers to: the common circumscribed rectangle corresponding to the first circumscribed rectangle and the second circumscribed rectangle.

[0053] Step S240: performing screenshot processing on the target image area to obtain a screenshot image corresponding to the target image area, and generating page layout content corresponding to the original book page according to the screenshot image.

[0054] Specifically, the screenshot image is taken as a complete image element, and typesetting is performed according to the complete image element and other page elements contained in the original book page to obtain page typesetting content corresponding to the original book page. Since the screenshot image completely retains the page elements such as the fragmented images used to constitute the image in the form of an image, the problem of disrupting the composition is avoided.

[0055] In this embodiment, the original book page of the electronic book is a layout page; the page layout content is a flow layout content.

[0056] It can be seen that this method can identify the overall image composed of multiple image elements and retain the composition of the image itself, so that the final layout content is consistent with the original content of the e-book, thereby improving the efficiency and accuracy of layout. In addition, this method can accurately identify the image area based on multiple factors such as spacing distance and editing order, and can also accurately process images containing text, thereby ensuring that the content after screenshot is consistent with the image area and improving the accuracy of layout.

[0057] Embodiment 3

[0058] An embodiment of the present application provides a non-volatile computer storage medium, wherein the computer storage medium stores at least one executable instruction, and the computer executable instruction can execute the typesetting processing method based on an electronic book in any of the above method embodiments.

[0059] The executable instructions may be specifically used to cause the processor to perform the following operations:

[0060] Obtain the image element obtained by parsing the original book page of the e-book;

[0061] When the original book page contains multiple picture elements, judging whether each picture element belongs to a fragmented picture according to the positional relationship between the multiple picture elements;

[0062] If yes, merge the multiple image elements belonging to the fragmented image to obtain a target image region including the merged multiple image elements;

[0063] Screenshot processing is performed on the target image area to obtain a screenshot image corresponding to the target image area, and page layout content corresponding to the original book page is generated according to the screenshot image.

[0064] In an optional implementation, the executable instructions are used to cause the processor to perform the following operations:

[0065] The determining, based on the positional relationship between the plurality of picture elements, whether each picture element belongs to a fragmented picture includes:

[0066] Obtaining the element size of each image element, and judging whether the image element belongs to a fragmented image according to the relative relationship between the element size and the page size of the original book page; and / or,

[0067] The position information of each image element in the original book page is obtained, and it is determined whether at least two image elements adjacent to each other belong to the fragmented image according to the position information.

[0068] In an optional implementation, the executable instructions are used to cause the processor to perform the following operations:

[0069] Merge at least two image elements belonging to the fragmented image whose position interval is less than a preset interval threshold to obtain a candidate image region;

[0070] Obtaining the editing order of each image element contained in the candidate image area in the original book page;

[0071] Determine whether the area range of the candidate image area needs to be adjusted according to the editing order; if so, determine the target image area according to the adjusted area range of the candidate image area.

[0072] In an optional implementation, the executable instructions are used to cause the processor to perform the following operations:

[0073] Sorting the editing order of each picture element contained in the candidate picture area, and determining whether the order interval between two picture elements adjacent in order is greater than a preset order threshold;

[0074] If so, at least one of the two picture elements adjacent in sequence is removed from the candidate picture area, and the area range of the candidate picture area is adjusted according to the remaining picture elements.

[0075] In an optional implementation, the executable instructions are used to cause the processor to perform the following operations:

[0076] Determine whether the candidate image area contains body text; if so, adjust the area range of the candidate image area according to the position of the body text.

[0077] In an optional implementation, the executable instructions are used to cause the processor to perform the following operations:

[0078] Obtain the text element obtained by parsing the original book page of the e-book;

[0079] Acquire first position information of the at least two image elements belonging to the fragmented images in the original book page, and second position information of the text element in the original book page;

[0080] Determining whether there is a text element that overlaps with the at least two image elements belonging to the fragmented images according to the first position information and the second position information;

[0081] If so, at least two picture elements belonging to the fragmented picture and the text elements overlapping with the at least two picture elements belonging to the fragmented picture are merged together to obtain the candidate picture area.

[0082] In an optional implementation, the executable instructions are used to cause the processor to perform the following operations:

[0083] Determine a first rectangular area corresponding to the at least two picture elements belonging to the fragmented picture, and a second rectangular area corresponding to the text element overlapping the at least two picture elements belonging to the fragmented picture;

[0084] Determine a bounding rectangle corresponding to the first rectangular area and the second rectangular area, and merge the image elements and text elements contained in the bounding rectangle.

[0085] In an optional implementation, the original book page of the electronic book is a layout page; and the page layout content is a flow layout content.

[0086] Embodiment 4

[0087] Figure 3 A schematic structural diagram of an electronic device according to another embodiment of the present invention is shown. The specific embodiment of the present invention does not limit the specific implementation of the electronic device.

[0088] like Figure 3 As shown, the electronic device may include: a processor (processor) 302 , a communication interface (Communications Interface) 304 , a memory (memory) 306 , and a communication bus 308 .

[0089] The processor 302, the communication interface 304, and the memory 306 communicate with each other via the communication bus 308. The communication interface 304 is used to communicate with other devices such as a client or other server network elements. The processor 302 is used to execute the program 310, which can specifically execute the relevant steps in the above-mentioned electronic book typesetting processing method embodiment.

[0090] Specifically, the program 310 may include program codes, which include computer operation instructions.

[0091] The processor 302 may be a central processing unit (CPU), or an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present invention. The one or more processors included in the electronic device may be processors of the same type, such as one or more CPUs; or processors of different types, such as one or more CPUs and one or more ASICs.

[0092] The memory 306 is used to store the program 310. The memory 306 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.

[0093] The program 310 may be specifically configured to enable the processor 302 to perform the following operations:

[0094] Obtain the image element obtained by parsing the original book page of the e-book;

[0095] When the original book page contains multiple picture elements, judging whether each picture element belongs to a fragmented picture according to the positional relationship between the multiple picture elements;

[0096] If yes, merge the multiple image elements belonging to the fragmented image to obtain a target image region including the merged multiple image elements;

[0097] Screenshot processing is performed on the target image area to obtain a screenshot image corresponding to the target image area, and page layout content corresponding to the original book page is generated according to the screenshot image.

[0098] In an optional implementation, the executable instructions are used to cause the processor to perform the following operations:

[0099] The determining, based on the positional relationship between the plurality of picture elements, whether each picture element belongs to a fragmented picture includes:

[0100] Obtaining the element size of each image element, and judging whether the image element belongs to a fragmented image according to the relative relationship between the element size and the page size of the original book page; and / or,

[0101] The position information of each image element in the original book page is obtained, and it is determined whether at least two image elements adjacent to each other belong to the fragmented image according to the position information.

[0102] In an optional implementation, the executable instructions are used to cause the processor to perform the following operations:

[0103] Merge at least two image elements belonging to the fragmented image whose position interval is less than a preset interval threshold to obtain a candidate image region;

[0104] Obtaining the editing order of each image element contained in the candidate image area in the original book page;

[0105] Determine whether the area range of the candidate image area needs to be adjusted according to the editing order; if so, determine the target image area according to the adjusted area range of the candidate image area.

[0106] In an optional implementation, the executable instructions are used to cause the processor to perform the following operations:

[0107] Sorting the editing order of each picture element contained in the candidate picture area, and determining whether the order interval between two picture elements adjacent in order is greater than a preset order threshold;

[0108] If so, at least one of the two picture elements adjacent in sequence is removed from the candidate picture area, and the area range of the candidate picture area is adjusted according to the remaining picture elements.

[0109] In an optional implementation, the executable instructions are used to cause the processor to perform the following operations:

[0110] Determine whether the candidate image area contains body text; if so, adjust the area range of the candidate image area according to the position of the body text.

[0111] In an optional implementation, the executable instructions are used to cause the processor to perform the following operations:

[0112] Obtain the text element obtained by parsing the original book page of the e-book;

[0113] Acquire first position information of the at least two image elements belonging to the fragmented images in the original book page, and second position information of the text element in the original book page;

[0114] Determining whether there is a text element that overlaps with the at least two image elements belonging to the fragmented images according to the first position information and the second position information;

[0115] If so, at least two picture elements belonging to the fragmented picture and the text elements overlapping with the at least two picture elements belonging to the fragmented picture are merged together to obtain the candidate picture area.

[0116] In an optional implementation, the executable instructions are used to cause the processor to perform the following operations:

[0117] Determine a first rectangular area corresponding to the at least two picture elements belonging to the fragmented picture, and a second rectangular area corresponding to the text element overlapping the at least two picture elements belonging to the fragmented picture;

[0118] Determine a bounding rectangle corresponding to the first rectangular area and the second rectangular area, and merge the image elements and text elements contained in the bounding rectangle.

[0119] In an optional implementation, the original book page of the electronic book is a layout page; and the page layout content is a flow layout content.

[0120] The algorithm and display provided herein are not inherently related to any particular computer, virtual system or other device. Various general purpose systems can also be used together with the teachings based on this. According to the above description, it is obvious that the structure required for constructing such systems. In addition, the present invention is not directed to any specific programming language either. It should be understood that various programming languages ​​can be utilized to realize the content of the present invention described herein, and the description of the above specific languages ​​is for disclosing the best mode of the present invention.

[0121] In the description provided herein, a large number of specific details are described. However, it is understood that embodiments of the present invention can be practiced without these specific details. In some instances, well-known methods, structures and techniques are not shown in detail so as not to obscure the understanding of this description.

[0122] Similarly, it should be understood that in order to streamline the present disclosure and aid in understanding one or more of the various inventive aspects, in the above description of exemplary embodiments of the present invention, various features of the present invention are sometimes grouped together into a single embodiment, figure, or description thereof. However, this disclosed method should not be interpreted as reflecting the intention that the claimed invention requires more features than those explicitly recited in each claim. More specifically, as reflected in the claims below, inventive aspects lie in less than all the features of the individual embodiments disclosed above. Therefore, the claims that follow the specific embodiment are hereby expressly incorporated into the specific embodiment, with each claim itself serving as a separate embodiment of the present invention.

[0123] Those skilled in the art will appreciate that the modules in the devices in the embodiments may be adaptively changed and arranged in one or more devices different from the embodiments. The modules or units or components in the embodiments may be combined into one module or unit or component, and in addition they may be divided into a plurality of submodules or subunits or subcomponents. Except that at least some of such features and / or processes or units are mutually exclusive, all features disclosed in this specification (including the accompanying claims, abstracts and drawings) and all processes or units of any method or device disclosed in this manner may be combined in any combination. Unless otherwise expressly stated, each feature disclosed in this specification (including the accompanying claims, abstracts and drawings) may be replaced by an alternative feature providing the same, equivalent or similar purpose.

[0124] In addition, those skilled in the art will appreciate that, although some embodiments herein include certain features included in other embodiments but not other features, the combination of features of different embodiments is meant to be within the scope of the present invention and form different embodiments. For example, in the claims below, any one of the claimed embodiments may be used in any combination.

[0125] It should be noted that the above embodiments illustrate the present invention rather than limit it, and that those skilled in the art may devise alternative embodiments without departing from the scope of the appended claims. In the claims, any reference symbol between brackets shall not be construed as a limitation on the claims. The word "comprising" does not exclude the presence of elements or steps not listed in the claims. The word "one" or "an" preceding an element does not exclude the presence of a plurality of such elements. The present invention may be implemented by means of hardware comprising a number of different elements and by means of a suitably programmed computer. In a unit claim enumerating a number of devices, several of these devices may be embodied by the same hardware item. The use of the words first, second, and third, etc., does not indicate any order. These words may be interpreted as names.

Claims

1. A typesetting processing method based on an electronic book, comprising: Obtaining page elements obtained by parsing the original book page of the e-book, and extracting image elements from the parsed page elements; When the number of picture elements contained in the original book page is multiple, judging whether each picture element belongs to a fragmented picture according to the positional relationship between the multiple picture elements; wherein the fragmented picture refers to part of the picture content contained in the complete picture; If so, merge at least two image elements belonging to the fragmented image whose position interval is less than a preset interval threshold to obtain a candidate image area; obtain the editing order of each image element contained in the candidate image area in the original book page; sort the editing order of each image element contained in the candidate image area, and determine whether the order interval between two image elements adjacent in order is greater than a preset order threshold; if so, remove at least one image element of the two image elements adjacent in order from the candidate image area, and adjust the area range of the candidate image area according to the remaining image elements; determine the target image area according to the adjusted area range of the candidate image area; wherein the editing order refers to the order in which each page element is obtained in the original book page; Screenshot processing is performed on the target image area to obtain a screenshot image corresponding to the target image area, and page layout content corresponding to the original book page is generated according to the screenshot image.

2. The method according to claim 1, wherein: The determining, based on the positional relationship between the plurality of picture elements, whether each picture element belongs to a fragmented picture includes: Obtaining the element size of each image element, and judging whether the image element belongs to a fragmented image according to the relative relationship between the element size and the page size of the original book page; and / or, The position information of each image element in the original book page is obtained, and it is determined whether at least two image elements adjacent to each other belong to the fragmented image according to the position information.

3. The method according to claim 1, wherein: The adjusting the area range of the candidate picture area further comprises: Determine whether the candidate image area contains body text; if so, adjust the area range of the candidate image area according to the position of the body text.

4. The method according to claim 1, wherein: The step of merging at least two picture elements belonging to the fragmented picture whose position interval is less than a preset interval threshold to obtain a candidate picture area includes: Obtain the text element obtained by parsing the original book page of the e-book; Acquire first position information of the at least two image elements belonging to the fragmented images in the original book page, and second position information of the text element in the original book page; Determining whether there is a text element that overlaps with the at least two image elements belonging to the fragmented images according to the first position information and the second position information; If so, at least two picture elements belonging to the fragmented picture and the text elements overlapping with the at least two picture elements belonging to the fragmented picture are merged together to obtain the candidate picture area.

5. The method according to claim 4, wherein: The merging of at least two picture elements belonging to the fragmented picture and the text element overlapping with the at least two picture elements belonging to the fragmented picture comprises: Determine a first rectangular area corresponding to the at least two picture elements belonging to the fragmented picture, and a second rectangular area corresponding to the text element overlapping the at least two picture elements belonging to the fragmented picture; Determine a bounding rectangle corresponding to the first rectangular area and the second rectangular area, and merge the image elements and text elements contained in the bounding rectangle.

6. The method according to any one of claims 1 to 5, wherein: The original book page of the electronic book is a layout page; the page layout content is a flow layout content.

7. An electronic device comprising: A processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other via the communication bus; The memory is used to store at least one executable instruction, and the executable instruction enables the processor to execute any one of the methods according to claims 1-6.

8. A computer storage medium, wherein at least one executable instruction is stored in the storage medium, and the executable instruction enables a processor to execute the method according to any one of claims 1 to 6.