View Single Post
Old 12-20-2023, 06:49 PM   #1448
jhowell
Grand Sorcerer
jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.
 
jhowell's Avatar
 
Posts: 7,119
Karma: 92500001
Join Date: Nov 2011
Location: Charlottesville, VA
Device: Kindles
Quote:
Originally Posted by jackm8 View Post
What exactly happens to book covers .jpg file as you convert epub to kfx?

I believe that they get compressed at one point during the process, and I'd like to know if it's possible to avoid it, so that kfx would use the same exact quality as the one present in .epub format.
There are several factors that influence the handing of cover images during conversion.

Quote:
Originally Posted by jackm8 View Post
If I don't tick "Use cover from source file" in Calibre, cover resolution will be reduced quite a bit, and differences will be plainly visible.
If you are doing conversion in calibre instead of using the KFX Output plugin CLI make sure to select "Use cover from source file" in the metadata tab and set the Output profile in the Page Setup tab to "Tablet" in order to avoid replacement or degradation of images by calibre's conversion.

Quote:
Originally Posted by jackm8 View Post
If I tick it, cover resolution will be preserved, but file will still be compressed somewhat.
The plugin will regenerate a JPEG cover image, potentially reducing the quality slightly, if it is not in JPEG File Interchange Format (JFIF) since that format is required for covers to appear on the lock screen of Kindle devices. That might be what is happening in your case.

Quote:
Originally Posted by jackm8 View Post
I then converted that .kfx back to .epub. File size decreased again. When I compared that cover.jpg to my source cover.jpg, compression artefacts were visible under higher magnifications.
There should be no change in cover images when converting KFX to EPUB as long as the proper calibre conversion settings or the KFX Input plugin CLI is used. Those artifacts are most likely from the conversion of EPUB to KFX.

Quote:
Originally Posted by jackm8 View Post
Here things got interesting. I then went and used uncompressed .png format as a cover (I had to open .epub and change metadata.opf and titlepage.xhtml). I converted this .epub to .kfx via Command Line Interface. I again did .kfx to .epub to get a viewable file back. It converted cover.png to cover.jpg, but this time jpeg compression quality was much higher compared to previous attempt. It was practically identical to my source file. File sizes even increased.
The Kindle Previewer, which does most of the work in converting EPUB to KFX, will convert PNG images to JPEG, often resulting in a larger size than the original image.

Quote:
Originally Posted by jackm8 View Post
Comparison; left original jpeg, right as converted via kfx output. Dithered image, dithering goes to shambles when jpeg is compressed:
Dithered images are a bad idea in e-books. Images often need to be converted or rescaled during rendering, resulting in unpleasant artifacts.


Perhaps there is something else going on with the high resolution cover images that you are using. Feel free to post (public domain) sample files that demonstrate the problem if you want me to look into this further.
jhowell is offline   Reply With Quote