Skip to content

Instantly share code, notes, and snippets.

@GroupDocsGists
Last active March 16, 2021 17:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GroupDocsGists/15bdf5cfa2bf46ef77b659e8cf20dc7e to your computer and use it in GitHub Desktop.
Save GroupDocsGists/15bdf5cfa2bf46ef77b659e8cf20dc7e to your computer and use it in GitHub Desktop.
Extract Images from eBooks in Java using Parser API - (PDF, EPUB, FB2, CHM)
// Parse eBooks to Extract Images from PDF, EPUB, FB2, CHM files in Java and save to disk.
Parser parser = new Parser("ebook.epub");
// Extract images from eBook and save in JPEG format.
Iterable<PageImageArea> images = parser.getImages();
ImageOptions options = new ImageOptions(ImageFormat.Jpeg);
int imageNumber = 0;
// Iterate over extracted images
for (PageImageArea image : images) {
image.save(Constants.getOutputFilePath(String.format("%d.jpeg", imageNumber)), options);
imageNumber++;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment