gotson / komga

Media server for comics/mangas/BDs/magazines/eBooks with API and OPDS support
https://komga.org
MIT License
3.79k stars 223 forks source link

An option to generate larger thumbnails #861

Closed TheHardew closed 10 months ago

TheHardew commented 2 years ago

Describe your suggested feature

The thumbnails generated currently by komga are quite small, about 300 px in height. Because of this, e.g. in Tachiyomi they appear quite blurry. You could add a configuration option to change the width/scale of the generated thumbnails.

Other details

No response

Acknowledgements

TheHardew commented 2 years ago

While we're at it, implementing a configuration option for the thumbnail format could be a good idea too, possibly? Maybe someone would want to use webp or when jpeg xl becomes more mainstream in the future, people would be able to switch without waiting for the commit and then release.

zachstultz commented 2 years ago

Agreed, some kind of user configurable option that results in a higher quality thumbnail would be preferable.

nautipuss commented 2 years ago

It would be great to see this added to the configuration options, at the moment I'm using Panels on my iPad with OPDS streaming and the thumbnails are resolution, with visible artifacts. Some scale and quality options would be very useful.

tergo commented 2 years ago

Agreed, the current thumbnails are awful

VidalJosh commented 1 year ago

Would definitely be a big fan of this one. It always bugs me how much nicer the locally uploaded thumbnails look compared to the generated ones. I wouldn't even mind if we had to dig a little to get higher resolution ones or anything like that, if it was easier that way.

TheHardew commented 1 year ago
diff --git a/komga/src/main/kotlin/org/gotson/komga/domain/service/BookAnalyzer.kt b/komga/src/main/kotlin/org/gotson/komga/domain/service/BookAnalyzer.kt
index 18b05766..89df61a4 100644
--- a/komga/src/main/kotlin/org/gotson/komga/domain/service/BookAnalyzer.kt
+++ b/komga/src/main/kotlin/org/gotson/komga/domain/service/BookAnalyzer.kt
@@ -35,7 +35,7 @@ class BookAnalyzer(
     .flatMap { e -> e.mediaTypes().map { it to e } }
     .toMap()

-  private val thumbnailSize = 300
+  private val thumbnailSize = 1200
   private val thumbnailFormat = "jpeg"

   fun analyze(book: Book, analyzeDimensions: Boolean): Media {
diff --git a/komga/src/main/kotlin/org/gotson/komga/infrastructure/image/MosaicGenerator.kt b/komga/src/main/kotlin/org/gotson/komga/infrastructure/image/MosaicGenerator.kt
index 18272f29..a1b980be 100644
--- a/komga/src/main/kotlin/org/gotson/komga/infrastructure/image/MosaicGenerator.kt
+++ b/komga/src/main/kotlin/org/gotson/komga/infrastructure/image/MosaicGenerator.kt
@@ -13,7 +13,7 @@ class MosaicGenerator {
     val thumbs = images.map { resize(it, 150) }

     return ByteArrayOutputStream().use { baos ->
-      val mosaic = BufferedImage(212, 300, BufferedImage.TYPE_INT_RGB)
+      val mosaic = BufferedImage(848, 1200, BufferedImage.TYPE_INT_RGB)
       mosaic.createGraphics().apply {
         listOf(
           0 to 0,

In case anyone want's this and can build themselves. I did not bother making it configurable, since I'm not going to change it anyway.

VidalJosh commented 1 year ago
diff --git a/komga/src/main/kotlin/org/gotson/komga/domain/service/BookAnalyzer.kt b/komga/src/main/kotlin/org/gotson/komga/domain/service/BookAnalyzer.kt
index 18b05766..89df61a4 100644
--- a/komga/src/main/kotlin/org/gotson/komga/domain/service/BookAnalyzer.kt
+++ b/komga/src/main/kotlin/org/gotson/komga/domain/service/BookAnalyzer.kt
@@ -35,7 +35,7 @@ class BookAnalyzer(
     .flatMap { e -> e.mediaTypes().map { it to e } }
     .toMap()

-  private val thumbnailSize = 300
+  private val thumbnailSize = 1200
   private val thumbnailFormat = "jpeg"

   fun analyze(book: Book, analyzeDimensions: Boolean): Media {
diff --git a/komga/src/main/kotlin/org/gotson/komga/infrastructure/image/MosaicGenerator.kt b/komga/src/main/kotlin/org/gotson/komga/infrastructure/image/MosaicGenerator.kt
index 18272f29..a1b980be 100644
--- a/komga/src/main/kotlin/org/gotson/komga/infrastructure/image/MosaicGenerator.kt
+++ b/komga/src/main/kotlin/org/gotson/komga/infrastructure/image/MosaicGenerator.kt
@@ -13,7 +13,7 @@ class MosaicGenerator {
     val thumbs = images.map { resize(it, 150) }

     return ByteArrayOutputStream().use { baos ->
-      val mosaic = BufferedImage(212, 300, BufferedImage.TYPE_INT_RGB)
+      val mosaic = BufferedImage(848, 1200, BufferedImage.TYPE_INT_RGB)
       mosaic.createGraphics().apply {
         listOf(
           0 to 0,

In case anyone want's this and can build themselves. I did not bother making it configurable, since I'm not going to change it anyway.

I know being asked about this is possibly the last thing you wanted, but if it's not too much of a bother, would this be something I could implement if I was running Komga via a docker container? And what is the new size you have set it to? Did I read it correctly that it was 1200, so 4x? Also I'm sorry but lastly, after you did implement this did it just generate the new thumbnails on the next scan?

Thank you in advance!!

TheHardew commented 1 year ago

@Joshakazam I don't know much about docker, but I believe you would have to find out how the docker containers are generated and modify it to include this patch or if that is not publicly available, write a script to generate such a container yourself. With each update you want to install you would need to recreate the container.

I did indeed set it to 1200 px (in height if I recall correctly), so 400%.

New thumbnails will be generated with this size. For the old ones you need to force komga to regenerate them, I believe by using the "Analyze" option on a library or a series or a book.

If you don't add any books, you can run an unpatched version later and the generated thumbnails should stay.

rosystain commented 1 year ago

+1, current thumb is not large enough for some 3rd party client like Panels especially.

lionhoho commented 1 year ago

+1, it would be also great if there is an option to set the rows, columns and maximum numbers of the thumbnails, let's say 4x2, 6x3 or 8x4

Jamerrone commented 11 months ago

Please! Komga's thumbnails look horrible. It's fine on small resolution pc's but nothing else. Especially on phones and 4k screens, it looks horrible.

realFPS commented 11 months ago

Screenshot_2023-09-23-12-55-01-91.jpg

This screenshot shows series using local artwork. Browsing through your library with higher quality thumbnails makes it look so much better.About the size issue and all this could be configurable like other options. Please consider this.

Jamerrone commented 11 months ago

Better example to show the difference: image

The last 2 are from komga.

github-actions[bot] commented 10 months ago

🎉 This issue has been resolved in v1.6.0 (Release Notes)