Processing a digital image of content to remove border artifacts

Systems and methods for removing border objects from a page of digital image are presented. More particularly, in removing border objects from a page of a digital image, the following are performed. In the first place, a digital image having at least one page of content is obtained. A content area of content on the page is determined. Border objects in the region between the page margin and the content area are then located. For each located border object, the following two steps are performed. The located border object is evaluated according to a set of border criteria, and the located border object is removed if the evaluation of the border object indicates that the border object is to be removed. Thereafter, the updated digital image is stored in a content store.

CROSS-REFERENCES TO RELATED APPLICATIONS

This application is related to co-pending U.S. patent application Ser. No. 11/864,208, filed Sep. 28, 2007, entitled “Processing a Digital Image of Content.” This application is also related to co-pending U.S. patent application Ser. No. 11/864,187, filed Sep. 28, 2007, entitled “Processing a Digital Image of Content Using Content Aware Despeckling.”

BACKGROUND

The publishing industry has greatly benefited from the many advances in digital imaging and printing technologies. Indeed, one of the many advances has been the creation of an on-demand printing market where a publisher prints small quantities of a book or other publication to satisfy orders for the publication as the orders are made. This is especially advantageous where requests for the publication are sporadic or limited, such that generating a typical print run would not be cost effective. Moreover, on-demand printing proves advantageous when the publisher is not the originator of the publication and has only a printed copy of the publication, since the publisher can scan the pages of the publication, and generate a document therefrom.

Publishers, including on-demand publishers, receive source copies of a publication in a variety of formats, including digital and printed formats. Authors will provide electronic source copies of a document in a particular format using a word processor. This type of document has the advantage that the content is free of extraneous speckles and lines (referred to as “artifacts”) that arise when source documents originate from a scanned or photocopied source. For example,FIG. 1is a digital image100of consecutive, facing pages from a book that illustrates the extraneous artifacts, including speckles (102-108) and lines (110-112) that arise for a variety of reasons while scanning, faxing, and/or photocopying printed content. Of course, the artifacts are not part of the content and, if printed as is, create a distraction to a reader and generally suggest that the published book is a cheap imitation of the genuine article. In short, if these pages (and others with similar artifacts) were printed in a book, a customer would likely view the book as entirely unacceptable.

In spite of the fact that many authors could provide publishers with a source copy of content that is free of artifacts, more often than not the source copies have some artifacts that detract from the overall quality of the book when printed in an on-demand manner. Unfortunately, on-demand publishers simply use the source copy provided to them by authors or content aggregators, relying upon them to maintain the source copy artifact-free. Moreover, when the source copy is a printed document (such as a 100-year old book that has long been out of print), even the best scanners and photocopiers frequently include artifacts.

DETAILED DESCRIPTION

Techniques, methods, and apparatus are described for processing content into print-ready content suitable for on-demand printing. In particular,FIG. 2is a pictorial diagram of an illustrative networked environment200suitable for processing content into a print-ready state for on-demand printing, according to aspects of the disclosed subject matter.

As shown inFIG. 2, a publishing service210is connected via a network208to one or more clients, such as clients on computing devices202-208. Typically, the publishing service receives publication requests from the clients to prepare, if necessary, and publish the requested content in an on-demand fashion. Clients include, but are not limited to, authors, consumers, content vendors, and the like. The client computing devices202-208may be connected to the network208via a wireless or wired connection.

A request may indicate a particular publication to be printed, such as an out-of-print book, or include the particular content206for the publishing service210to publish via its on-demand printing services. A given publication request may include the content to be published, or alternatively may identify a publication or other content that is available to the publishing service210. For example, a client/vendor using computing device204may request that the publishing service210generate five copies of an out-of-print book212or other published, printed document that is available to the publishing service in physical form212or of digital content (not shown) stored in a content store214. Alternatively, a client/author using computing device202may supply an original document to the publication service210for on-demand printing. Of course, a publication service210may also receive physical printed copies of content or digital content on physical media via a physical delivery means with an accompanying request to prepare and print the content.

The publication service210will typically have available or include the necessary hardware, such as a scanner220or other imaging device, to generate digital images of printed content. To this end, while not shown, the publication service210may also include a fax machine that may receive and store a faxed image of content, or print the faxed content for conversion to a digital image.

