Skip to content
This repository was archived by the owner on Mar 10, 2023. It is now read-only.

Commit 30c77b7

Browse files
committed
Fix CPU cores autodetection
1 parent e681925 commit 30c77b7

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

README.md

+7
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,13 @@ You will need [cjxl](https://gitlab.com/wg1/jpeg-xl/-/blob/master/doc/developing
3939

4040
Remember, you need double slashes in Windows.
4141

42+
## Alternatives
43+
44+
```sh
45+
apt install imagemagick parallel
46+
find /path/to/images -type f -iregex '.*\(gif\|jpe?g\|png\)$' | parallel convert {} {.}.jxl
47+
```
48+
4249
## See also
4350
* [makejxl](https://github.com/varnav/makejxl/)
4451
* [filmcompress](https://github.com/varnav/filmcompress/)

makejxl.py

+10-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
import click
1212

13-
__version__ = '0.1.4'
13+
__version__ = '0.1.5'
1414
SUPPORTED_FORMATS = ['jpeg', 'jpg', 'png', 'apng', 'gif', 'exr', 'ppm', 'pfm', 'pgx']
1515

1616

@@ -43,7 +43,15 @@ def main(directory, recursive=False, speed='kitten'):
4343
print('cjxl not found')
4444
exit(1)
4545

46-
jobs = len(os.sched_getaffinity(0)) - 1
46+
jobs = 1
47+
try:
48+
jobs = len(os.sched_getaffinity(0)) - 1
49+
except Exception:
50+
pass
51+
try:
52+
jobs = int(os.environ['NUMBER_OF_PROCESSORS']) - 1
53+
except Exception:
54+
pass
4755

4856
total = 0
4957
num = 0

0 commit comments

Comments
 (0)