Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Editor

Notices

Reply
 
Thread Tools Search this Thread
Old 05-08-2026, 03:03 PM   #1
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 83,273
Karma: 153646249
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Bug in Remove unused images

The feature in the editor to remove unused images has a bug. It does not take into account images listed in the CSS that are not being used. That image is not being used yet the option to remove it won't remove it. That class is not being used. The Remove images should look to see if that class is being used and if not, remove the unused image.

Code:
.secbreak {
  background: url(../images/secbreak.jpg) no-repeat center;
  height: 30px;
  border: none;
  margin: 0.5em 0;
}
JSWolf is online now   Reply With Quote
Old 05-08-2026, 10:45 PM   #2
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 46,236
Karma: 29630732
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
as always with bug reports, I need a reproducer you asserting something is so doesnt make it so.
kovidgoyal is offline   Reply With Quote
Old 05-09-2026, 02:29 AM   #3
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 51,803
Karma: 180002898
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
For what it may be worth, I created a very simple ePub3 file.

The XHTML file contains:
Code:
<?xml version='1.0' encoding='utf-8'?>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops">
<head>
  <title></title>
  <link href="../Styles/stylesheet.css" type="text/css" rel="stylesheet"/>
</head>

<body>
  <hr class="secbreak"/>
</body>
</html>
The CSS file has one relevant entry:
Code:
.secbreak {
  background: url(../Images/secbreak.jpg) no-repeat center;
  height: 2em;
  border: none;
  margin: 0.5em 0;
}
I've attached two images which show the file preview and the result of trying to remove unused images.

If I edited the CSS entry to use images instead of Images, the image file does show as unused and removable.

If I removed the class="secbreak" from the XHTML file, the image is not removed since the unused CSS entry would have to be removed otherwise the image is still referenced by the CSS entry. So basically remove unused CSS rules and then remove unused images works as expected.
Attached Thumbnails
Click image for larger version

Name:	Screenshot 2026-05-08 232703.png
Views:	17
Size:	35.2 KB
ID:	223198   Click image for larger version

Name:	Screenshot 2026-05-08 232726.png
Views:	17
Size:	32.5 KB
ID:	223199  
Attached Files
File Type: epub secbreak.epub (5.9 KB, 9 views)

Last edited by DNSB; 05-09-2026 at 02:36 AM.
DNSB is offline   Reply With Quote
Old 05-09-2026, 02:56 AM   #4
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 46,236
Karma: 29630732
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
yeah remove images does not check if css rules match any html, that is done by remove unused css.
kovidgoyal is offline   Reply With Quote
Old 05-09-2026, 04:41 AM   #5
Terisa de morgan
Grand Sorcerer
Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.
 
Terisa de morgan's Avatar
 
Posts: 6,776
Karma: 13151503
Join Date: Jun 2009
Location: Madrid, Spain
Device: Kobo Clara/Aura One/Forma,XiaoMI 5, iPad, Huawei MediaPad, YotaPhone 2
Then, you have to remove first css and later the image. It makes sense.
Terisa de morgan is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Editor Plugin] Remove Unused Images jandamm Plugins 3 03-10-2026 05:30 PM
Remove unused fonts juliuss KOReader 4 09-03-2022 11:00 AM
Feature Request: Polish Books, Remove Unused Images Jaws Calibre 2 11-13-2020 10:42 PM
remove unused CSS rules rjwse@aol.com Editor 13 09-18-2019 09:39 AM
Remove unused CSS Rules Divingduck Editor 2 06-21-2014 07:51 AM


All times are GMT -4. The time now is 08:48 AM.


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