Skip to content

Instantly share code, notes, and snippets.

@GroupDocsGists
Created February 25, 2021 10:36
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/4e52c001c3674a13067aadfc1c5e8016 to your computer and use it in GitHub Desktop.
Save GroupDocsGists/4e52c001c3674a13067aadfc1c5e8016 to your computer and use it in GitHub Desktop.
Extract Images from eBooks in C# using .NET Parsing API - (EPUB, FB2, CHM)
// Parse eBooks to Extract Images from EPUB, FB2, CHM file and save to disk in C#
using (Parser parser = new Parser("ebook.epub"))
{
// Extract images from the eBook
IEnumerable<PageImageArea> images = parser.GetImages();
ImageOptions options = new ImageOptions(ImageFormat.Jpeg);
int imageNumber = 0;
// Iterate over extracted images
foreach (PageImageArea image in images)
{
image.Save(("Image-" + imageNumber.ToString() + image.FileType.Extension), options);
imageNumber++;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment