Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Formats > ePub

Notices

Reply
 
Thread Tools Search this Thread
Old 12-14-2019, 11:37 AM   #1
mathil
Evangelist
mathil ought to be getting tired of karma fortunes by now.mathil ought to be getting tired of karma fortunes by now.mathil ought to be getting tired of karma fortunes by now.mathil ought to be getting tired of karma fortunes by now.mathil ought to be getting tired of karma fortunes by now.mathil ought to be getting tired of karma fortunes by now.mathil ought to be getting tired of karma fortunes by now.mathil ought to be getting tired of karma fortunes by now.mathil ought to be getting tired of karma fortunes by now.mathil ought to be getting tired of karma fortunes by now.mathil ought to be getting tired of karma fortunes by now.
 
Posts: 445
Karma: 287725
Join Date: Sep 2014
Location: Europe
Device: Kobo Aura H2O/Glo HD/Libra 2, Kindle PW3/PW5/PW11, Boox Palma
How to bulk replace images in EPUB?

Some of the epubs I've bought have .png images. I've been trying to convert and substitute them with their .jpeg equivalent (same file name, different format), but the only way I can seem to be doing so with no hassle is through Calibre Editor using the 'substitute image' option. However, that is quite slow as there's no batch option for doing that, and I have one particular epub that contains 200+ images.
Is there a way I can substitute all of them in one go and still have a functioning epub at the end?
mathil is offline   Reply With Quote
Old 12-14-2019, 12:56 PM   #2
Turtle91
A Hairy Wizard
Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.
 
Turtle91's Avatar
 
Posts: 3,301
Karma: 20171571
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 15/11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
Be careful when substituting - sometimes the book creator uses png for a specific reason, eg. .png can have transparent backgrounds so the image works with whatever color background the user selects, while jpg does not.

Code:
- you will need to do the conversion from .png to .jpg using your favorite image 
software/process and put them in an accessible location/folder

- open the epub file manually: 
  -- rename the file from yourfilename.epub to yourfilename.zip
  -- open the zip file, find the image files and delete
     (sometimes they are located in: ../OEBPS/Images/)
  -- copy the new/changed images to that folder
  -- rename the file back to an .epub extension

 - OR -

- you can accomplish this step using Sigil by multi-selecting all the files you 
  want to delete (ctrl-click or shift-click) in the Book Browser Pane then hitting
  the delete key. Then using the "add existing files" button (plus sign on the 
  toolbar, or Insert/File on the menu, or Ctrl-shift-I) then multi-select all the
  images you wish to add then selecting "open"

- Once the images are in your epub use your editor of choice (Sigil or Calibre Editor
  are excellent, free, editors) to change the file reference in the html:
  -- search for something like: Images/(.*?).png"
  -- replace with something like: Images/\1.jpg"
You should definitely do this on a backup copy of your book, and I would recommend iterating through one at a time (replace/find instead of replace all).

Last edited by Turtle91; 12-14-2019 at 01:13 PM.
Turtle91 is offline   Reply With Quote
Advert
Old 12-15-2019, 06:30 PM   #3
exaltedwombat
Guru
exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.exaltedwombat ought to be getting tired of karma fortunes by now.
 
Posts: 878
Karma: 2457540
Join Date: Nov 2011
Device: none
Out of interest, why?
exaltedwombat is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Bulk edit replace problem StegBook Library Management 2 08-08-2018 09:46 PM
How to replace PNG images by SVG in epub? j.p.s ePub 38 08-12-2017 04:27 AM
Bulk replace books on Kindle from Calibre BeeTee-Ess Calibre 2 09-13-2012 10:05 AM
Any way to bulk replace... drdann Calibre 1 12-31-2010 12:56 PM
How to bulk replace author - book name alophind Calibre 2 11-25-2010 08:25 AM


All times are GMT -4. The time now is 05:25 PM.


MobileRead.com is a privately owned, operated and funded community.