Class CoverpageBookProcessor
java.lang.Object
nl.siegmann.epublib.bookprocessor.CoverpageBookProcessor
- All Implemented Interfaces:
BookProcessor
If the book contains a cover image then this will add a cover page to the book.
If the book contains a cover html page it will set that page's first image as the book's cover image.
FIXME:
will overwrite any "cover.jpg" or "cover.html" that are already there.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final Stringprivate static final org.slf4j.Loggerstatic intFields inherited from interface BookProcessor
IDENTITY_BOOKPROCESSOR -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static StringcalculateAbsoluteImageHref(String relativeImageHref, String baseHref) private DimensioncalculateResizeSize(BufferedImage image) private StringcreateCoverpageHtml(String title, String imageHref) private BufferedImagecreateResizedCopy(Image originalImage, int scaledWidth, int scaledHeight, boolean preserveAlpha) private byte[]createThumbnail(byte[] imageData) private ResourcefindCoverPage(Book book) private voidfixCoverResourceId(Book book, Resource resource, String defaultId) private StringgetCoverImageHref(Resource imageResource, Book book) private StringgetCoverPageHref(Book book) private ResourcegetFirstImageSource(Resource titlePageResource, Resources resources) processBook(Book book) private voidsetCoverResourceIds(Book book)
-
Field Details
-
MAX_COVER_IMAGE_SIZE
public static int MAX_COVER_IMAGE_SIZE -
log
private static final org.slf4j.Logger log -
DEFAULT_COVER_PAGE_ID
- See Also:
-
DEFAULT_COVER_PAGE_HREF
- See Also:
-
DEFAULT_COVER_IMAGE_ID
- See Also:
-
DEFAULT_COVER_IMAGE_HREF
- See Also:
-
-
Constructor Details
-
CoverpageBookProcessor
public CoverpageBookProcessor()
-
-
Method Details
-
processBook
- Specified by:
processBookin interfaceBookProcessor
-
findCoverPage
-
setCoverResourceIds
-
fixCoverResourceId
-
getCoverPageHref
-
getCoverImageHref
-
getFirstImageSource
-
calculateAbsoluteImageHref
-
createCoverpageHtml
-
calculateResizeSize
-
createThumbnail
- Throws:
IOException
-
createResizedCopy
private BufferedImage createResizedCopy(Image originalImage, int scaledWidth, int scaledHeight, boolean preserveAlpha)
-