Once a request is received, and the printed content (if the request is in regard to printed content) is converted to an initial digital image, the publication service210processes the image to place it in a condition for on-demand printing. There are typically many aspects to processing an image of printed content for on-demand printing that are performed by the publication service210. To that end,FIG. 3is a block diagram of illustrative logical components of a publication service210suitable for processing a digital image of content into an on-demand print ready document.

As shown inFIG. 3, the publication service210includes a processor302and a memory310. As is well understood, the processor302executes instructions retrieved from memory310to carry out various functions, including processing a digital image for on-demand printing. The memory310comprises any number of combinations of volatile and non-volatile memory including, but not limited to, random-access memory (RAM), read-only memory (ROM), flash memory, disk storage, and the like. It should be further appreciated that there are a variety of computing devices that may be configured as a publication service210, including but not limited to: personal computers, mini- and/or mainframe computers, laptop computers, and the like. Moreover, a publication service210may be implemented on a configuration of multiple cooperative computing devices interconnected via a network, including both local area networks (LANs) and wide area networks (WANs). Accordingly, while the following discussion will be made as though the publication service210is implemented on a single computing device, this is for ease of description only and should not be viewed as limiting upon the disclosed subject matter.

Also shown in the publication service210are various components that perform certain functions of processing a digital image for on-demand printing. However, it should be appreciated that these various components are logical components, not necessarily actual and/or discrete components, as any of the following-described components may be combined together or with other components, including components not discussed herein. Moreover, these various components of the publishing service210may be implemented in hardware, in software, or a combination thereof. The additional components may include, but are not limited to, an image segmentation component304for identifying content regions (image and text regions) which can be segmented from each page in a digital image, a border removal component306for removing border artifacts (such as border artifacts110or112ofFIG. 1) from the pages of the digital image, and a content alignment component308for aligning content areas in the various pages.

Components further shown as included in the publishing service210may include a deskew component312for vertically aligning a content area in a digital image page, a despeckle component314for removing speckle artifacts (such as speckles102-108ofFIG. 1) from a digital image page, a margin control component320for defining a fixed margin size for non-content area (i.e., blank space surrounding the content area) in a digital image page so that each digital image page can have the same margins, and a file generation component318for generating a print-ready document for on-demand printing. Still other components of a publishing service210include a user interface component322for interacting with a user in generating the on-demand print-ready document, a network interface316for, inter alia, receiving requests and content from outside sources, and an on-demand printing module218for initiating the printing of an on-demand print-ready document in response to a client request.

As mentioned previously in regard toFIG. 2, the publishing service210includes or is communicatively coupled to a content store214that stores scanned images of content as well as on-demand print-ready documents. Still further, the publishing service210typically includes or is communicatively coupled to an imaging device, such as a digital copier, a facsimile receiving device, or a scanner, such as scanner220ofFIG. 2. These various imaging devices are useful for converting printed content into digital images and/or receiving digital images of printed content from clients.

With regard to processing a digital image for on-demand printing,FIG. 4is a flow diagram of an illustrative on-demand printing service routine for processing a digital image of content for generating an on-demand printing ready document. Moreover, the discussion ofFIG. 4will be made with reference toFIGS. 5,7,8, and12, each of which illustrates a pictorial diagram of a page of a digital image of content, and is suitable for describing the various processing steps of preparing the page for on-demand printing with regard to routine400.

In one embodiment, the routine400is initiated as the publishing service210receives a user request for on-demand printing of a particular document or other content. For the purpose of discussion, it is assumed that the content store214coupled to the publishing service210includes a digital image file representing the requested content. Moreover, it is also assumed that the digital image file has not yet been processed to make it suitable for on-demand printing. By way of example, the requested content may include, but is not limited to, a book, a magazine, an article, a newspaper, etc. It is also further assumed that the requested content is available as digital image file and has not be previously processed and stored in the content store214.

Beginning with block402, the publishing service210obtains a digital image file from the content store214corresponding to the requested content. Alternatively, in the event where the digital image file corresponding to the requested content is not readily available from the content store214, the digital image file may be obtained through scanning of a physical copy of the requested content. Irrespective of the manner or source from which the digital image file is generated and/or obtained, it should be appreciated that the digital image file will typically include a plurality of pages, each page corresponding to a printed page of content.

