nt25 0.1.8__py3-none-any.whl → 0.1.9__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
nt25/lib/et.py CHANGED
@@ -40,10 +40,15 @@ def optimizeFile(file, q=80, mw=MAX_WIDTH):
40
40
 
41
41
  img = pi.open(file)
42
42
  w, h = img.size
43
- scale = mw / max(w, h)
44
- w = int(scale * w)
45
- h = int(scale * h)
46
- img.resize((w, h)).save(ofile, quality=q, optimize=True, progression=True)
43
+ m = max(w, h)
44
+
45
+ if m > mw:
46
+ scale = mw / m
47
+ w = int(scale * w)
48
+ h = int(scale * h)
49
+ img = img.resize((w, h))
50
+
51
+ img.save(ofile, quality=q, optimize=True, progression=True)
47
52
 
48
53
  if os.path.getsize(ofile) < os.path.getsize(file) * 0.8:
49
54
  less = True
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nt25
3
- Version: 0.1.8
3
+ Version: 0.1.9
4
4
  Summary: Neo's Tools of Python
5
5
  Requires-Python: >=3.10
6
6
  Requires-Dist: exif>=1.6.1
@@ -6,9 +6,9 @@ nt25/data/exif.jpg,sha256=Wl9QqZ3UAC_ldd055lJOcZKqvU5swqLEw_HxRBbLYgc,347767
6
6
  nt25/data/test.xlsx,sha256=7C0JDS-TLm_KmjnKtfeajkpwGKSUhcLdr2W2UFUxAgM,10542
7
7
  nt25/lib/calc.py,sha256=3X3k9jisSjRP7OokSdKvoVo4IIOzk2efexW8z1gMo-w,2265
8
8
  nt25/lib/draw.py,sha256=OKTlkkNVUz_LGBA9Gk7fjcnbbbl7e_hT8nWKkcfeg2k,5642
9
- nt25/lib/et.py,sha256=RnS-uLCi1V2Fp0SM5ugLjsE1jlYcHXBFH6n_LPEWKvM,8007
9
+ nt25/lib/et.py,sha256=YqvVb6gQgq_6FfkRa9wszclR7SaBLrxNZWOI0dztgyQ,8050
10
10
  nt25/lib/fio.py,sha256=WvHpG6QYR1NE19Ss3Sy2FdajTxibX5SVW3PyC5Y5Krk,2525
11
- nt25-0.1.8.dist-info/METADATA,sha256=03xIiMnLiIcOsAIdg6fq04dRq1VI_Hj64xBWxzIrEKo,761
12
- nt25-0.1.8.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
13
- nt25-0.1.8.dist-info/entry_points.txt,sha256=ZhLLfJfG3blBRD8mm1sysVXpmySKoTzSxMYkAO-gFNs,100
14
- nt25-0.1.8.dist-info/RECORD,,
11
+ nt25-0.1.9.dist-info/METADATA,sha256=DsfFovCuiARgLwQhOLF66zAERNMg8zns4ngbdX_GAJA,761
12
+ nt25-0.1.9.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
13
+ nt25-0.1.9.dist-info/entry_points.txt,sha256=ZhLLfJfG3blBRD8mm1sysVXpmySKoTzSxMYkAO-gFNs,100
14
+ nt25-0.1.9.dist-info/RECORD,,
File without changes