View Single Post
Old 12-20-2023, 08:41 AM   #1446
jackm8
Addict
jackm8 ought to be getting tired of karma fortunes by now.jackm8 ought to be getting tired of karma fortunes by now.jackm8 ought to be getting tired of karma fortunes by now.jackm8 ought to be getting tired of karma fortunes by now.jackm8 ought to be getting tired of karma fortunes by now.jackm8 ought to be getting tired of karma fortunes by now.jackm8 ought to be getting tired of karma fortunes by now.jackm8 ought to be getting tired of karma fortunes by now.jackm8 ought to be getting tired of karma fortunes by now.jackm8 ought to be getting tired of karma fortunes by now.jackm8 ought to be getting tired of karma fortunes by now.
 
jackm8's Avatar
 
Posts: 335
Karma: 3000000
Join Date: Nov 2015
Device: none
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.

I could be wrong, I could also be doing something incorrectly, but here's how I got to this conclusion:

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 I tick it, cover resolution will be preserved, but file will still be compressed somewhat. I tried to convert files both in Calibre and via Command Line Interface, and the results were almost identical, but file sizes did decrease in both cases compared to original .epub, making me suspect that cover image was compressed. 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.

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.


File sizes:

'original cover present in epub.jpg' = 2.34mb
'cover converted to kfx then back to epub.jpg' = 1.57mb

'cover as png.png' = 2.22.mb (lossless compressed png)
'cover as png' converted to kfx then back to jpg.jpg' = 2,63mb

'original epub' = 2.65mb
'kfx made in calibre with keep source file' = 2.16mb
'kfx made with command line' = 2.15mb
'epub converted from 'kfx made in calibre...'' = 1.80mb

'epub using .png file for cover' = 2.50mb
'kfx made from 'epub using .png as cover'' = 3.13mb
'epub converted from 'kfx made from 'epub using .png as cover'' = 2.78mb

Comparison; right original jpeg, left as converted via kfx output. Dithered image, dithering goes to shambles when jpeg is compressed:
Attached Thumbnails
Click image for larger version

Name:	comp 1.jpg
Views:	646
Size:	289.8 KB
ID:	205346   Click image for larger version

Name:	comp 2 zoomed in.jpg
Views:	664
Size:	239.3 KB
ID:	205347  

Last edited by jackm8; 12-20-2023 at 12:29 PM. Reason: correction on left and right in comparisson text
jackm8 is offline   Reply With Quote