At control block404, a looping construct, illustrated as a “for” loop, is begun that iterates through each page in the obtained digital image. Moreover, the control block404iterates through each page performing the steps between control block404and end control block414. As those skilled in the art will appreciate, when all pages of the digital image have been processed, the routine400exits the looping construct and proceeds to block416as described below.

At block406, a “deskew” process may be performed on the current page of the digital image. The content of a page in a digital image is often tilted or skewed during the scanning or imaging process. The deskew process corrects the skewing in that it aligns or orients the page to a desired alignment (i.e., such that the page of content will be aligned/oriented with the printed page). For example, as shown inFIG. 5, page502is skewed/tilted with regard to the orientation of the printed page as indicated by box508. Accordingly, at block406, the exemplary routine400deskews the page502to align it with the desired orientation.

It should be appreciated that, for purposes of this disclosure, the term “orientation” is not a general reference to the arrangement of printed content on paper (commonly associated with terms such as “landscape” and “portrait”) but rather is a reference to the rotation and position of the image content with regard to page image boundaries. Moreover, as will be appreciated by one of ordinary skill in the art, deskewing typically comprises rotating the content (i.e., page502) such that its bounding box506is aligned with the desired orientation. In one embodiment, a bounding box, as used herein, is a rectangle that delineates the content of the page502from non-content areas (margins) of the page, as shown in box506. The result of the deskewing process of block406is shown inFIG. 7where the page502is “oriented” with the desired alignment508.

At block408, a segmentation process is performed on the current digital image page. The segmentation process identifies various areas or regions of the page and removes artifacts from those regions. The segmentation process may be repeated iteratively to identify various patterns, for example, text lines, graphics, background, margins, etc., in the content area in order to enhance artifact removal, including on or in between areas of the identified segments. In one embodiment, a segmentation process may be performed several times to achieve a different level of granularity in segmenting. In another embodiment, the type of content in a particular identified region determines the type of artifact removal that is performed. Additionally, in yet another embodiment, the segmentation process, in conjunction with the despeckle process, may be performed iteratively to enhance artifact identification and removal. Iterative segmentation and artifact removal are discussed later in greater detail in conjunction withFIGS. 7 and 8.

At block410, a despeckling process is performed on the segmented digital image page. As suggested above, the despeckling process removes speckle artifacts (such as speckles102-108ofFIG. 1) from the digital image page. The despeckling process can be iteratively performed along with a segmentation process, as illustrated at block409. After the despeckling process selectively removes speckle artifacts from segmentations, the speckle artifacts residing on the digital page are greatly reduced. Moreover, with few artifacts, subsequent segmentation processing can produce improved segmentations. In turn, the improved segmentations will allow the despeckling process to more accurately identify and remove speckle artifacts. The despeckling process and iterative segmentation process will be discussed in a greater detail in regard toFIG. 6.

At block412, a border removal process may be performed for removing border artifacts (such as borders110and112ofFIG. 1). The border removal process will be discussed below in greater detail in conjunction withFIGS. 10 and 11.

After each page of the digital image has been processed (deskewed, segmented, despeckled, and borders removed, corresponding to blocks406-412), the publishing service210may perform various other processes to further process the page into a printing ready content. One process, at block416, may be a “reassembly” or “reconstruct” process that assembles individual pages in accordance with a desired page order of the on-demand print ready document.

At block418, an alignment process is performed across the reassembled pages. As will be well understood, in order to provide a pleasant look of the on-demand printed document, it is desirable that the content area on each digital image page be similarly aligned across all pages and placed at approximately the same position on each physical page of the on-demand printed document. However, while many digital images are generated by scanners, some digital images may be generated through different imaging devices, resulting in misalignment among digital image pages. Further, even before scanning of a book, the physical pages of the book can be misaligned due to various errors in the printing or binding process. In order to place the content area of each digital image page at approximately the same position on a physical page of the on-demand printed document, an anchor point of a bounding box, such as bounding box506, may be used to align the content area across the digital image pages. The anchor point may be defined for the alignment process, for example, the top left corner of the bounding box or the center of the bounding box.

