Package org.apache.tika.imageprocessing
Class BlankImageCheck
java.lang.Object
org.apache.tika.imageprocessing.BlankImageCheck
- All Implemented Interfaces:
Serializable,ImageCheck
Refuses a blank image: the share of pixels whose gray level differs from the image's most
common gray level (the background) by more than
tolerance is at most maxInk.
Measured on a copy of at most 1,000 pixels a side. The default maxInk, 0.0001
(0.01 %), is below a page with a few lines of text: on 13,641 PDF pages it flagged the 87 with
no ink at all and 3 with a single line. With despeckle (the default) a pixel counts as
ink only if most of its 3 x 3 neighbourhood does, so scattered specks (a noisy scan) do not
hide a blank page: salt-and-pepper noise of 0.1 % to 5 % comes out blank, and none of 600 text
pages did. An image with transparency is blank only if it is blank over white and over black.
An image it cannot read or decode is admitted.- Since:
- Apache Tika 4.2
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.tika.parser.enricher.ImageCheck
ImageCheck.Verdict -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncheck(ImageProbe image, Metadata metadata, ParseContext context) doubleintbooleanvoidsetDespeckle(boolean despeckle) voidsetMaxInk(double maxInk) voidsetTolerance(int tolerance)
-
Constructor Details
-
BlankImageCheck
public BlankImageCheck()
-
-
Method Details
-
check
public ImageCheck.Verdict check(ImageProbe image, Metadata metadata, ParseContext context) throws IOException - Specified by:
checkin interfaceImageCheck- Parameters:
image- the image and what earlier checks have already learned about itmetadata- the metadata of the image the engine would be handedcontext- the parse context- Throws:
IOException
-
isDespeckle
public boolean isDespeckle() -
setDespeckle
public void setDespeckle(boolean despeckle) -
getMaxInk
public double getMaxInk() -
setMaxInk
public void setMaxInk(double maxInk) -
getTolerance
public int getTolerance() -
setTolerance
public void setTolerance(int tolerance)
-