Skip to content

Commit fa64474

Browse files
committed
[Diff][Added] Option for the resolution (DPIs)
Closes #832
1 parent 558f52b commit fa64474

5 files changed

Lines changed: 30 additions & 11 deletions

File tree

docs/samples/generic_plot.kibot.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1013,6 +1013,10 @@ outputs:
10131013
# Can be used to fine-tune a variant for a particular output that needs extra filtering done before the
10141014
# variant
10151015
dnf_filter: '_null'
1016+
# [number=150] [72,600] Resolution (Dots Per Inch) for the diff images.
1017+
# Be careful to flush any cached images if you change it.
1018+
# Also be careful with the values, images can become huge
1019+
dpi: 150
10161020
# [string|list(string)='_null'] Name of the filter to exclude components from processing.
10171021
# Is a short-cut to use for simple cases where a variant is an overkill.
10181022
# Can be used to fine-tune a variant for a particular output that needs extra filtering done before the

docs/source/configuration/outputs/DiffOptions.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ DiffOptions parameters
2525
Can be used to fine-tune a variant for a particular output that needs extra filtering done before the
2626
variant.
2727

28+
- ``dpi`` :index:`: <pair: output - diff - options; dpi>` [:ref:`number <number>`] (default: ``150``) (range: 72 to 600) Resolution (Dots Per Inch) for the diff images.
29+
Be careful to flush any cached images if you change it. |br|
30+
Also be careful with the values, images can become huge.
2831
- ``exclude_filter`` :index:`: <pair: output - diff - options; exclude_filter>` [:ref:`string <string>` | :ref:`list(string) <list(string)>`] (default: ``'_null'``) Name of the filter to exclude components from processing.
2932
Is a short-cut to use for simple cases where a variant is an overkill. |br|
3033
Can be used to fine-tune a variant for a particular output that needs extra filtering done before the

kibot/out_diff.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ def __init__(self):
8383
""" [0,1000000] Error threshold for the `stats` mode, 0 is no error. When specified a
8484
difference bigger than the indicated value will make the diff fail.
8585
KiBot will return error level 29 and the diff generation will be aborted """
86+
self.dpi = 150
87+
""" [72,600] Resolution (Dots Per Inch) for the diff images.
88+
Be careful to flush any cached images if you change it.
89+
Also be careful with the values, images can become huge """
8690
self.add_link_id = False
8791
""" When enabled we create a symlink to the output file with a name that contains the
8892
git hashes involved in the comparison. If you plan to compress the output don't
@@ -464,7 +468,8 @@ def do_compare(self, old, old_type, new, new_type, name, name_ori):
464468
cmd = [self.command, '--no_reader', '--new_file_hash', new_hash, '--old_file_hash', old_hash,
465469
'--cache_dir', self.cache_dir, '--output_dir', dir_name, '--output_name', file_name,
466470
'--diff_mode', self.diff_mode, '--fuzz', str(self.fuzz), '--no_exist_check',
467-
'--added_2color', self.color_added, '--removed_2color', self.color_removed]
471+
'--added_2color', self.color_added, '--removed_2color', self.color_removed,
472+
'--resolution', str(self.dpi)]
468473
self.add_zones_ops(cmd)
469474
if self.incl_file:
470475
cmd.extend(['--layers', self.incl_file])

tests/GUI/outputs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2338,6 +2338,13 @@
23382338
],
23392339
null
23402340
],
2341+
[
2342+
"dpi",
2343+
[
2344+
"DataTypeNumber"
2345+
],
2346+
null
2347+
],
23412348
[
23422349
"add_link_id",
23432350
[

tests/GUI/stats

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
53 outputs types with a total of 2126 different parameters
2-
Single type parameters: 1940 (91 %)
1+
53 outputs types with a total of 2127 different parameters
2+
Single type parameters: 1941 (91 %)
33
Multi type parameters: 186 (9 %)
44
Average parameters: 40
55
Maximum number of parameters: 217
@@ -64,7 +64,7 @@ Outputs sorted by parameters:
6464
- gerb_drill: 34
6565
- pcb2blender_tools: 34
6666
- kicost: 37
67-
- diff: 40
67+
- diff: 41
6868
- export_3d: 41
6969
- excellon: 42
7070
- dxf: 43
@@ -149,7 +149,7 @@ Outputs sorted by depth:
149149
14 different data types
150150
- String: 923
151151
- Boolean: 536
152-
- Number: 289
152+
- Number: 290
153153
- ListStringSingular: 288
154154
- Choice: 110
155155
- Dict: 88
@@ -166,7 +166,7 @@ Used as single data type:
166166
- String: 759
167167
- Boolean: 471
168168
- ListStringSingular: 285
169-
- Number: 195
169+
- Number: 196
170170
- Choice: 107
171171
- Dict: 75
172172
- ListDict: 20
@@ -403,8 +403,8 @@ Used as single data type:
403403
- Number,String: 15
404404
================================================================================
405405
================================================================================
406-
92 totals types with a total of 2501 different parameters
407-
Single type parameters: 2291 (92 %)
406+
92 totals types with a total of 2502 different parameters
407+
Single type parameters: 2292 (92 %)
408408
Multi type parameters: 210 (8 %)
409409
Average parameters: 27
410410
Maximum number of parameters: 217
@@ -508,7 +508,7 @@ Totals sorted by parameters:
508508
- pcb2blender_tools: 34
509509
- generic: 34
510510
- kicost: 37
511-
- diff: 40
511+
- diff: 41
512512
- export_3d: 41
513513
- excellon: 42
514514
- dxf: 43
@@ -632,7 +632,7 @@ Totals sorted by depth:
632632
14 different data types
633633
- String: 1076
634634
- Boolean: 636
635-
- Number: 339
635+
- Number: 340
636636
- ListStringSingular: 317
637637
- Choice: 142
638638
- Dict: 99
@@ -649,7 +649,7 @@ Used as single data type:
649649
- String: 896
650650
- Boolean: 563
651651
- ListStringSingular: 314
652-
- Number: 230
652+
- Number: 231
653653
- Choice: 139
654654
- Dict: 78
655655
- ListDict: 30

0 commit comments

Comments
 (0)