In some instances, some outermost bounding boxes of the digital image pages have differences in size. For example, a first digital image page for a chapter which contains less text lines may have a smaller outermost bounding box than the rest of the digital image pages. In such a case, the publishing service210may define margins to the outermost bounding boxes and control the margins on a digital image page based on the size of the outermost bounding box.

In one embodiment, the publishing service210may allow an end user to specify desirable margins for a physical page of the on-demand printed document. In one embodiment, for each image page, typical margins and minimal margins are identified. The typical margins may be determined from the outermost bounding box and the minimal margins may be determined from a theoretical box encompassing the content area and all other images on the page such as annotations, notes, headers and footers, and the like. The publishing service210may determine a final trim box that satisfies both typical margin and minimal margin requirements. Subsequently, all images on a digital image page are cropped by the final trim box. As a result, the output images will have consistent margins across the pages.

After the digital image pages are aligned and have defined margins, a print-ready document file is ready for on-demand printing of the content, and at block420, the print-ready document is stored in the content store214. Thereafter, the routine400terminates.

It is noted that the aforementioned processes and embodiments are described only for illustrative purposes and, thus, it is contemplated that all or some of processes described inFIG. 4can be fully automated or partially automated. It is further contemplated that some of processes described inFIG. 4can be implemented in parallel on several discrete systems by one or more cooperative executable modules to efficiently produce a print-ready document. Still further, while the focus of the above routine400was to produce an on-demand print-ready document, it should be appreciated that the routine400may be used to simply improve the quality of a digital image, irrespective of whether or not the image is to be printed. More particularly, the output of an image processed according to routine400may be a document ready for an electronic book reader, or to clarify a faxed document. Accordingly, while the disclosed subject matter is well adapted for generating an on-demand print-ready document, this should be viewed as an illustrative application of the disclosed subject matter, and not as being limited thereto.

FIG. 6is a flow diagram of a layered despeckling routine600for removing speckle artifacts from a digital image page in accordance with various embodiments of the disclosed subject matter. As those skilled in the art will appreciate, conventional despeckling processes typically use a generic median filter across the entire page image, which usually degrades the quality of the digital image page. In some cases, using such a median filter results in making the textual content unrecognizable as the median filter is unable to differentiate speckle artifacts from the textual content and, by applying aggressive speckle/noise removal processes on the textual content, some portion of the textual content may be erroneously deleted.

In at least some embodiments described herein, the publishing service210may identify several layers or areas of a digital image page and apply a layered despeckling process that uses a different speckle artifact removal criteria for each particular layer. The removal criteria may be determined to maintain a balance between the quality of the content and the accuracy in removing speckle artifacts.

There are various ways to identify and generate layers of the digital image page. However, for the purpose of discussion, it is to be assumed that the layers of the digital image page are identified through an iterative segmentation process, such as that described inFIG. 4. That is, the publishing service210defines threshold criteria for despeckling the page image such that despeckling may be repeatedly/iteratively performed until the resulting image page meets the threshold criteria for the speckle noise removal. As mentioned above, this iterative, continuous process is set forth in regard toFIG. 6.

Beginning at block602, a first segmentation process is performed to produce several segmentation layers. Results of a segmentation process may include text regions, image regions, text lines, words, characters, and the like. In one embodiment, the segmentation process results in segments corresponding to the images, text regions, and, within text regions, text lines.

Each segment/layer is associated with a type of content within the segment. Correspondingly, based on the type of content, a suitable despeckling process or criteria is selected and applied. Thus, if a layer includes less important content or no content, such as the margins of a page, the publishing service may apply an aggressive despeckling process. Likewise, if a layer includes more important content, such as textual content, the publishing service may apply a conservative despeckling process.

To begin generating the layers/segments, as shown inFIG. 7, an outermost bounding box702of a digital image page502is first identified. The first layer may be a non-content area704that is the outside the outermost bounding box702on the digital image page502. A second segment or layer706, corresponding to the inside of the outermost bounding box, i.e., the content area that is the union of all the content regions, text line regions, and image regions, is identified/generated. The second layer may be an area706including image region708and text regions710-714, which is internal to the bounding box702. A third layer (not shown) may be the inter-regional area of a text line region that contains only text and is grouped by individual lines of text. As suggested above, depending on a need of the publishing service, additional layers may be defined and identified for the layered despeckling process. For example, a fourth layer may correspond to words-and-character regions within individual text line regions.

