Answers.Body: <p>You cannot do this in bulk without some programming. 
  As @Tom indicated, <code>.epub</code> files are ZIP files. The extensions of the "file names" in the ZIP files for images are often, but not guaranteed to be '.jpg<code>,</code>.png<code>or</code>.gif`. But extracting these using:</p>
  
  <pre><code>unzip abc.epub *.jpg *.png *.gif
  </code></pre>
  
  <p>will have you miss any that have the extension <code>.jpeg</code>, <code>.JPEG</code>, <code>.Png</code>. </p>
  
  <p>Because of the practically unlimited range of possible extensions for images referred to in the text of your ebook, they can only reliable be identified by one of the following methods:</p>
  
  <ol>
  <li>analysing the (HTML) text </li>
  <li>checking the headers of all the files included¹</li>
  </ol>
  
  <p>The analysis being the better tool, as there might be (image) files in a (badly formatted) ebook that are never referenced/displayed².  This however requires you to parse the XML/HTML to find the names of the files referenced in the <code>&lt;IMG&gt;</code> tags.</p>
  
  <p>If your ebooks are programmatically generated, they might include (non-necessary) regularities in the image file naming, so that the above <code>unzip</code> command does work for your case. If that is so a simple script walking over your  ebook library file structure and unzipping every ebook in an 'Images' subdirectory would suffice.</p>
  
  <p>¹ <sub>There are only very, very few filenames pre-specified for .<code>epub</code>. ebooks, so you might as well check all the files.</sub><br>
  ² <sub>I once analysed an <code>.epub</code>, that looked too large for its contents. For some reason it included parts of the Christian mythology texts, which could not be displayed with a normal reader.</sub></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-05-17T10:11:46.347Z
Answers.Text: With bash (which is Ubuntu's default shell, which is the distro the questioner is using), you could use `shopt -s nocaseglob` followed by your unzip command. It still wouldn't catch things like `*.jpeg` or more irregular file extensions, but it would deal with case sensitivity problems.
Answers.UserDisplayName: evilsoup
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-05-16T05:41:19.830Z
Answers.LastActivityDate: 2014-05-16T05:41:19.830Z
Answers.UserDisplayName: Anthon
Answers.Body: <p>Any non-DRM'ed epub ebook is just a renamed zipped folder. All you'll need to do is rename the file from <code>&lt;filename&gt;.epub</code> to <code>&lt;filename&gt;.zip</code> and unzip the folder. At that point, you should be able to navigate within the folders to find the images and do whatever you like with them.</p>
  
  <p>Hope that helps!</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-05-16T02:43:22.820Z
Answers.Text: I found this very useful. I'm on Ubuntu, so I just open the epub with Archive Manager. Is there any way to perhaps do this in bulk, or to maybe insert the names of the pictures in the converted ebook? (So I know which one is referred to? Thanks.
Answers.UserDisplayName: ike
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-05-15T21:26:51.220Z
Answers.LastActivityDate: 2014-05-15T21:26:51.220Z
Answers.UserDisplayName: Tom
Body: <p>I read most of my books in txt format. I use Calibre to convert them to that format. While it works great for books that are mostly text, some ebooks which contain pictures can be very confusing when the pictures are removed. Is there some way to either:</p>
  
  <ol>
  <li>Take all the images from a book and save them into one folder without having to copy each picture one at a time, or</li>
  <li>Screenshot each page of the book with a program (again, I don't want to have to do this manually)?</li>
  </ol>
  
  <p>If it could be done in bulk for many books, and with a Calibre plugin, that would be even better.</p>
  
Tags: <conversion><linux>
Title: How can I extract all the pictures from an ebook?
UserDisplayName: ike
ThreadText: # How can I extract all the pictures from an ebook?
  
  (Asked by: username_0 on 2014-05-15)
  
  I read most of my books in txt format. I use Calibre to convert them to that format. While it works great for books that are mostly text, some ebooks which contain pictures can be very confusing when the pictures are removed. Is there some way to either:
  
  1. Take all the images from a book and save them into one folder without having to copy each picture one at a time, or
  2. Screenshot each page of the book with a program (again, I don't want to have to do this manually)?
  
  If it could be done in bulk for many books, and with a Calibre plugin, that would be even better.
  
  **Tags:** conversion, linux
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_3 on 2014-05-15. Score: 20 | Accepted answer
  
  Any non-DRM'ed epub ebook is just a renamed zipped folder. All you'll need to do is rename the file from `.epub` to `.zip` and unzip the folder. At that point, you should be able to navigate within the folders to find the images and do whatever you lusername_0 with them.
  
  Hope that helps!
  
  > **Comments:**
  > **username_0**: I found this very useful. I'm on Ubuntu, so I just open the epub with Archive Manager. Is there any way to perhaps do this in bulk, or to maybe insert the names of the pictures in the converted ebook? (So I know which one is referred to? Thanks.  
  
  ---
  
  ### Answer by username_1 on 2014-05-16. Score: 6
  
  You cannot do this in bulk without some programming. 
  As @username_3 indicated, .epub files are ZIP files. The extensions of the "file names" in the ZIP files for images are often, but not guaranteed to be '.jpg,.pngor.gif`. But extracting these using:
  unzip abc.epub *.jpg *.png *.gif
  
  will have you miss any that have the extension .jpeg, .JPEG, .Png. 
  Because of the practically unlimited range of possible extensions for images referred to in the text of your ebook, they can only reliable be identified by one of the following methods:
  
  analysing the (HTML) text 
  checking the headers of all the files included¹
  
  The analysis being the better tool, as there might be (image) files in a (badly formatted) ebook that are never referenced/displayed².  This however requires you to parse the XML/HTML to find the names of the files referenced in the  tags.
  If your ebooks are programmatically generated, they might include (non-necessary) regularities in the image file naming, so that the above unzip command does work for your case. If that is so a simple script walking over your  ebook library file structure and unzipping every ebook in an 'Images' subdirectory would suffice.
  ¹ There are only very, very few filenames pre-specified for .epub. ebooks, so you might as well check all the files.
  ² I once analysed an .epub, that looked too large for its contents. For some reason it included parts of the Christian mythology texts, which could not be displayed with a normal reader.
  
  > **Comments:**
  > **username_2**: With bash (which is Ubuntu's default shell, which is the distro the questioner is using), you could use `shopt -s nocaseglob` followed by your unzip command. It still wouldn't catch things lusername_0 `*.jpeg` or more irregular file extensions, but it would deal with case sensitivity problems.  
  
  ---
  
  