1
0
mirror of https://github.com/ciromattia/kcc synced 2025-12-13 01:36:27 +00:00
Commit Graph

353 Commits

Author SHA1 Message Date
Its-my-right
26327728d0 Update rainbow_artifacts_eraser.py
add param s=luminance.shape to irfft2 to avoid dimensions error on luminance
2025-07-20 10:55:09 -07:00
Alex Xu
61bfb0a51f fix pdf resolution 2025-07-20 09:19:40 -07:00
Alex Xu
2f03119926 add mupdf perf_counters 2025-07-20 09:02:19 -07:00
Alex Xu
8f08c63f4e pdf input uses all cpu cores 2025-07-20 09:02:19 -07:00
Adrian
eb24a400b4 Improve pdf support by using mupdf (#983)
* Improve pdf support with mupdf

* parallel page ranges not pages

* fix black blank

* remove full=True

* add TODO

* fix doc close

---------

Co-authored-by: Alex Xu <alexkurosakimh3@gmail.com>
2025-07-18 17:45:20 -07:00
Its-my-right
cc2eb9dcf3 Feature/rainbow eraser for color images (#1034)
* Add rainbow_artifacts_eraser helper

This helper file contains the methods necessary to perform a fourier transform on the picture, to remove frequencies responsible for rainbow artifacts on Kaleido screens, and performe the reverse fourier transform

* Replace blurring method with frequency removal method to erase rainbow effect on Kaleido 3 screens

* High performance improvements by using rfft2 instead of fft2

* Fine-tuned the settings and added the perpendicular direction for a better final rendering

The finer settings allow for more information to be retained in the final image, while still effectively removing the rainbow effect.

Adding the perpendicular direction results in a better rendering of the final image (avoiding visual artifacts related to suppression at the main angle).

* Revert the addition of perpendicular angles and lower attenuation_factor

It was a mistake to add the perpendicular angles in the previous commit: I had the rainbow effect removal process called 2 times when I did this, for testing purposes (One before downscale and one after downscale).

The proper way to call the process is only after the downscale. And in this case it is not necessary to remove frequencies along the perpendicular angles.

In the mean time, attenuation_factor=0.15 has proven to work well along a collection of testing images.

It should be my latest commit for this feature

* Also attenuate high frequencies at 45°

CFA is sometimes orientated at 135°, sometimes at 45° so until we find if there is a law depending on the screen size, e-reader model or something, the best we can do is attenuate high frequencies on those two directions

* fix imports

* Update comic2ebook.py

Calculate is_color with (opt.forcecolor and img.color)

pass is_color to img.optimizeForDisplay

* Update image.py

Remove color check condition, because now we process colored images too.

Pass is_color to erase_rainbow_artifacts

* Update rainbow_artifacts_eraser.py

Add support for colored images: Convert to YUV, extract luminance channel, do FFT -> Filter -> IFFT on luminance channel, insert back to YUV, convert back to RGB

To maximize compatibility until we know for sure the orientation of CFA for each device, filtering is now done on 135° + 45° axis

After more testing, attenuation_factor is decreased to 0.10

* Update comic2ebook.py

Rename rainbow eraser param

* Update image.py

rename rainbow eraser param

* Update KCC.ui

Rename rainbow eraser checkbox and tooltip

* Update KCC_ui.py

Rename erase rainbow checkbox and tooltip

* Update KCC_gui.py

Rename erase rainbow checkbox and option

* Update README.md

rename erase rainbow param

* Update KCC_gui.py

correct param name for eraserainbow

---------

Co-authored-by: Alex Xu <alexkurosakimh3@gmail.com>
2025-07-18 10:48:56 -07:00
Alex Xu
023797f012 fix imports 2025-07-18 07:38:50 -07:00
Its-my-right
63a18627d3 Also attenuate high frequencies at 45°
CFA is sometimes orientated at 135°, sometimes at 45° so until we find if there is a law depending on the screen size, e-reader model or something, the best we can do is attenuate high frequencies on those two directions
2025-07-18 07:38:50 -07:00
Its-my-right
0d967084a0 Revert the addition of perpendicular angles and lower attenuation_factor
It was a mistake to add the perpendicular angles in the previous commit: I had the rainbow effect removal process called 2 times when I did this, for testing purposes (One before downscale and one after downscale).

The proper way to call the process is only after the downscale. And in this case it is not necessary to remove frequencies along the perpendicular angles.

In the mean time, attenuation_factor=0.15 has proven to work well along a collection of testing images.

It should be my latest commit for this feature
2025-07-18 07:38:50 -07:00
Its-my-right
2da5b11858 Fine-tuned the settings and added the perpendicular direction for a better final rendering
The finer settings allow for more information to be retained in the final image, while still effectively removing the rainbow effect.

Adding the perpendicular direction results in a better rendering of the final image (avoiding visual artifacts related to suppression at the main angle).
2025-07-18 07:38:50 -07:00
Its-my-right
f6d10337d8 High performance improvements by using rfft2 instead of fft2 2025-07-18 07:38:50 -07:00
Its-my-right
cf047ecf6f Replace blurring method with frequency removal method to erase rainbow effect on Kaleido 3 screens 2025-07-18 07:38:50 -07:00
Its-my-right
e7ee8bed9d Add rainbow_artifacts_eraser helper
This helper file contains the methods necessary to perform a fourier transform on the picture, to remove frequencies responsible for rainbow artifacts on Kaleido screens, and performe the reverse fourier transform
2025-07-18 07:38:50 -07:00
Alex Xu
9c8a1759cf update level comment 2025-07-13 22:29:11 -07:00
Alex Xu
6299754964 draft: add black point level (#1028)
* initial black point

* convert to L

* add GUI
2025-07-13 21:52:17 -07:00
Alex Xu
a3db86a29b convert to grayscale as last step 2025-07-13 15:23:54 -07:00
Alex Xu
67714a9b06 fix color autocontrast (#1026) 2025-07-11 16:28:19 -07:00
Alex Xu
95f9a3cda9 put dot_clean in sanitize 2025-07-10 23:07:15 -07:00
Alex Xu
0e12fc30c6 restore lenient ComicInfo.xml handling (#1024) 2025-07-10 13:57:29 -07:00
Alex Xu
90c9ba7539 bump 8.0.4 2025-07-10 09:19:57 -07:00
Alex Xu
84da718167 more extraction fixes (#1023) 2025-07-10 09:14:06 -07:00
Alex Xu
a79c740387 don't autocontrast color content (#1021) 2025-07-09 13:59:54 -07:00
Alex Xu
bc98eecae9 bump 8.0.3 2025-07-09 11:28:25 -07:00
Alex Xu
e7a07377ef add avif input support (#1019)
* add avif input support

* add avif
2025-07-09 11:27:58 -07:00
Alex Xu
07ef11013a fix cbz metadata (#1018) 2025-07-09 11:14:25 -07:00
Alex Xu
551fe6edbf bump 8.0.2 2025-07-05 07:41:08 -07:00
Alex Xu
dbf8a3ddbd fix ._cover.jpg on macos 15 (#1016) 2025-07-05 07:40:09 -07:00
Alex Xu
8f9e230b62 rotate first (#1015) 2025-07-04 19:52:34 -07:00
Alex Xu
3e88dabd1a bump 8.0.1 2025-07-03 12:43:54 -07:00
Alex Xu
3b7d949128 only slugify cbz subfolders if sort matters (#1010)
* only slugify if sort matters

* add comments

* make conditions more granular

* fix

* shorten
2025-07-03 12:39:13 -07:00
Alex Xu
68186285bd only use 7zz on macos (#1012) 2025-07-03 12:36:12 -07:00
Alex Xu
69d3bf3278 simplify removeNonImages (#1009) 2025-07-02 17:28:03 -07:00
Alex Xu
793992f408 bump to 8.0.0 2025-07-02 10:18:30 -07:00
Alex Xu
f41d5327e0 remove non images early (#1007) 2025-07-02 10:17:54 -07:00
Alex Xu
17c0a73f9f upgrade 7z to 7zz (#1005) 2025-07-01 08:12:01 -07:00
Adrian
1fa5a5b19b Improved color detection (#1003)
* Improved color detection

* use pure python

---------

Co-authored-by: Alex Xu <alexkurosakimh3@gmail.com>
2025-06-30 17:18:04 -07:00
Alex Xu
74187b0d77 bump to 7.6.0 2025-06-29 09:37:59 -07:00
Alex Xu
6299c45790 fix flatpak kindlegen detection (7.5.0 regression) (#1000)
* fix flatpak kindlegen detection

* fix shared
2025-06-29 09:28:47 -07:00
Alex Xu
c7ebb230c2 add L comment 2025-06-27 11:45:31 -07:00
Alex Xu
3e4b729a30 always convert to L
even if workImg.color = False, it could still have color pixels, which can cause problems with quantization
2025-06-27 07:19:22 -07:00
Adrian
16a1d9b45f Fix quantization for colored images (#991) 2025-06-26 07:36:22 -07:00
Alex Xu
b7aef324aa Prevent selecting Kindle as output directory (#990)
* merge conflicts

* fix

* call it is

* fix imports
2025-06-25 18:16:42 -07:00
Alex Xu
1a42730ea0 next-folder (#988) 2025-06-25 14:55:17 -07:00
Adrian
217a18b7b5 Save images in GIF when output is set to MOBI and forcepng is used (#981)
* Save images in GIF when output is set to MOBI and forcepng option is used

* Save images in GIF when output is set to EPUB, kindle profile is used and forcepng option is set

* media-type="image/gif"

---------

Co-authored-by: Alex Xu <alexkurosakimh3@gmail.com>
2025-06-24 22:14:00 -07:00
Silver0006
2ecbf7d2e9 Replaced add folders with output directory button. (#977)
* Replaced Add Folders with output directory button.

I took the code from #969 and replaced the selectDir() function with it. Then replaced the button and linked it to selectDir()

* Fixed merge error in gui

* Fixed bug

Missing () at the end of checkState on line 852

* small fixes

* fix checkbox not saving

* rename selectDir to selectOutputDirectory

---------

Co-authored-by: Alex Xu <alexkurosakimh3@gmail.com>
2025-06-24 18:58:24 -07:00
Alex Xu
32020d6b07 display-block (#986) 2025-06-20 17:28:42 -07:00
Adrian
221f964f14 Improve code readability (#984) 2025-06-20 10:12:24 -07:00
Adrian
e9f0310b94 Fixes to grayscale pages in forcecolor mode (#978)
* Fix bit depth of non-color pages in forcecolor mode

* Optimization for JPEG non-color pages in forcecolor mode
2025-06-18 15:12:12 -07:00
Adrian
2fa90c9f59 Fix png bit depth (#976) 2025-06-18 15:11:59 -07:00
Alex Xu
cb0520dcab bump 7.5.1 2025-06-17 11:34:25 -07:00