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

Books in djvu format creates high use of system resources #54

Open
poeplva opened this issue May 9, 2023 · 2 comments
Open

Books in djvu format creates high use of system resources #54

poeplva opened this issue May 9, 2023 · 2 comments

Comments

@poeplva
Copy link

poeplva commented May 9, 2023

I have a book in djvu format, when I come over it in lf the memory and CPU utilizations gets very high. Checking top while doing this shows that the program that causes this is magick. So what happens is, ctpv thinks djvu files are image files (which is correct and what file --mime-type says) and tries to process them for a preview with ImageMagick. But since the file is 945 pages, it is of course a huge amount of work for ImageMagick. So I think we should find another method to produce previews for djvu files as they are a common format for (especially old) books.

@poeplva
Copy link
Author

poeplva commented May 10, 2023

preview dejavu image/vnd.djvu {{
	tmpfilejpeg="/tmp/ctpv-$RANDOM.jpeg"
	trap "rm -f $tmpfilejpeg" 0 2 3 15
	djvused "$f" -e 'select 1; save-page /dev/stdout' | convert -density 300 - "$tmpfilejpeg" > /dev/null 2>&1
	ctpv "$tmpfilejpeg" $w $h $x $y $id
	exit 1
}}

Here is a way to do this via changing the config, but it seems to be a little bit slower than previews for pdfs. Yet, I still think this should be the default way in the program.

@siyia2
Copy link

siyia2 commented Apr 16, 2024

thx!
i added this:

preview dejavu image/vnd.djvu {{
	tmpfilejpeg="/tmp/ctpv-$RANDOM.jpeg"
	trap "rm -f $tmpfilejpeg" 0 2 3 15
	djvused "$f" -e 'select 1; save-page /dev/stdout' | convert -density 300 - "$tmpfilejpeg" > /dev/null 2>&1
	ctpv "$tmpfilejpeg" $w $h $x $y $id
	exit 1
}}

to ~/.config/ctpv/config and .djvu previews work now!

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