Skip to content

Conversation

subha0319
Copy link

@subha0319 subha0319 commented Aug 24, 2025

Summary

Closes #1051

This PR adds thumbnail generation for .cbr and .cbz files. The new logic reads the archive and uses the first internal image as the cover preview, fixing the bug where thumbnails were incorrect or missing.

This change adds the rarfile dependency to pyproject.toml for .cbr support.

Tasks Completed

  • Implemented a new rendering path for comic book archives in thumb_renderer.py.

  • Added the rarfile dependency to support .cbr files.

  • Platforms Tested:

    • Windows x86
    • Windows ARM
    • macOS x86
    • macOS ARM
    • Linux x86
    • Linux ARM
    • Tested For:
    • Basic functionality (Verified that .cbr and .cbz thumbnails now render correctly)
    • PyInstaller executable

@subha0319 subha0319 marked this pull request as ready for review August 24, 2025 11:45
@CyanVoxel CyanVoxel added Type: Enhancement New feature or request Type: UI/UX User interface and/or user experience labels Aug 24, 2025
@CyanVoxel CyanVoxel moved this to 🏓 Ready for Review in TagStudio Development Aug 24, 2025
@CyanVoxel CyanVoxel added the Status: Review Needed A review of this is needed label Aug 24, 2025
@kitsumed
Copy link
Contributor

Just wanna let all of you know that for cbz files in the comic/manga spaces it's common to find at the root of the archive a ComicInfo.xml file. That file give a bunch of informations, including the prefered picture to be used as a cover (type FrontCover or InnerCover under the Pages group). I'm not sure if cbr files also use it, but at the end of the day both are zip files under the hood so there is not additional challenge if you where to support it.

https://github.com/anansi-project/comicinfo
https://www.reddit.com/r/comicrackusers/comments/ywvnoc/comment/iwsau3p/

Copy link
Member

@CyanVoxel CyanVoxel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for submitting this, but I'm noticing a lot of fundamental issues with this one that suggests to me that it was not tested or that the new code was unknowingly overshadowed by the existing functionality inside the eBook rendering step (which includes .cbz but not .cbr).

If this PR was made in good faith, I recommend taking a look at the CONTRIBUTING.md page and making sure that this code is in a functional state. I've made a few surface level comments on some of the code, and I see you've already fixed the broken import.

Comment on lines +1640 to +1642
# Comic Book Archives =========================================
elif ext in {".cbr", ".cbz"}:
image = self._render_comic_archive(str(_filepath), QSize(*base_size))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because this check is being made after the EBOOK_TYPES check which already includes these files, this code is not being ran.

if not pixmap.loadFromData(image_data):
return None

return self.scale_pixmap(pixmap, size)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the incorrect return type. The ThumbRenderer expects a PIL type Image object, not a QPixmap. Also, this method does not exist.

@CyanVoxel CyanVoxel removed the Status: Review Needed A review of this is needed label Aug 24, 2025
@CyanVoxel CyanVoxel moved this from 🏓 Ready for Review to 🚧 In progress in TagStudio Development Aug 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Enhancement New feature or request Type: UI/UX User interface and/or user experience
Projects
Status: 🚧 In progress
Development

Successfully merging this pull request may close these issues.

[Bug]: Incorrect images used as cover previews for .cbr and .cbz files
3 participants