With regard toFIG. 6, at block604, the publishing service210removes speckle artifacts in the first layer which is an external area (such as non-content area704inFIG. 7) to the outermost bounding box702. With reference toFIG. 7, removing artifacts in the first layer would likely affect those artifacts pointed to by arrows713and715. On the first layer, as this is a non-content area, the publishing service210could apply an aggressive noise/artifact removal process, such as a median filter, to delete most speckle noises.

At block606, on the second layer (such as a content area706inFIG. 7), the publishing service210may apply a more conservative noise removal process to delete speckle noises. As applied, the despeckle process may remove most speckles that are found in the area internal to the bounding box702and inter-regional areas (such as areas outside of image region708and text line regions710-714) but excluding the content internal to those regions/areas (i.e., the image and text areas).

At block608, another despeckling process may be applied to a third layer of segments to despeckle inter-regional areas. As shown inFIG. 8, a third layer may be defined within text regions, such as region710, that identifies text lines, as indicated by text lines802-804. In applying the despeckling process to this third layer, the inter-regional area of a text region710that falls outside of text lines802-804is processed. On this third application of despeckling, the publishing service210may optionally apply a more conservative noise removal process to remove speckle artifacts (noises) such that the textual content remains intact. Of course, in an alternative embodiment, the despeckling process may not be applied to the third layer in order to prevent any quality degradation in the textual content. In yet further embodiments, the layered despeckling process may be applied to the fourth layer, such as an inter-words and/or inter-character layer of the text lines802and804.

As mentioned above, for each type of segment being processed, a corresponding despeckling algorithm is applied. In other words, the despeckling process is a content-aware despeckling process. For inter-regional (e.g., areas between image segments and text segments) a more aggressive despeckling algorithm or removal threshold may be applied. As one example, in the most aggressive despeckling, connected pixels (as determined by a connected component algorithm) of less than 50 pixels are removed as superfluous, or undesired, noise. Alternatively, when despeckling within a text region, connected pixels of less than 10 pixels are removed as being superfluous noise. Still further, when despeckling between segments of text lines, a yet more conservative threshold is used, such as removing only connected pixels of 5 or less.

As discussed above, the layered despeckling process, in conjunction with an iterative segmentation process, may improve the image quality of the on-demand printing ready document because after each despeckling process, less speckle artifacts (noises) may remain on the digital image page. In other words, (while not shown) after segmenting and despeckling the digital image page, the process may be repeated. The despeckling enables a subsequent segmentation process to achieve more improved segmentations. The publishing service210may continue this iteration of segmentation/despeckling until predetermined threshold criteria for the despeckling process have been met. Additionally, the iterative segmentation and despeckling process can be used to generate various outputs, including XML files, TIFF files, etc.

Referring now toFIGS. 9A and 9B, block diagrams900and910illustrate two possible iterative processes using iterative segmentation and layered despeckling. As shown inFIG. 9A, as a part of the layered despeckling process, the publishing service210may utilize despeckling criteria/thresholds to determine whether another iteration of despeckling should occur, as indicated by decision block902. By way of example, the despeckling criteria may be based on a ratio of the speckle artifacts removed versus the speckle artifacts remaining, or an absolute number of speckles removed. At decision block902, if the threshold criteria have not been met, a segmentation process will be applied to get a better defined segmentation result for the digital image page, which will in turn lead to a better result in recognizing content from speckles in the subsequent despeckling process.

As will be appreciated by one of ordinary skill in the art, the despeckling criteria may be modified and tuned based on the importance of the content on the layer, the possibility to degrade the quality of the content by removing speckles, the richness of the content, etc. As an alternative to focusing on despeckling, and as shown inFIG. 9B, when the segmentation process and despeckling process are used as a part of an Optical Character Recognition (OCR) process, an alternative set of criteria can be used. For example, rather than focusing on despeckling criteria, the criteria may be made in terms of segmentation criteria, as indicated by decision block912, with the result being a better segmented image. Of course, when better segmentation is achieved, more specific and higher performing despeckling can be applied to that segment without the loss of content. By way of example, but not limitation, the segmentation criteria may be based on the number of words recognized by an OCR engine from a corresponding layer

