![]() |
#1 |
Zealot
![]() Posts: 133
Karma: 10
Join Date: Nov 2021
Device: Kobo Libra 2
|
Disappearing images (png converted to jpg)
I have quite a few books that are very large - in the hundreds of mb, in some cases.
I've worked out how to use ImageMagick to convert the png files (which are nearly always - perhaps always - used in the books in question, rather than jpegs) into jpg format, and then delete the png files from the book, and finally import the jpg files into the book. Trouble is, although all of the new jpg image files appear in the Calibre editor exactly where the old png files did, when I open up the book they're all (apart from the cover image) completely blank - just showing "img" at the top. Do I have to somehow re-link each image with its location within the book? If so, how... ? |
![]() |
![]() |
![]() |
#2 |
Zealot
![]() Posts: 133
Karma: 10
Join Date: Nov 2021
Device: Kobo Libra 2
|
(Just to be clear, the reason I'm converting them to jpg is that Calibre seems to be able to compress them much more easily and quickly, as opposed to png files.)
|
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 7,068
Karma: 91577715
Join Date: Nov 2011
Location: Charlottesville, VA
Device: Kindles
|
The calibre editor has a "Replace image with file" function that can replace an image and link the new one into the book properly.
|
![]() |
![]() |
![]() |
#4 |
Zealot
![]() Posts: 133
Karma: 10
Join Date: Nov 2021
Device: Kobo Libra 2
|
Right. But if there are tons of images in a book (which is usually the case, for obvious reasons, in the books I'm talking about), is there a way to replace the images other than doing it one by one?
|
![]() |
![]() |
![]() |
#5 | |
Bibliophagist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 46,108
Karma: 168983686
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
Quote:
This does require replacing all .png file with their .jpg version. |
|
![]() |
![]() |
Advert | |
|
![]() |
#6 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,611
Karma: 9500498
Join Date: Sep 2021
Location: Australia
Device: Kobo Libra 2
|
Quote:
For each image you replace, you need to find the corresponding link in the html files and adjust the filename so it points to the new image. If you had used the "replace image with file..." option from the context menu on the image file, this would have happened automatically, but if the image size is different, and you specified width and height (as shown in the screenshot), then that would need to be changed manually. Is there a way to batch change files? Not that I am aware of. |
|
![]() |
![]() |
![]() |
#7 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,339
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Bulk rename all the files to .jpg using the bulk rename tool in the editor. That will update all the links. Then use your scsript to actually convert the files to real jpg.
|
![]() |
![]() |
![]() |
#8 | |
Zealot
![]() Posts: 133
Karma: 10
Join Date: Nov 2021
Device: Kobo Libra 2
|
Quote:
I did as you suggested, but I still have blank spaces in the book where all of the images should be. |
|
![]() |
![]() |
![]() |
#9 |
Zealot
![]() Posts: 133
Karma: 10
Join Date: Nov 2021
Device: Kobo Libra 2
|
|
![]() |
![]() |
![]() |
#10 |
Zealot
![]() Posts: 133
Karma: 10
Join Date: Nov 2021
Device: Kobo Libra 2
|
Actually, one follow-up question - which I realise might be asking too much!
Some of the books I have contain literally hundreds of images, some of which are already in jpg form, distributed apparently randomly throughout. This makes it very difficult to select just the non-jpg images, other than manually. If I accidentally include just one jpg image when I'm trying to change the file extensions in bulk, it gives me an error message because, in that one case, I'm making a request that is circular. So, is there a way to sort the images in the left-hand panel by type, rather than in terms of their position in the book? Then it would be relatively easy to select just the non-jpg images. Thanks again! |
![]() |
![]() |
![]() |
#11 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,339
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
No there is no way to sort the file browser
|
![]() |
![]() |
![]() |
#12 |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 31,046
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
![]() DANGER backup REGEX the OPF section |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
PNG to JPG | ableal | Calibre | 12 | 10-04-2022 07:39 PM |
Convert epup3 pages to consecutive image file(JPG,PNG...) | tai0909 | ePub | 5 | 10-14-2019 05:19 AM |
Replace all jpg with png with transparent background? | Claghorn | Recipes | 0 | 08-16-2012 12:14 PM |
Touch Converting multiple .jpg/.png into ePub for Manga | Gater | Kobo Reader | 11 | 01-08-2012 07:28 AM |