View Single Post
Old 07-01-2021, 01:32 AM   #8
gianni_1
Connoisseur
gianni_1 began at the beginning.
 
Posts: 85
Karma: 10
Join Date: Nov 2015
Device: tablet
Quote:
Originally Posted by retiredbiker View Post
1. I use ImageMagick for this. Open a book in the editor, then select and export all the png images to a working directory. Then at the command line, change to that directory and run
Code:
mogrify -format jpg *.png
. then run
Code:
rm *.png
This leaves you with the jpg images. Go back into the editor and delete all the png images, and import the new jpg ones. Then, in the text files, search for .png and replace with .jpg. (You have to do that so the html knows to display the new files, otherwise you get nothing.) Then do the compression you need. This whole thing usually takes less than a minute, ImageMagick is really fast.

2. "All selected books" is not available either for the conversion or the compression, do it one at a time. I suspect it would be very complex for a plugin to safely do this sort of thing for many books...lots of edge cases, possible coding problems inside the books, and so on. And if a plugin depended on some tool (like ImageMagick or your Bulk thing), how many users' PCs might have that particular too installed? And sometimes I find books with a combination of png and gif (and maybe other) image formats that don't compress well. Or useless images I just want to delete.

I do sympathise with the desire for a bulk utility for this--I have many bloated books I collected before I learned how to do this, and started doing it on adding each such book. But I now look for a lot of things when I add a book, and I don't think I'd trust much mass processing...just my thinking.
I already follow a similar procedure (but I think faster ...):
- I open the book with the editor
- I select all the images (jpeg, png, jpg, so as not to waste time selecting only the .png) and export them to a working folder.
- I use a powerful program (Bulk Image Converter) to convert only .png to .jpg.
- I delete in the book the exported images.
- I import in the book the exported (and edited) images.
- I compress the imported images.
- finally I change in the book from .png to .jpg.
It sounds like a long procedure, but it's actually the fastest one possible.
gianni_1 is offline   Reply With Quote