FIG. 10is a flow diagram of a border noise removal routine1000for removing border artifacts from a digital image page, such as page502ofFIG. 5, in accordance with embodiments of the invention. As described above, the border noise removal process can be implemented after any combination of a segmentation process and/or a despeckling process has been applied to the digital image page. Thus, the border noise removal routine1000may be implemented in conjunction with the iterative segmentation process illustrated inFIG. 6.

For the purpose of discussion, it is assumed that a segmentation process may be used to identify several different layers, for example, a first layer (background, non-content area), a second layer (content area which is the union of all the content, text, and images), a third layer (text lines), etc. It is further assumed that a degree of border noise removal will be tailored for each layer based on the importance of the content or the richness of the content within the layer.

Beginning with block1002, the page layers or segments are obtained, such as a first layer (boundary region or background), a second layer (a content box region) and a third layer (regions which the publishing service wants to preserve without any change, e.g., text lines regions). At block1004, the first layer of segments is obtained.

At block1006, border removal criteria for the current level is selected. If this is the first level, border removal criteria is selected for removing almost all border artifacts, noises, etc., from the first layer. As described above, the first layer is generally a background/non-content area, hence the aggressive removal process.

At block1008, the border artifacts found in the current layer based according to the selected border removal criteria are removed. In one embodiment, the publishing service may apply a connected component analysis to the first layer, which identifies border objects and analyzes pixels in the border objects to identify a border artifact that is to be removed. The connected component analysis and associated border removal criteria will be explained later inFIG. 11.

At decision block1010, a decision is made as to whether there are any additional content layers to be processed. If so, at block1012the next layer is selected, the routine proceeds to block1006where border removal criteria for the now-current layer is selected, and the above-described process is repeated. This continues until, at decision block1010, there are no more layers to process and the routine1000terminates.

With each layer, suitable border removal criteria is selected. This selection assists in maintaining a balance between accurately identifying and removing border artifacts and preserving the important content.

FIG. 11is a flow diagram of a border removal routine1100for removing superfluous border artifacts from a digital image page in accordance with various embodiments of the disclosed subject matter.

Beginning at block1102, border objects for the digital page image are identified. In particular, border objects are superfluous (i.e., not part of the page content) objects/artifacts that fall outside of the content area of a page image but within the page boundaries. Illustrative border objects are shown inFIG. 12, including border objects1205,1206, and1207. Identifying border objects may be accomplished in a variety of manners, all of which fall within the scope of the disclosed subject matter. However, in an illustrative embodiment, border objects may be found using a connected component algorithm (which is known in the art) that, generally speaking, for a given pixel/artifact, identifies other pixels that are adjacent to or connected to the given pixel. At block1104, the size and location of the border artifacts is determined.

At control block1106, a looping construct is begun to iterate through all of the identified border objects. For each border object, at least some of the steps up to end control block1116are executed. In particular, at decision block1108, a determination is made as to whether the border object, such as border object1205, touches or crosses within the page content's bounding box1204. If it is determined at decision block1108that the border object does not touch the content bounding box1204, at block1110the border object is evaluated according to various criteria to determine whether the border object should be removed. These criteria include by way of illustration, but are not limited to, whether the border object is closer to the content box1204or to the page boundary (with those closer to the page boundary more likely superfluous); whether the border object is aligned with, or oblique to, the nearest page boundary (indicating a possible intended page border); a ratio of the width to the height of the border object such that if greater than a threshold the border object is considered superfluous; and the like.

At decision block1112, if the evaluation of criteria indicates that the border object is superfluous, the routine1100proceeds to block1114where the border object is removed from the digital image page. Alternatively, if the evaluation of criteria indicates that the border object should be retained, or after deleting the border object, the routine1100proceeds to end control block1116where the routine1100returns to control block1106if there are additional border objects to process. Otherwise, the routine1100terminates.

