Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Genanki-generated deck is twice as heavy as it should be #118

Open
skunne opened this issue May 17, 2023 · 1 comment
Open

Genanki-generated deck is twice as heavy as it should be #118

skunne opened this issue May 17, 2023 · 1 comment

Comments

@skunne
Copy link

skunne commented May 17, 2023

Description
I created a deck with genanki. The .apkg file weighs 152kB. Then I imported this deck into Anki Desktop, and exported it again. The resulting .apkg file weighs 69kB.

As far as I can tell, the two decks are identical, but the one that went through Anki Desktop is less than half the weight of the one created directly with genanki.

Is there a way to make the deck lighter automatically, using only genanki?

genanki version
0.13.0

Additional context
I reproduced the issue with a few other similar decks, ranging from 120 to 180kB when created with genanki, and ranging from 67kB to 80kB after import/export through Anki Desktop. Those are text-only decks, no media, with about 100 cards per deck, 3 fields per note, 1 card per note.

@wamsachel
Copy link

If you run strings or a hexdump against a genanki made deck vs an app exported deck, you'll find that geanki's data output is clear-text while Anki's is not, and therefore undergoes some sort of encoding/compression.

I haven't looked into Anki's source code too much, but I see calls to zstd and Zip

Indeed when I re-export my genanki deck using mobile app (linux desktop anki app locks up when exporting...), it is about 83% smaller. When I run gzip, zstd, or zip on my geanki deck it is compressed by 89%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants