-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
2750 lines (2338 loc) · 128 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" lang="en">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/png" href="assets/favicon.png">
<link rel="apple-touch-icon" href="assets/favicon.png">
<title>Crop Circles</title>
<link rel="stylesheet" href="assets/iosevka-aile/3.4.6/iosevka-aile.css">
<style>
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
:root {
--font-size: 14px;
--font-stack: "Iosevka Aile Web", "Iosevka Aile", Iosevka, PragmataPro, monospace;
--sidebar-width: 18rem;
--sidebar-background-color: #222;
--users-guide-background-color: #111;
--status-background-color: #333;
--error-background-color: #400;
--precision-helper-background-color: #000;
--main-background-color: #131313;
--text-color: #eee;
--link-color: #bbb;
--hover-color: #999;
--kbd-background-color: #444;
--rule-color: #666;
--input-background-color: #333;
--input-border-color: #555;
--input-hover-background-color: #555;
--input-hover-border-color: #888;
--input-focused-background-color: #888;
--input-placeholder-color: #777;
--input-current-value-color: #aaa;
--danger-color: orangered;
--dropper-background-color: #555;
--dropper-color: #aaa;
--another-image-dropper-background-color: #333;
--another-image-dropper-color: #aaa;
--current-selection-stroke: #fff;
--selections-stroke: rgba(255,255,255,0.5);
--selections-fill: rgba(255,255,255,0.2);
--highlighted-selection-stroke: rgba(255,255,255,0.8);
--highlighted-selection-fill: rgba(255,255,255,0.4);
--selections-table-geodata-color: #aaa;
--precision-helper-dividers-stroke: #555;
}
html {
font-size: var(--font-size);
font-family: var(--font-stack);
letter-spacing: -0.02em;
}
body {
color: var(--text-color);
}
p {
margin: 1em 0;
}
a {
color: var(--link-color);
text-decoration: underline;
}
a:hover {
color: var(--hover-color);
}
hr {
border: none;
border-top: 1px solid var(--rule-color);
margin: 1rem 0;
}
kbd {
font: inherit;
background-color: var(--kbd-background-color);
padding: 0 0.2rem;
border-radius: 0.2rem;
}
/* SIDEBAR */
.sidebar {
width: var(--sidebar-width);
background-color: var(--sidebar-background-color);
padding: 1em;
position: fixed;
right: 0;
height: calc(100% - var(--sidebar-width));
overflow-y: scroll;
}
h1 {
font-size: 4em;
font-weight: 200;
line-height: 0.85em;
letter-spacing: -0.1em;
text-transform: uppercase;
margin: -0.07em 0 0 -0.07em;
text-align: right;
}
h1 svg {
height: 0.75em;
margin: 0 -0.05em 0 0.05em;
transition: transform 2s ease-out;
}
h1 svg:hover {
transition: transform 20s ease-in-out;
transform: rotate(3600deg);
}
span {
font-size: 0.85em;
display: block;
}
button, label, input[type="text"] {
font: inherit;
color: inherit;
background-color: var(--input-background-color);
border: 1px solid var(--input-border-color);
text-align: left;
margin: 1em 0 0.3em 0;
padding: 0.5em 0.7em;
display: block;
width: 100%;
text-transform: uppercase;
border-radius: 0.2rem;
}
button:hover, label:hover, input[type="text"]:hover {
background-color: var(--input-hover-background-color);
border-color: var(--input-hover-border-color);
}
button {
cursor: pointer;
}
button b {
float: right;
height: 0;
margin-top: -0.3em;
}
input[type="checkbox"] {
height: 1.25em;
margin-right: 0.3em;
vertical-align: text-bottom; /* hack to make it look vertically centered in chrome but doesn't in firefox... hmm */
}
input[type="range"] {
width: 100%;
margin: 0;
margin-bottom: 0.3em;
}
input[type="text"] {
text-transform: none;
}
input[type="text"]::placeholder {
color: var(--input-placeholder-color);
}
input[type="text"]:focus,
button:active {
border-color: var(--input-focused-background-color);
background-color: var(--input-focused-background-color);
outline: none;
}
label b {
float: right;
font-weight: normal;
text-transform: initial;
color: var(--input-current-value-color);
}
.disabled {
opacity: 0.5;
pointer-events: none;
}
.backup-restore {
display: flex;
}
.backup-restore button {
margin: 0;
padding-right: 0;
}
.backup-restore button:first-child {
display: inline-block;
width: 13em;
}
.backup-restore button:last-child {
display: inline-block;
width: 100%;
margin-left: 0.5em;
}
.reset {
text-transform: uppercase;
font-size: 0.67em;
letter-spacing: 0.1em;
}
.reset a {
text-decoration: none;
}
.reset a:hover {
background-color: var(--danger-color);
color: var(--text-color);
}
.ceci-nest-pas-une-parametre,
.ceci-nest-pas-une-parametre:hover {
background-color: transparent;
}
/* ANOTHER IMAGE DROPPER */
.another-image-dropper {
margin: 1rem 0;
border: 0.15rem dashed var(--another-image-dropper-color);
border-radius: 0.7em;
color: var(--another-image-dropper-color);
background-color: var(--another-image-dropper-background-color);
font-size: 1.4em;
padding: 1rem;
text-align: center;
font-weight: 500;
letter-spacing: -0.05em;
cursor: pointer;
}
.another-image-dropper.active {
background-color: inherit;
filter: invert(1);
}
.another-image-dropper.hidden {
display: none;
}
/* SELECTIONS TABLE */
.selections-table-container.hidden {
display: none;
}
.selections-table {
width: calc(100% + 2em);
margin-left: -1em;
border-spacing: 0;
}
.selections-table thead {
text-transform: uppercase;
font-size: 0.9em;
font-weight: 900;
}
.selections-table tr:hover,
.selections-table tr.hover {
background-color: var(--input-background-color);
}
.selections-table tfoot span {
font-style: italic;
}
.selections-table td {
padding: 0.25rem;
}
.selections-table td:first-child {
padding-left: 1rem;
}
.selections-table td:last-child {
text-align: right;
padding-right: 1rem;
}
.selections-table #no-selections {
display: none;
}
.selections-table #no-selections td {
color: var(--selections-table-geodata-color);
text-align: left;
}
.selections-table u {
font-size: 0.8em;
font-style: italic;
text-decoration: none;
letter-spacing: -0.1em;
}
.selections-table span {
color: var(--selections-table-geodata-color);
letter-spacing: -0.1em;
}
.selections-table button {
width: auto;
margin: 0 0 0 -0.2em;
display: inline-block;
width: 1.5em;
height: 1.5em;
padding: 0.05em 0.3em;
text-align: center;
border-radius: 99em;
}
.selections-table .delete:hover {
color: var(--danger-color);
}
.download-all {
display: flex;
margin: 1em 0 0.3em 0;
}
.download-all button {
margin: 0;
}
.download-all button:first-child {
display: inline-block;
width: 29em;
}
.download-all button:last-child {
display: inline-block;
width: 100%;
margin-left: 0.5em;
}
/* USER'S GUIDE */
.users-guide {
position: fixed;
top: 0;
left: 0;
height: 90vh;
overflow: scroll;
width: 40em;
margin: 5vh 0 0 5vh;
padding: 1em 4em 2em 2em;
z-index: 10;
background-color: var(--users-guide-background-color);
box-shadow: 0.5em 0.5em 4em var(--users-guide-background-color);
border-radius: 0.2rem;
display: none;
}
.users-guide .hide {
display: block;
text-decoration: none;
font-size: 3em;
position: fixed;
margin: -1rem 0 0 35rem;
font-weight: 200;
}
.users-guide p.hero {
font-size: 1.25em;
margin: 0.5em 0;
}
.users-guide img,
.users-guide video {
max-width: 100%;
}
.users-guide .separator {
margin-top: 1.5em;
text-align: center;
}
.users-guide .separator img {
width: 2.5em;
margin: 0 0.2em;
}
h2 {
font-weight: bold;
text-transform: uppercase;
font-size: 1.25em;
margin-top: 1.25em;
}
h3 {
font-weight: bold;
font-style: italic;
text-transform: uppercase;
font-size: 1em;
margin-top: 1em;
}
.users-guide .separator + h2,
.users-guide .separator + h3 {
margin-top: 1rem;
}
.users-guide table {
border-spacing: 0;
}
.users-guide tr:first-child td {
padding-top: 0;
}
.users-guide tr:last-child td {
padding-bottom: 0;
}
.users-guide td {
vertical-align: top;
padding: 0.5em;
}
.users-guide table td:first-child {
padding-left: 0;
border-right: 1px solid var(--rule-color);
}
.users-guide table td:last-child {
padding-right: 0;
}
.users-guide ol {
margin-left: 1.82em;
}
.users-guide ol > li {
margin: 1em 0;
}
.users-guide ul {
margin: 0;
list-style-type: none;
padding-left: 1.9em;
}
.users-guide ul > li {
text-indent: -1.82em;
margin: 1em 0;
}
.users-guide ul > li:before {
content: "—\a0\a0";
text-indent: -2em;
}
/* PRECISION HELPER */
.precision-helper {
position: fixed;
width: var(--sidebar-width);
height: var(--sidebar-width);
bottom: 0;
right: 0;
background-color: var(--precision-helper-background-color);
/*box-shadow: 0 0 1em var(--precision-helper-background-color);*/
}
.precision-helper canvas {
width: 100%;
height: 100%;
}
/* STATUS */
.status {
position: fixed;
left: 0;
bottom: 0;
background-color: var(--status-background-color);
padding: 0.5em;
pointer-events: none;
z-index: 10;
opacity: 1;
border-radius: 0 0.2rem 0 0;
}
.status.hidden {
opacity: 0;
transition: opacity 0.5s ease-out;
}
/* ERRORS */
.error {
position: fixed;
bottom: 0;
left: 0;
width: 100%;
padding: 2em 5em 2em 2em;
background-color: var(--error-background-color);
z-index: 10;
}
.error-message {
margin: 0;
}
.error .dismiss {
display: block;
text-decoration: none;
font-size: 3em;
position: fixed;
right: 2rem;
margin-top: -1.4rem;
font-weight: 200;
}
.error.hidden {
display: none;
}
/* MAIN CROPPING VIEW */
main {
width: calc(100vw - var(--sidebar-width));
height: 100vh;
background-color: var(--main-background-color);
}
#dropped-image, #cropped-image {
display: none;
}
#base-image {
position: absolute;
}
#work {
position: absolute;
display: block;
height: 100vh;
width: calc(100vw - var(--sidebar-width));
cursor: crosshair;
}
/* MAIN DROPPER */
.dropper {
padding: 1px; /* fix for margin weirdness */
background-color: var(--dropper-background-color);
height: 100%;
width: calc(100vw - var(--sidebar-width));
position: absolute;
}
.dropper-label {
border: 0.35rem dashed var(--dropper-color);
border-radius: 0.8em;
color: var(--dropper-color);
font-size: 3em;
width: 50%;
min-width: 13em;
margin: auto;
margin-top: 25vh;
padding: 4rem 2rem;
text-align: center;
font-weight: 500;
letter-spacing: -0.05em;
}
.dropper.active .dropper-label {
background-color: inherit;
filter: invert(1);
}
.drop-or-select {
display: block;
font-style: normal;
cursor: pointer;
}
.load-sample {
display: block;
font-size: 2rem;
margin-top: 1em;
cursor: pointer;
}
/* GITHUB CORNER */
@keyframes octocat-wave {
0%, 100% {
transform:rotate(0);
}
20%, 60% {
transform:rotate(-25deg);
}
40%, 80% {
transform:rotate(10deg);
}
}
.github-corner:hover .octo-arm {
animation:octocat-wave 560ms ease-in-out;
}
.github-corner svg {
--github-corner-size: 4rem;
fill: var(--link-color);
color: var(--sidebar-background-color);
position: fixed;
top: 0;
transform: rotate(-90deg);
right: calc(var(--sidebar-width) - var(--github-corner-size));
width: var(--github-corner-size);
height: var(--github-corner-size);
}
.github-corner svg:hover {
fill: var(--hover-color) !important;
}
</style>
</head>
<body>
<aside class="sidebar">
<a href="https://github.com/doersino/cropcircles" class="github-corner" aria-label="View source on GitHub">
<svg viewBox="0 0 250 250" aria-hidden="true">
<path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path>
<path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path>
<path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path>
</svg>
</a>
<h1>
Cr<svg viewBox="-105 -105 210 210" style="stroke: currentColor; stroke-dasharray: 21 14; stroke-width: 10; fill: none;">
<image width="209" height="209" transform="translate(-104.5,-104.5)" xlink:href="data:image/gif;base64,R0lGODlhsgCyALMAABhHIyJNKw9IHRZQIhQ/ICpgMkZySlKFXtnl4zhoPAxCGhpdKDZYOCJWK3SWf////yH/C1hNUCBEYXRhWE1QPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS4zLWMwMTEgNjYuMTQ1NjYxLCAyMDEyLzAyLzA2LTE0OjU2OjI3ICAgICAgICA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CDZOWLLNNXdsqwM/qq9KaIs0tt8pIfRUGxdbE3QLBq77q3NqgzcudDZM1zTytHd1U8NkDcCjgJcOE+81RSDL6RnMtws/efQsUI96suMgp55EfXIsJl6IssMtFWt3eSvFqbinVjjPA4Wze0Qa3Uign/A0Fp7lmUWyEnloaL+gTXpbCoIo1CT4Fp+nP5M1Q/VC61lpQP3fhf/Cnei1vb9qhBPo7HevQIg4IeO0vB+t12E3Fv73Getvihly018Vyb7DNYNmDOG4lAVBsV4zibcpQ9MxGQd4hEG5SwHPMUEzCS44cBU5VbyfUtIzbCD7lxI00cyrGX4bjEQAAOw==" />
<path d="M0,0 L70.7,-70.7"></path>
<circle cx="0" cy="0" r="100" />
</svg>p
<em>Circles</em>
</h1>
<p>A tool for cropping circular <a href="https://en.wikipedia.org/wiki/Center_pivot_irrigation">center pivot irrigation</a> fields from aerial imagery.</p>
<input id="upload-another-image" type="file" accept="image/*" style="display: none;">
<div class="another-image-dropper hidden">
Drop or <a>select</a> another image…
</div>
<span><strong>Usage:</strong> Provide an image, click and drag from a center point to make a selection, refine it with <kbd>↑</kbd> <kbd>↓</kbd> <kbd>←</kbd> <kbd>→</kbd> <kbd>+</kbd> <kbd>-</kbd>, then press <kbd>enter</kbd> to download the cropped result. Rinse and repeat. <a href="javascript:showUsersGuide();">Learn more…</a></span>
<section class="selections-table-container hidden">
<hr>
<p><span>The following reverse-chronological table lists your <strong id="selection-count">0 selections</strong> in this image, enabling redownloading (with different settings, say) and deletion.</span></p>
<table class="selections-table">
<thead>
<tr>
<td>x →</td>
<td>y ↓</td>
<td>radius</td>
<td></td>
</tr>
</thead>
<tbody id="selections-table-body"></tbody>
<tfoot id="selections-table-foot"></tfoot>
<tr id="no-selections">
<td colspan="4">No selections present.</td>
</tr>
</table>
<div class="download-all-container">
<div class="download-all">
<button onclick="downloadAll();">download all</button>
<button onclick="downloadZip();">…as zip</button>
</div>
<span>If you've made many selections in a massive image, zipping can be slower than just plain downloading all, but that, in turn, doesn't work in Safari.</span>
</div>
</section>
<hr>
<label><input type="checkbox" class="show-selections-checkbox" data-default="yes" onclick="updateShowSelections(this);" checked> show selections</label>
<span>Shows <a href="javascript:showUsersGuide('ug-showselections');">previously selected</a> circles, which is helpful for keeping track of what you've already done.</span>
<label>
<input type="range" min="0.1" max="2.0" step="0.1" value="1.0" data-default="1.0" class="precision-helper-zoom-slider" oninput="adjustPrecisionHelperZoom(this);">
<br>
<b>1.0×</b>
precision helper zoom
</label>
<span>Adjusts the zoom level of the thumbnails shown in the precision helper below.</span>
<label><input type="checkbox" class="download-immediately-checkbox" data-default="yes" onclick="updateDownloadImmediately(this);" checked> download immediately</label>
<span>Uncheck this if you prefer downloading your images through the table above <em>after</em> making a bunch of selections.</span>
<input type="text" class="filename-template-field" data-default="" placeholder="FILENAME TEMPLATE" value="" oninput="updateFilenameTemplate(this);">
<span>Template for the filenames of result images (but don't specify the file extension, it's added automatically). You can look up the list of template variables <a href="javascript:showUsersGuide('ug-filename');">in the user's guide</a>. If left empty, a <a href="javascript:showUsersGuide('ug-filename');">reasonable default</a> will be used.</span>
<hr>
<label><input type="checkbox" class="transparent-background-checkbox" data-default="yes" onclick="updateTransparentBackground(this);" checked> transparent background</label>
<span>If <em>un</em>checked, the surroundings of the circular selection will be visible in the corners of the final images – <a href="javascript:showUsersGuide('ug-transparentbackground');">essentially</a>, this turns the selection into a rectangle. You can add some margin with the options below.</span>
<section class="margin-settings disabled">
<label>
<input type="range" min="0.0" max="4.0" step="0.1" value="0.0" data-default="0.0" class="vertical-margin-slider" oninput="adjustVerticalMargin(this);" disabled>
<br>
<b>0·<em>r</em></b>
vertical margin
</label>
<span>Above and below the circular core of the selection, include a vertical margin expressed as a fraction of the selection radius <em>r</em>.</span>
<label>
<input type="range" min="0.0" max="4.0" step="0.1" value="0.0" data-default="0.0" class="horizontal-margin-slider" oninput="adjustHorizontalMargin(this);" disabled>
<br>
<b>0·<em>r</em></b>
horizontal margin
</label>
<span>Analogous to the vertical margin, but towards the left and right.</span>
<label class="ceci-nest-pas-une-parametre">
<b class="aspect-ratio">1:1</b>
aspect ratio
</label>
<span>Your settings result in the aspect ratio shown above.</span>
<label>
<input type="range" min="0" max="100" step="1" value="100" data-default="100" class="image-quality-slider" oninput="adjustImageQuality(this);" disabled>
<br>
<b>100%</b>
image quality
</label>
<span>If the background doesn't need to be transparent, JPEG compression will be used – here, you can adjust the <a href="javascript:showUsersGuide('ug-imagequality');">level of compression</a>. Set this to 0 if you prefer PNG.</span>
</section>
<hr>
<p><span>These <em>settings</em> are continually written to your browser's <em>local storage</em>, so they will likely be restored when you close and reopen this page – but that's up to your browser's caching policies. You can back them up here and restore a previous backup:</span></p>
<section class="backup-restore">
<button onclick="downloadSettings();">
<svg viewBox="-11 -11 22 22" style="stroke: currentColor; stroke-width: 2.5; fill: none; height: 0.8em;"><path d="M0,-10 L0,10 M-10,0 L0,10 L10,0"></path></svg>
back up
</button>
<input id="upload-settings" type="file" accept="application/json" style="display: none;">
<button onclick="restoreSettings();">
<svg viewBox="-11 -11 22 22" style="stroke: currentColor; stroke-width: 2.5; fill: none; height: 0.8em;"><path d="M0,10 L0,-10 M-10,0 L0,-10 L10,0"></path></svg>
restore…
</button>
</section>
<p><span>The same goes for your <em>selections</em>, both your current ones and ones you've made in previous sessions. This allows you to close this tool mid-work, reopen it, drag the same image in again, and continue selecting from where you left off – or a different image <a href="javascript:showUsersGuide('ug-geoawareness');">covering an area</a> you've previously made selections in. Again, your browser might decide to evict this data from its cache, hence:</span></p>
<section class="backup-restore">
<button onclick="downloadSelectionCache();">
<svg viewBox="-11 -11 22 22" style="stroke: currentColor; stroke-width: 2.5; fill: none; height: 0.8em;"><path d="M0,-10 L0,10 M-10,0 L0,10 L10,0"></path></svg>
back up
</button>
<input id="upload-selectioncache" type="file" accept="application/json" style="display: none;">
<button onclick="restoreSelectionCache();">
<svg viewBox="-11 -11 22 22" style="stroke: currentColor; stroke-width: 2.5; fill: none; height: 0.8em;"><path d="M0,10 L0,-10 M-10,0 L0,-10 L10,0"></path></svg>
restore…
</button>
</section>
<hr>
<span class="reset">
<strong>Danger zone:</strong> <a href="javascript:resetSettingsToDefaults();">reset settings</a> or <a href="javascript:purgeSelectionCache();">purge selection cache</a>, in which case only your current selections will remain, or <a href="javascript:deleteAllSelections();">delete all current selections</a>.
</span>
</aside>
<aside class="precision-helper">
<canvas id="prec"></canvas>
</aside>
<main>
<img id="base-image">
<canvas id="work"></canvas>
<div class="dropper">
<div class="dropper-label">
<input id="upload-image" type="file" accept="image/*" style="display: none;">
<em class="drop-or-select">Drop or <a>select</a> image…</em>
<em class="load-sample">…or <a>load sample</a>.</em>
</div>
</div>
</main>
<img id="dropped-image">
<canvas id="cropped-image"></canvas>
<footer class="status hidden"></footer>
<footer class="error hidden">
<a href="javascript:dismissError();" class="dismiss">×</a>
<p class="error-message"></p>
</footer>
<section class="users-guide">
<a href="javascript:hideUsersGuide();" class="hide">×</a>
<p class="hero"><a href="https://github.com/doersino/cropcircles"><em>Crop Circles</em></a> is a tool originally designed for cropping circular <a href="https://en.wikipedia.org/wiki/Center_pivot_irrigation">center pivot irrigation</a> fields from aerial imagery collected with, for example, <a href="https://github.com/doersino/aerialbot">ærialbot</a>.</p>
<p>It's an unabashedly-built-for-<a href="https://noahdoersing.com">myself</a> tool, with precisely the knobs and toggles I thought would enable me to fine-tune my workflow during the creation of a <a href="https://www.youtube.com/playlist?list=PLTphPoE54a1s_ZdCkGwbhQO9O5SMSitA1">series of videos</a> like the one below.</p>
<video controls loop poster="assets/video-poster-sample-sw42.286577541476696,-113.90409924217032ne42.340476458523305,-113.80691475782969.jpg">
<source src="assets/video-sample-sw42.286577541476696,-113.90409924217032ne42.340476458523305,-113.80691475782969.mp4" type="video/mp4">
</video>
<p><em>But nothing's keeping you from using this tool to crop circular objects from imagery-in-a-more-general-sense!</em> To that end, I think it's helpful to spend a couple minutes reading this document, or, alternatively, discovering how this tool works through play – rest assured that you can't break anything.</p>
<p class="separator"></p>
<h2>Basic Usage</h2>
<ol>
<li>Drop an image into the <a href="javascript:showUsersGuide('ug-workarea');">main work area</a>.</li>
<li>Click and drag from a center point to make a circular selection.</li>
<li>Keeping an eye on the <a href="javascript:showUsersGuide('ug-precisionhelper');">precision helper</a> in the bottom right, adjust the selection with the arrow keys <kbd>↑</kbd> <kbd>↓</kbd> <kbd>←</kbd> <kbd>→</kbd>; you can increase or decrease the size of your selection with <kbd>+</kbd> <kbd>-</kbd>. Press <kbd>shift</kbd> to adjust in 20× larger increments.</li>
<li>When satisfied, press <kbd>enter</kbd> to accept the selection – it will then download as a PNG image, tightly cropped around the x and y bounds of the circular selection, with transparent corners. (If you wish to cancel the current selection, press <kbd>esc</kbd>.)</li>
<li>Repeat steps 2 through 4 for as many circles as you'd like to select.</li>
</ol>
<p class="separator"></p>
<h2>User interface</h2>
<h3 id="ug-workarea">Work area</h3>
<p>Filling most of the screen, the main work area contains the active image (or, initially, a prompt to select one). You can use your mouse to create <em>selections</em>:</p>
<ol>
<li>Click at the desired selection center.</li>
<li>Then drag without letting go of the left mouse button to make a circular selection.</li>
<li>Once you let go of the left mouse button, the preliminary selection can be refined. Keeping an eye on the <em>precision helper</em> in the bottom right (more about that in a bit), adjust the selection with the arrow keys <kbd>↑</kbd> <kbd>↓</kbd> <kbd>←</kbd> <kbd>→</kbd> (or with <kbd>W</kbd> <kbd>A</kbd> <kbd>S</kbd> <kbd>D</kbd> if you feel particularly gamery today); you can increase or decrease the size of your selection with <kbd>+</kbd> <kbd>-</kbd> (or <kbd>P</kbd> <kbd>O</kbd> if you don't have math operators handy on your keyboard layout). Press <kbd>shift</kbd> at the same time to adjust things in 20× larger increments.</li>
<li>
Further selections can either be made in the same click-and-drag-and-refine manner, or by two other ways:
<ul>
<li>Clicking-without-dragging a spot, which will replicate the most recent selection centered around that spot, ready to be refined.</li>
<li>Or by tapping one of <kbd>↑</kbd> <kbd>↓</kbd> <kbd>←</kbd> <kbd>→</kbd> (or their gamer equivalents), which will replicate the most recent selection right next to itself in the cardinal direction determined by the pressed key.</li>
</ul>
</li>
</ol>
<p>Unless you uncheck the "show selections" setting, the work area also provides an overview over which fields (or other objects) you've already selected. Hovering the mouse pointer over one of them highlights it in the table in the sidebar.</p>
<h3>Sidebar</h3>
<p>The sidebar on the right, meanwhile, packs a punch: You can use it to…</p>
<ul>
<li>…open this user's guide. But you've already figured that out, it seems. Nice going!</li>
<li>…select another image. Your selections in the current image will be kept around in the <a href="javascript:showUsersGuide('ug-selection-cache')">selection cache</a>: You can recover them by selecting the same image again, even after a page reload.</li>
<li>…download or remove previous selections: Once you've made your first selection, a table listing your previous selections will appear in the sidebar. Read more about it below this list.</li>
<li>…change the various settings detailed later in this document.</li>
<li>…and export or restore your settings or the selection cache. This is also described later in this document.</li>
</ul>
<p>The <em>selections table</em> lists the selections you've made in the current image (plus, if it has <a href="javascript:showUsersGuide('ug-geoawareness');">associated geo data</a>, any selections you've made in other images that fall into the geographical area covered by the image). Hovering over a selection in the table highlights it in the main work area. Using the buttons in right-most column of the table, you can (re)download or delete a specific selection, or "accept" a selection you've previously made in another image that is located in the geographical area covered by the current image – this will copy it into the main part of the selections table (if you delete such a selection, it returns to the "geo suggestions" section at the bottom of the table).</p>
<p>Recall that that the selections you've made in the current image are kept in the <a href="javascript:showUsersGuide('ug-selection-cache');">selection cache</a>, so this table will be restored if you work on another image, then select this one again.</p>
<p>A pair of buttons below the table allows you to download all selections: Either sequentially, which I sadly haven't gotten to work reliably in Safari (only in Chrome and Firefox), or in a single ZIP file. Note that if you have made more than a few selections that cover a large area (say, 1 megapixel each), zipping can be slower than downloading them all individually or sequentially – that seems to be a limitation of the <a href="https://github.com/Stuk/jszip/">JSZip</a> library.</p>
<h3 id="ug-precisionhelper">Precision helper</h3>
<p>Below the sidebar, the <em>precision helper</em> aids you in hitting your marks when making a selection. It's divided into nine areas:</p>
<ul>
<li>The central square shows the central portion of the selection. A crosshairs trained on the very center pixel helps with alignment. Another line protrudes from the middle of each of the sides of this square, this is mostly just handy when working on images of center pivot irrigation farms.</li>
<li>The four squares right above, below, right, and left of the central square show the areas of the image near the top, bottom, right, and left selection boundaries. The bottom one additionally informs you about the selection radius.</li>
<li>The corner squares show the areas of the image at the 1:30, 4:30, 7:30, and 10:30 positions with regard to the selection.</li>
</ul>
<h3>User's guide</h3>
<p>The user's guide should be self-explanatory (literally!).</p>
<h3>Status & error messages</h3>
<p>Status messages may pop up in the bottom left corner and inform you about ongoing processes like zipping, or, say, about successful selection cache restores. They disappear automatically, either two seconds after being summoned or after the process they're keeping your updated on has finished.</p>
<p>Error messages, should they appear, cover the bottom part of the screen, are roughly the same shade of red as the two <a href="https://twitter.com/ScuderiaFerrari/status/1304113260124344325">SF1000</a> cars that raced around the Mugello circuit on the weekend of this tool's initial release, and don't disappear automatically. (If you want to experience one, simply try to restore your settings from some random file instead of a proper backup.)</p>
<p class="separator"></p>
<h2>Keyboard Controls</h2>
<p>Even though most of the keyboard controls have been described in the previous section, here's a table summarizing their functions:</p>
<table>
<tr>
<td><kbd>↑</kbd>, <kbd>W</kbd></td>
<td>Move the current selection upwards by a pixel (or 20 if <kbd>shift</kbd> is pressed), or if there is no current selection, make a copy of the most recent selection right above itself that can then be further refined.<br>
If you're using a <em>non-qwerty key layout</em>, <kbd>W</kbd> probably (i.e. if your browser abides by the standards) won't do anything: Instead, press the key that's located where the <kbd>W</kbd> key would be on a conventional key layout (the same goes for all other letter keys). It's implemented <a href="https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code">that way</a> because I'm told that's how you'll expect it to work. ¯\_(ツ)_/¯</td>
</tr>
<tr>
<td><kbd>↓</kbd>, <kbd>S</kbd></td>
<td>Analogous, but downwards.</td>
</tr>
<tr>
<td><kbd>←</kbd>, <kbd>A</kbd></td>
<td>Analogous, but leftwards.</td>
</tr>
<tr>
<td><kbd>→</kbd>, <kbd>D</kbd></td>
<td>Analogous, but rightwards.</td>
</tr>
<tr>
<td><kbd>+</kbd>, <kbd>P</kbd></td>
<td>Increase the radius of the current selection by a pixel (or 20 if <kbd>shift</kbd> is pressed).</td>
</tr>
<tr>
<td><kbd>-</kbd>, <kbd>O</kbd></td>
<td>Analogous, but this decreases the radius.</td>
</tr>
<tr>
<td><kbd>*</kbd></td>
<td>Analogous to <kbd>shift</kbd> <kbd>+</kbd> because I'm using a German key layout, and one of the perks of building your own tools is that you can account for your edge cases with hacks instead of having to look for more elegant solutions.</td>
</tr>
<tr>
<td><kbd>_</kbd></td>
<td>Analogous to <kbd>shift</kbd> <kbd>-</kbd> for the same reason.</td>
</tr>
<tr>
<td><kbd>shift</kbd></td>
<td>Increase the potency of the previous operations by a factor of 20. Your key switches will be grateful.</td>
</tr>
<tr>
<td><kbd>enter</kbd></td>
<td><em>Accept</em> the current selection, thereby freezing its size and location and adding it to both the table in the sidebar and the selection cache.</td>
</tr>
<tr>
<td><kbd>backspace</kbd></td>
<td>Delete the most recently accepted selection. Note that this is irreversible, and pressing <kbd>backspace</kbd> multiple times will delete multiple selections. Be careful (or make frequent <a href="javascript:showUsersGuide('ug-backups');">backups</a>)!</td>
</tr>
<tr>
<td><kbd>esc</kbd></td>
<td>Cancel the current selection.</td>
</tr>
</table>
<p>All of these are disabled while you're entering text into the <a href="javascript:showUsersGuide('ug-filename');">filename template field</a>, of course.</p>
<p class="separator"></p>
<h2>Configuration</h2>
<p>The settings in the sidebar are tersely explained in-place. Here's some more words about them.</p>
<h3 id="ug-showselections">Show selections</h3>
<p>If enabled (which is the default), your previously selected circles are visible in the main work area, which is helpful for keeping track of what you've already done. If the current image has <a href="javascript:showUsersGuide('ug-geoawareness');">associated geo data</a>, selections you've previously made in other images that fall into the geographical area covered by the current image will show up, too.</p>
<h3>Precision helper zoom</h3>
<p>Adjusts the zoom level of the thumbnails shown in the precision helper in the bottom right. At 1×, the image pixels will be shown at original scale with regard to <em>logical</em> browser pixels – on a high-DPI or Retina device, they will thus be scaled up with regard to <em>physical</em> pixels. This is by design.</p>
<h3>Download immediately</h3>
<p>Uncheck this checkbox if you prefer downloading your images through the selections table after first making a bunch of selections.</p>
<h3 id="ug-filename">Filename</h3>
<p>This is a template for the filenames of result images. It's used both for direct downloads and filenames within ZIPs. Make sure <em>not to</em> specify the file extension, it's added automatically depending on other settings. If you leave this field empty, as is indeed the default, the default filename template (see first row of the following table) is used.</p>
<p>You can make use of the following variables:</p>
<table>
<tr>
<td>{default}</td>
<td>The default filename: "cropcircles-x{x}y{y}r{r}" (or "cropcircles-{lat},{lon},{rm}m-x{x}y{y}r{r}" if the current image has associated geo data). Handy if all you want to change is adding a prefix or postfix.</td>
</tr>
<tr>
<td>{file}</td>
<td>Filename of the image the selection was made in.</td>
</tr>
<tr>
<td>{id}</td>
<td>Internal selection identifier, actually the millisecond-precision UNIX timestamp at which the selection was made, e.g. "1599251366699".</td>
</tr>
<tr>
<td>{date}</td>
<td>The current date at the time of download, in <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString">simplified extended ISO format</a>, e.g. "2020-09-12T18.51.17.485Z".</td>
</tr>
<tr>
<td>{rand}</td>
<td>Random integer with a (zero-padded) length of 10. E.g. "1708473213" or "0072495286". Handy as a filename prefix if you want the images to end up in a random order for whatever reason.</td>
</tr>
<tr>
<td>{x}</td>
<td>x coordinate, in pixels and with respect to the top left corner of the image, of the selection center.</td>
</tr>
<tr>
<td>{y}</td>
<td>Analogous.</td>
</tr>
<tr>
<td>{r}</td>
<td>Radius of the circular selections, in pixels.</td>
</tr>
</table>
<p>If the current image has <a href="javascript:showUsersGuide('ug-geoawareness');">associated geo data</a>, the following variables are available, as well:</p>
<table>
<tr>
<td>{georect}</td>
<td>Geo bounds of the input image, e.g. "sw42.2865,-113.9040ne42.3404,-113.8069". This allows you to drop a cropped image right back into this tool and, say, tighten the existing selection.</td>
</tr>
<tr>
<td>{lat}</td>
<td>Latitude of the selection center.</td>
</tr>
<tr>
<td>{lon}</td>
<td>Analogous.</td>
</tr>
<tr>
<td>{rm}</td>
<td>Selection radius in meters. (Note that the scale factor from pixels to meters depends on latitude.)</td>
</tr>
</table>
<h3 id="ug-transparentbackground">Transparent background</h3>
<p>If you leave this checkbox enabled, downloading your selections will yield PNG images with transparent corners: anything outside the bounds of the circular selections will be removed (like each of the three little center pivot irrigation farms in-between the sections of this user's guide).</p>
<p>On the other hand, if you choose to uncheck this checkbox, the <em>surroundings</em> of the circular selections will be visible in the corners of the final images – essentially, this turns the selection into a square. This square can be expanded into a rectangle that includes even more of the circular selection's surroundings through the following two settings. Since this removes the need for transparency, the images are downloaded as more space-efficient JPG files by default. The encoding quality is preset at 100%, making this effectively as lossless as PNG – but you can <a href="showUsersGuide('ug-imagequality');">reduce the quality</a> if you want to save space.</p>
<p>This functionality comes in handy for making a video like the one at the top of this user's guide, where different circular objects are shown in one place, with mainly their surroundings changing.</p>
<p>If enabled, you'll notice a box-shaped dashed line around the current (or highlighted) selection – that's just a preview of the crop area.</p>
<h3>Vertical margin</h3>
<p>If you increase this slider from its default of 0, a vertical margin whose size you can set as a fraction of the selection radius is added above and below the circular core of the selection.</p>
<h3>Horizontal margin</h3>
<p>Analogous to the vertical margin, but towards the left and right.</p>
<p>Together, these two sliders allow you to dial in the range of surroundings to include in the images: For the example video included at the beginning of this document, the vertical margin was set to 0.2 and the horizontal margin to 1.8, yielding an aspect ratio (as shown below the two sliders) of 1:2.33 (i.e. <a href="https://en.wikipedia.org/wiki/CinemaScope">cinemascope</a>).</p>
<h3 id="ug-imagequality">Image quality</h3>
<p>If the background doesn't need to be transparent, JPEG compression will be used – in contrast to PNG, it's lossy but significantly more space-efficient. Using this slider, you can adjust the level of compression: 100% is effectively lossless, 90% is still pretty good, anything below 70% only really works for images that won't ever be shown at their actual size.</p>
<p>If you want this tool to generate PNG images regardless, simply set this to 0.</p>
<p class="separator"></p>
<h2 id="ug-backups">Backup & Restore</h2>
<p>Using the buttons near the bottom of the sidebar, you can download a backup of your settings or the selection cache. These backups take the form of JSON files – you can inspect and modify them in any text editor; their structure is simple enough that you won't need further information about their schemata.</p>
<p>These backups would be pretty bad at being backups if you couldn't restore them, so you can! Note the differing semantics:</p>
<ul>
<li>If you restore a settings backup, the current settings are discarded and replaced with the settings stored in the backup.</li>
<li>When restoring a selection cache backup, on the other hand, any selections from the backup that aren't already in the current selection cache are <em>added</em> to it – nothing is removed from the current selection cache. In math-y terms, that's the <em>union</em> of the two selection caches.</li>
<li>If you would rather <em>replace</em> the current selection cache with the one from your backup, simply purge the current selection cache using the tiny little link at the very bottom of the sidebar (and, if you want, delete all current selections using the link nearby) before restoring the backup.</li>
</ul>
<p>Because settings and selection cache are stored in <a href="https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage">local storage</a>, which – depending on your browser settings – may be wiped occasionally, I recommend making occasional backups, <em>especially</em> of your selection cache.</p>
<p class="separator"></p>
<h2 id="ug-selection-cache">Selection cache</h2>
<p>As outlined in previous sections of this user's guide, the selection cache is where your selections are safeguarded against inadvertent page reloads, browser crashes, or potential data loss when working on another image for a bit before resuming work on a previously worked-on image. To this end, the selection cache is kept in <a href="https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage">local storage</a> and can be <a href="javascript:showUsersGuide('ug-backups');">backed up and restored</a>.</p>
<p>Each selection is assigned to the image it was made in. For simplicity's sake, sameness of two images is defined through equality of filename, filesize, and image width/height in pixels – so avoid situations where nominally-different images share all four of these attributes if you don't want selections made in one of them show up for the other one, as well.</p>
<p>The subset of the selection cache belonging with the current image is shown in the selections table.</p>
<p>It can be purged (for all images you've ever made selections in!) using a link at the very bottom of the sidebar.</p>
<p class="separator"></p>
<h2 id="ug-geoawareness">Geo-Awareness</h2>
<p>Since this tool was designed for use with aerial imagery, it seemed to make sense to loop any geo data associated with that imagery all the way through the pipeline, embedding it into the output images. In my own use case, I'm not actually doing anything with that data, but maybe that'll change in future.</p>
<p>Geo data, in the context of this tool, refers to latitude and longitude of the center points of the circular selections, which can be derived from the latitude and longitude of two points in the input image (and hardcoded assumptions about the projection the imagery uses). For simplicity's sake, these two points must be the southwest and northeast corners of the image:</p>
<p>If the input image's filename contains a part of the form "sw[lat],[lon]ne[lat],[lon]", the cropped circles will be named based on their center point's latitude, longitude and circle radius (that one in meters). This interpolation is based on the assumption that the aerial imagery you've uploaded is laid out based on the Web Mercator projection, which is common among online mapping services like Google Maps. Even if that's not the case: On large-scale maps (covering fewer than 100 vertical kilometers), the difference will be in the rounding error range.</p>
<p>If geo data is known for the current image, additional output filename variables are unlocked, and the default template also changes. Read more about that <a href="javascript:showUsersGuide('ug-filename');">here</a>.</p>
<p>Also, latitude, longitude and radius in meters are shown in the selections table in the sidebar. Selections you make in images with associated geo data will also show up in other images covering the same area, with a dashed border. They are not automatically merged into the list of of selections of that image, instead they can be "promoted" though the selections table in the sidebar.</p>
<p class="separator"></p>
<h2>Notes</h2>
<p>None of these bullet points fit well into the previous sections, so here they are:</p>
<ul>
<li>Check out <a href="https://github.com/doersino/aerialbot">ærialbot</a>, a Python-based tool that, while originally designed to run Twitter bots, can be used to download large-scale satellite maps of arbitrary areas. The sample image was obtained using ærialbot, for instance.</li>
<li>Keep the images you "upload" below 100 megapixels – things get sluggish fast if you shoot past this limit. Then again, I've developed and tested this tool using a 5-year-old laptop, and I have a horrendous habit of keeping way too much stuff open in the background, burning CPU cycles that would otherwise be used by this tool, so your mileage may vary.</li>
<li>The sample video shown at the top of this user's guide was generated (based on selections made in a higher-resolution variant of the sample image) using the venerable <a href="https://ffmpeg.org">FFmpeg</a> utility, invoked as follows: ffmpeg -framerate 3 -pattern_type glob -i '*.jpg' -vf scale=1920:824 -pix_fmt yuv420p out.mp4</li>
<li>If you have opinions about this tool, whether they range from grandfatherly approval to the esteem in which conservatives seem to hold epidemiology, <a href="https://github.com/doersino/cropcircles/issues/new">tell me about them</a>! Any constructive feedback will probably be implemented swiftly (unless that'd be too much work).</li>
</ul>
<p class="separator"></p>