Returning to decision block1108, if the border object touches (or crosses within) the content's bounding box1204, the routine1100proceeds to decision block1118(FIG. 11B). At decision block1118, the border removal component may determine whether the border object's bounding box1202touches content regions in the content bounding box1204. If the border object (via the border object's bounding box1202) does not touch any content in the content bounding box1204, it may be safe to remove the border object as described below since removal of such object does not cause a removal of any part of the content regions in the digital image page.

At block1122, the number of pixels of the border object within the content region is determined. If, at decision block1124, the determined number of pixels exceeds a predetermined threshold, this may indicate that removing the border object may cause a degradation in the quality of the image/content. In such a case, at block1126, the border object may not be deleted from the digital image page, to preserve the content region, and the routine1100proceeds to block1106as described above. Alternatively, if the number of pixels of the border object within the content region does not exceed the predetermined threshold, at block1114(FIG. 11A), the border object1205is deleted from the digital image page.

If it is determined at decision block1118that the border object1205does not touch any content regions, at block1120, the number of pixels of the border object residing in the boundary area1210will be evaluated to determine whether the border object is a border artifact that is to be removed. If, at decision block1124, the number of pixels of the border object residing within the boundary area does not exceed a predetermined threshold, at block1120the border object is deleted from the digital image page. Alternatively, if the number of pixels exceeds a threshold, this may indicate that the border object should not be deleted from the digital image page and at block1126the border object is retained.

After all border objects in the page have been processed, as determined at end control block1116, the routine terminates.

It is to be noted that the above-mentioned rules explained inFIG. 11are used for illustrative purpose only and thus should not be considered as limiting. It is to be further noted that depending on the type of a border object, various border object removing rules and criteria will be used to determine whether the identified border object is to be removed or not. As shown inFIG. 13A, an identified border object1302may have a shape that surrounds the outermost bounding box (content bounding box), which has a border object bounding box bigger than the outermost bounding box. However, as shown inFIG. 13A, the border object1302does not touch or intersect the outermost bounding box. In order to process such a border object, as shown inFIG. 13B, the publication service may divide the boundary area into 4 rectangular areas, such as cutting areas1304,1306,1308, and1310, and evaluate the number of pixels in each rectangular area. Thus, for each rectangular area, the border removal routine can be applied and each fraction of the border object can be treated as an individual border object.

As mentioned above, one aspect of preparing a digital image for on-demand printing is to arrange all pages within the image so that the content of each page is similarly located. The need to arrange and align pages of a digital image arises due to a variety of factors, including issues with regard to scanning a printed copy of the content. By way of illustration example,FIG. 14Ais a block diagram illustrating multiple pages of a digital image where the content (as represented by the bounding boxes) of the images are misaligned with respect to each other. Alternatively, when printed, as shown inFIG. 14B, it would be desirable to have the content of the page images similarly aligned.

FIG. 15is a flow diagram of an illustrative routine1500for aligning pages of a digital image. Beginning at block1502, content bounding boxes for each page of the image are identified. Examples of content bounding boxes are shown inFIG. 14A, boxes1403,1405, and1407of pages1402,1404, and1406, respectively. At block1504, the pages are then classified as being one of empty, regular, or irregular according to the context boxes, and particularly according to the context box size.

At block1506, the “regular” pages of the image are registered, meaning that a registration point common to all regular content boxes is placed at a common location for the page. While any number of points may be used as a registration point, in one embodiment, the top left corner of the content box is used as the registration point and the content of the “regular” pages of the image are positioned on their respective pages with their registration point at a common location on the page. At block1508, the remaining pages with content (i.e., the “irregular” pages) are registered with the “regular” pages such that content thereon is positioned as best as possible, if not optimally, with the content of the other pages

At block1510, the margins for the pages are normalized, i.e., made the same. Normalizing page margins addresses the fact that the content of the pages may be of different sizes (whether or not the pages are regular or irregular pages). After normalizing the page margins for the pages in the image, adjustments may optionally be made for binding purposes. For example, binding width may be added to the left margin of odd numbered pages while, conversely, binding width may be added to the right margin of even numbered pages. Thereafter, the routine1500terminates.

While the above description is generally made in regard to receiving a client request for on-demand printing of content, it should be appreciated that this is an illustrative example, and the subject matter disclosed above should not be construed as limited to this particular scenario. In alternative embodiments, rather than waiting for a consumer's request for on-demand printing, a service may anticipatorily process content for on-demand printing and store the processed content in the content store214. Still further, the processed content may be used in ways other than for on-demand printing. For example, the processed content may be used in electronic book readers, on user computers, and the like. Moreover, the processed content may be stored in any number of formats, both open and proprietary, such as XML, PDF, and the like.