edzee3000 commited on
Commit
7bf2029
·
verified ·
1 Parent(s): 374b8b9

Add Last Tide low-repeat album mosaic

Browse files

718 source files, each used 8 or 9 times; 5984 variable-size tiles. 23040x15360 lossless PNG. Uniform per-tile tone adjustments; no target detail overlay. Includes layout, source hashes and saved-pixel verification.

homepage-assets/music/last-tide/README.md ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # 最后的潮汐 / The Last Tide
2
+
3
+ An album-cover photomosaic made from 718 archived source files (676 byte-distinct artworks), representing the acquired 878 playlist entries. The painting is an original AI-generated composition guided by the equally weighted source color palette.
4
+
5
+ ## Layout
6
+
7
+ - 5,984 square tiles, in three sizes; largest side is twice the smallest.
8
+ - Each source file appears 8 or 9 times: 478 sources eight times, 240 nine times.
9
+ - Total area per source is 76–78 grid units, a maximum difference of 2.63%.
10
+ - Repeated byte-identical artwork, including duplicate source files, has centers separated by at least nine grid units.
11
+ - Every grid cell is covered once, with no gaps or overlaps.
12
+
13
+ ## Color and lossless export
14
+
15
+ Each tile receives a spatially uniform RGB adjustment: `(source pixel - source tile mean) * 0.45 + target region mean`, rounded and clipped to 8-bit RGB. This changes cover colors and contrast, while retaining the source's internal image details. No target painting silhouettes or textures are overlaid on the covers. The target contributes only one average RGB value per tile.
16
+
17
+ The 23,040 × 15,360 master is an 8-bit RGB PNG with an sRGB profile and lossless compression. Lossless describes the saved composite, not preservation of unmodified original source colors or resolution. Sources are resized to their assigned tile sizes.
18
+
19
+ The entire saved master is reopened, and every tile is compared pixel-for-pixel against its source resized and transformed using the recorded recipe. All 718 original file SHA-256 hashes are verified before rendering. See validation.json, layout.json and checksums.json.
20
+
21
+ last-tide-master.png is the archival image. last-tide-web.webp is the 4,096-pixel browsing asset for a future Music page integration. Preview JPGs are convenient viewing versions. target-painting.png is the target, not the composite. varied-size-preview files show the initial unadjusted-color layout.
22
+
23
+ source-manifest.json includes the archived source URL, filename, SHA-256 and song mappings. Color-analysis and generation-prompt files document how the target was chosen. source-*.py scripts record the deterministic matching, rendering and verification process.
homepage-assets/music/last-tide/checksums.json ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "color-distribution.json": {
3
+ "bytes": 7725,
4
+ "sha256": "0bbee549f90b67eeab66a90236ed368cc001769ea6575eac0b28550419bf0f16"
5
+ },
6
+ "last-tide-master.png": {
7
+ "bytes": 432219739,
8
+ "sha256": "dad13997d297088dfd0c82d7e40e6efd16a3245fcfc9a7041394fdec237155f2"
9
+ },
10
+ "last-tide-preview.jpg": {
11
+ "bytes": 5000776,
12
+ "sha256": "b2cdd9eac18b611b7fdd4a1715b57a4fd239bd63895bbce1cce2e67a082792ac"
13
+ },
14
+ "last-tide-toned-preview.jpg": {
15
+ "bytes": 14762375,
16
+ "sha256": "fa703b7163cc57e7cd90bbf5cc9a3b5104753c57a17646c1bdaee7b1382d7e39"
17
+ },
18
+ "last-tide-web.webp": {
19
+ "bytes": 3117386,
20
+ "sha256": "02caddb919e3196108431e9d92d54080887fde56d377648d73dff21dfc70ea17"
21
+ },
22
+ "layout.json": {
23
+ "bytes": 1575931,
24
+ "sha256": "0e446846b060d78d94c66839c8fe607599a83d0d1e75f3216c5a1672de87a688"
25
+ },
26
+ "README.md": {
27
+ "bytes": 2211,
28
+ "sha256": "4c059d10cf775cf6b7b6d713fcfaaf6d47dbb8ffc4e9af58b372800f31b93938"
29
+ },
30
+ "source-build-layout.py": {
31
+ "bytes": 11117,
32
+ "sha256": "df0efd83cb463892ba2b089392f86da0ebb52047cce42abbafdc6d2dbff30521"
33
+ },
34
+ "source-cover-helpers.py": {
35
+ "bytes": 9537,
36
+ "sha256": "bd746346eea9b70aa7d73689a08d660b6a194e18dddc2cbb1cd6c4abd2b23620"
37
+ },
38
+ "source-manifest.json": {
39
+ "bytes": 704565,
40
+ "sha256": "986ceabd81246e91989ae58f1f0ba7884607a2957e848d9c5308f6abda5b1e19"
41
+ },
42
+ "source-render-verify.py": {
43
+ "bytes": 5497,
44
+ "sha256": "4e15e57ffecc09febeb22984c407d22b4ee983caa0403f672f00a8d2c8ec89d0"
45
+ },
46
+ "target-color-check.json": {
47
+ "bytes": 2741,
48
+ "sha256": "dc496243bf466c2e2ea063bb5ed0fffa604b94a8d10aff1b1ab4bf3c43ccdf3b"
49
+ },
50
+ "target-edit-prompt.txt": {
51
+ "bytes": 1807,
52
+ "sha256": "e064ed76e1ab2ec353b4568b24a9f6fadadafbb093ed385b8786486852337bb7"
53
+ },
54
+ "target-painting.png": {
55
+ "bytes": 3314113,
56
+ "sha256": "4582a4654105d9a44cfe01f60ddc28c121efa85f0097a079b67797c22c7e5313"
57
+ },
58
+ "target-prompt.txt": {
59
+ "bytes": 2709,
60
+ "sha256": "a6533739de396b44b5c036890c079b3dd4a5c9166827b420fca99235e100b053"
61
+ },
62
+ "validation.json": {
63
+ "bytes": 1224,
64
+ "sha256": "502028d37ef70668286f5dc6aa3ba88d8106feaaefc38253a160f36d84a0f19f"
65
+ },
66
+ "varied-size-preview.jpg": {
67
+ "bytes": 20987157,
68
+ "sha256": "2913c9188cbcf94bd819a410065e999ad6b223c1a534ed891941ba415169f3f2"
69
+ },
70
+ "varied-size-preview.png": {
71
+ "bytes": 52952972,
72
+ "sha256": "f7b550554f6d1db429678fff9661e94e426a95dab63319a4a77a5a80d63a27c5"
73
+ }
74
+ }
homepage-assets/music/last-tide/color-distribution.json ADDED
@@ -0,0 +1,335 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "source": "Archived NetEase playlist album art; local manifest.json",
3
+ "source_files": 718,
4
+ "distinct_file_contents": 676,
5
+ "sampling": "64x64 RGB samples per source; equal source weights; full-cover contain fit.",
6
+ "palette_method": "10 CIELAB pixel clusters fitted on 256 pixels per cover, classified on all sampled pixels.",
7
+ "sample_pixels": 2940928,
8
+ "overall_mean_rgb": [
9
+ 116.49326607111769,
10
+ 104.2899421543132,
11
+ 100.03276176771413
12
+ ],
13
+ "trial_area_weighted_mean_rgb": [
14
+ 113.93380659597891,
15
+ 101.55911540985107,
16
+ 97.58473518159654
17
+ ],
18
+ "cover_mean_lightness_quantiles": {
19
+ "0.1": 15.840929700813719,
20
+ "0.25": 27.039243404518665,
21
+ "0.5": 44.23438428912819,
22
+ "0.75": 60.56201969770859,
23
+ "0.9": 76.06756238709627
24
+ },
25
+ "cover_mean_lightness_bins": {
26
+ "below_25": 153,
27
+ "25_to_45": 211,
28
+ "45_to_65": 212,
29
+ "65_and_above": 142
30
+ },
31
+ "pixel_palette": [
32
+ {
33
+ "cluster": 6,
34
+ "hex": "#151011",
35
+ "rgb": [
36
+ 21,
37
+ 16,
38
+ 17
39
+ ],
40
+ "lab": [
41
+ 5.184590750132756,
42
+ 1.9048330823247441,
43
+ 0.24880624176792315
44
+ ],
45
+ "equal_source_pixel_share": 0.21443231524199163,
46
+ "distinct_content_pixel_share": 0.21065652158838757,
47
+ "trial_area_weighted_pixel_share": 0.22125814579151296,
48
+ "dominant_cover_count": 195
49
+ },
50
+ {
51
+ "cluster": 7,
52
+ "hex": "#E9E9E6",
53
+ "rgb": [
54
+ 233,
55
+ 233,
56
+ 230
57
+ ],
58
+ "lab": [
59
+ 92.2693706432967,
60
+ -0.705908371213269,
61
+ 1.392307413045556
62
+ ],
63
+ "equal_source_pixel_share": 0.15534790379091226,
64
+ "distinct_content_pixel_share": 0.15740100025425297,
65
+ "trial_area_weighted_pixel_share": 0.14535932187680844,
66
+ "dominant_cover_count": 139
67
+ },
68
+ {
69
+ "cluster": 0,
70
+ "hex": "#333439",
71
+ "rgb": [
72
+ 51,
73
+ 52,
74
+ 57
75
+ ],
76
+ "lab": [
77
+ 21.83537433838529,
78
+ 0.4138941959647967,
79
+ -3.2490864512708213
80
+ ],
81
+ "equal_source_pixel_share": 0.13393969522545265,
82
+ "distinct_content_pixel_share": 0.13583753235946747,
83
+ "trial_area_weighted_pixel_share": 0.1372039759600604,
84
+ "dominant_cover_count": 77
85
+ },
86
+ {
87
+ "cluster": 1,
88
+ "hex": "#A3A6AB",
89
+ "rgb": [
90
+ 163,
91
+ 166,
92
+ 171
93
+ ],
94
+ "lab": [
95
+ 68.02872361547887,
96
+ -0.17215352418966778,
97
+ -3.050302712630875
98
+ ],
99
+ "equal_source_pixel_share": 0.13307772240598886,
100
+ "distinct_content_pixel_share": 0.133642072508321,
101
+ "trial_area_weighted_pixel_share": 0.13034788767496744,
102
+ "dominant_cover_count": 86
103
+ },
104
+ {
105
+ "cluster": 9,
106
+ "hex": "#64655D",
107
+ "rgb": [
108
+ 100,
109
+ 101,
110
+ 93
111
+ ],
112
+ "lab": [
113
+ 42.32924908279555,
114
+ -1.803237447589678,
115
+ 4.067221438456357
116
+ ],
117
+ "equal_source_pixel_share": 0.1183510782990947,
118
+ "distinct_content_pixel_share": 0.11850788184171597,
119
+ "trial_area_weighted_pixel_share": 0.11991815213803891,
120
+ "dominant_cover_count": 64
121
+ },
122
+ {
123
+ "cluster": 5,
124
+ "hex": "#BA9D6B",
125
+ "rgb": [
126
+ 186,
127
+ 157,
128
+ 107
129
+ ],
130
+ "lab": [
131
+ 66.24071802221434,
132
+ 3.8751715940898044,
133
+ 29.92185791483176
134
+ ],
135
+ "equal_source_pixel_share": 0.0654194866382312,
136
+ "distinct_content_pixel_share": 0.06460986617048817,
137
+ "trial_area_weighted_pixel_share": 0.06435998280843098,
138
+ "dominant_cover_count": 38
139
+ },
140
+ {
141
+ "cluster": 2,
142
+ "hex": "#7D342B",
143
+ "rgb": [
144
+ 125,
145
+ 52,
146
+ 43
147
+ ],
148
+ "lab": [
149
+ 31.807193110284167,
150
+ 30.825141262171346,
151
+ 21.572970651694558
152
+ ],
153
+ "equal_source_pixel_share": 0.05777496082869081,
154
+ "distinct_content_pixel_share": 0.058201535919008875,
155
+ "trial_area_weighted_pixel_share": 0.05918267921165184,
156
+ "dominant_cover_count": 27
157
+ },
158
+ {
159
+ "cluster": 8,
160
+ "hex": "#D5362A",
161
+ "rgb": [
162
+ 213,
163
+ 54,
164
+ 42
165
+ ],
166
+ "lab": [
167
+ 48.2616981480384,
168
+ 60.57311309400761,
169
+ 44.44600470355228
170
+ ],
171
+ "equal_source_pixel_share": 0.04855304176096797,
172
+ "distinct_content_pixel_share": 0.04517396102995562,
173
+ "trial_area_weighted_pixel_share": 0.0492680690906666,
174
+ "dominant_cover_count": 37
175
+ },
176
+ {
177
+ "cluster": 4,
178
+ "hex": "#444E92",
179
+ "rgb": [
180
+ 68,
181
+ 78,
182
+ 146
183
+ ],
184
+ "lab": [
185
+ 35.52683649096342,
186
+ 16.24852891543761,
187
+ -38.649675229658406
188
+ ],
189
+ "equal_source_pixel_share": 0.04551386501131616,
190
+ "distinct_content_pixel_share": 0.04698154065735947,
191
+ "trial_area_weighted_pixel_share": 0.0464903160377785,
192
+ "dominant_cover_count": 32
193
+ },
194
+ {
195
+ "cluster": 3,
196
+ "hex": "#D7BE32",
197
+ "rgb": [
198
+ 215,
199
+ 190,
200
+ 50
201
+ ],
202
+ "lab": [
203
+ 77.01120754211509,
204
+ -5.705605762532588,
205
+ 68.77475952248756
206
+ ],
207
+ "equal_source_pixel_share": 0.02758993079735376,
208
+ "distinct_content_pixel_share": 0.0289880876710429,
209
+ "trial_area_weighted_pixel_share": 0.026611469410083913,
210
+ "dominant_cover_count": 23
211
+ }
212
+ ],
213
+ "cover_average_palette": [
214
+ {
215
+ "hex": "#6A6E72",
216
+ "rgb": [
217
+ 106,
218
+ 110,
219
+ 114
220
+ ],
221
+ "lab": [
222
+ 46.160256931864545,
223
+ -0.72002274739643,
224
+ -2.5991803177142185
225
+ ],
226
+ "covers": 160,
227
+ "cover_share": 0.22284122562674094
228
+ },
229
+ {
230
+ "hex": "#BDBBBB",
231
+ "rgb": [
232
+ 189,
233
+ 187,
234
+ 187
235
+ ],
236
+ "lab": [
237
+ 76.1083702476436,
238
+ 0.3059546960638524,
239
+ 0.5631052644561197
240
+ ],
241
+ "covers": 140,
242
+ "cover_share": 0.19498607242339833
243
+ },
244
+ {
245
+ "hex": "#483D36",
246
+ "rgb": [
247
+ 72,
248
+ 61,
249
+ 54
250
+ ],
251
+ "lab": [
252
+ 26.71266415367999,
253
+ 3.7511610048963413,
254
+ 5.983898508195382
255
+ ],
256
+ "covers": 123,
257
+ "cover_share": 0.1713091922005571
258
+ },
259
+ {
260
+ "hex": "#907A60",
261
+ "rgb": [
262
+ 144,
263
+ 122,
264
+ 96
265
+ ],
266
+ "lab": [
267
+ 52.523934245724796,
268
+ 4.912399503305346,
269
+ 17.4459188430915
270
+ ],
271
+ "covers": 103,
272
+ "cover_share": 0.14345403899721448
273
+ },
274
+ {
275
+ "hex": "#261D20",
276
+ "rgb": [
277
+ 38,
278
+ 29,
279
+ 32
280
+ ],
281
+ "lab": [
282
+ 12.057636413316793,
283
+ 4.673234728226631,
284
+ -0.23637345105866653
285
+ ],
286
+ "covers": 102,
287
+ "cover_share": 0.14206128133704735
288
+ },
289
+ {
290
+ "hex": "#A92E2E",
291
+ "rgb": [
292
+ 169,
293
+ 46,
294
+ 46
295
+ ],
296
+ "lab": [
297
+ 38.99412454132453,
298
+ 49.61412109976461,
299
+ 30.345646127499304
300
+ ],
301
+ "covers": 39,
302
+ "cover_share": 0.054317548746518104
303
+ },
304
+ {
305
+ "hex": "#42447D",
306
+ "rgb": [
307
+ 66,
308
+ 68,
309
+ 125
310
+ ],
311
+ "lab": [
312
+ 31.210866845156875,
313
+ 15.538195099965728,
314
+ -32.86492985927444
315
+ ],
316
+ "covers": 30,
317
+ "cover_share": 0.04178272980501393
318
+ },
319
+ {
320
+ "hex": "#C7A23D",
321
+ "rgb": [
322
+ 199,
323
+ 162,
324
+ 61
325
+ ],
326
+ "lab": [
327
+ 68.29503886052275,
328
+ 2.977979669534846,
329
+ 55.66603687643949
330
+ ],
331
+ "covers": 21,
332
+ "cover_share": 0.02924791086350975
333
+ }
334
+ ]
335
+ }
homepage-assets/music/last-tide/last-tide-master.png ADDED

Git LFS Details

  • SHA256: dad13997d297088dfd0c82d7e40e6efd16a3245fcfc9a7041394fdec237155f2
  • Pointer size: 134 Bytes
  • Size of remote file: 432 MB
homepage-assets/music/last-tide/last-tide-preview.jpg ADDED

Git LFS Details

  • SHA256: b2cdd9eac18b611b7fdd4a1715b57a4fd239bd63895bbce1cce2e67a082792ac
  • Pointer size: 132 Bytes
  • Size of remote file: 5 MB
homepage-assets/music/last-tide/last-tide-toned-preview.jpg ADDED

Git LFS Details

  • SHA256: fa703b7163cc57e7cd90bbf5cc9a3b5104753c57a17646c1bdaee7b1382d7e39
  • Pointer size: 133 Bytes
  • Size of remote file: 14.8 MB
homepage-assets/music/last-tide/last-tide-web.webp ADDED

Git LFS Details

  • SHA256: 02caddb919e3196108431e9d92d54080887fde56d377648d73dff21dfc70ea17
  • Pointer size: 132 Bytes
  • Size of remote file: 3.12 MB
homepage-assets/music/last-tide/layout.json ADDED
The diff for this file is too large to render. See raw diff
 
homepage-assets/music/last-tide/source-build-layout.py ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Low-repeat, area-balanced, variable-size album mosaic: preview only."""
2
+ import argparse
3
+ import json
4
+ import shutil
5
+ from collections import Counter, defaultdict
6
+
7
+ import numpy as np
8
+ from PIL import Image, ImageOps
9
+ from scipy.optimize import linear_sum_assignment, milp, Bounds, LinearConstraint
10
+
11
+ from build_photomosaic import ROOT, SRGB, SEED, source_library, descriptors
12
+
13
+ OUT = ROOT / 'varied-trial'
14
+ OUT.mkdir(exist_ok=True)
15
+ COLS, ROWS, UNIT = 144, 96, 24
16
+
17
+
18
+ def distance(a, b):
19
+ return np.hypot(a['x'] + a['size'] / 2 - b['x'] - b['size'] / 2,
20
+ a['y'] + a['size'] / 2 - b['y'] - b['size'] / 2)
21
+
22
+
23
+ if __name__ == '__main__':
24
+ parser = argparse.ArgumentParser()
25
+ parser.add_argument('--target', type=str, default=str(ROOT / 'photomosaic/target-painting.png'))
26
+ parser.add_argument('--output-dir', type=str, default='varied-trial')
27
+ parser.add_argument('--density', type=int, default=1, choices=[1, 2])
28
+ args = parser.parse_args()
29
+ COLS, ROWS = 144 * args.density, 96 * args.density
30
+ OUT = ROOT / args.output_dir
31
+ OUT.mkdir(parents=True, exist_ok=True)
32
+ shutil.copy2(args.target, OUT / 'target-painting.png')
33
+ manifest = json.loads((ROOT / 'manifest.json').read_text(encoding='utf-8'))
34
+ assets, images, features = source_library(manifest)
35
+ assert len(assets) == 718
36
+ rng = np.random.default_rng(SEED)
37
+ with Image.open(args.target) as original:
38
+ target = original.convert('RGB')
39
+ # A 12x12 patch can be filled by 9 large, 16 medium or 36 small covers.
40
+ # 53 large patches + 26 medium + 16 small + one mixed patch fill 144x96.
41
+ patches = []
42
+ for row in range(8 * args.density):
43
+ for col in range(12 * args.density):
44
+ x, y = col * 12, row * 12
45
+ area = target.crop((x / COLS * target.width, y / ROWS * target.height,
46
+ (x + 12) / COLS * target.width, (y + 12) / ROWS * target.height))
47
+ pixels = np.asarray(area.resize((24, 24)), dtype=float)
48
+ edge = np.abs(np.diff(pixels, axis=0)).mean() + np.abs(np.diff(pixels, axis=1)).mean()
49
+ # Keep finer pieces around the moon rim, horizon and pier.
50
+ center_x, center_y = (x + 6) / COLS, (y + 6) / ROWS
51
+ edge += 8 * np.exp(-((center_x - .36) / .08) ** 2 - ((center_y - .64) / .13) ** 2)
52
+ patches.append({'x': x, 'y': y, 'detail': float(edge) + rng.uniform(0, .02)})
53
+ factor = args.density ** 2
54
+ ranking = sorted(range(len(patches)), key=lambda i: -patches[i]['detail'])
55
+ small_patches = set(ranking[:16 * factor])
56
+ medium_patches = set(ranking[16 * factor:42 * factor])
57
+ mixed_patches = set(ranking[42 * factor:43 * factor])
58
+ slots = []
59
+ for i, patch in enumerate(patches):
60
+ if i in mixed_patches:
61
+ for dx in range(0, 12, 4):
62
+ slots.append({'x': patch['x'] + dx, 'y': patch['y'], 'size': 4})
63
+ for dy in range(4, 12, 2):
64
+ for dx in range(0, 12, 2):
65
+ slots.append({'x': patch['x'] + dx, 'y': patch['y'] + dy, 'size': 2})
66
+ continue
67
+ size = 2 if i in small_patches else 3 if i in medium_patches else 4
68
+ for dy in range(0, 12, size):
69
+ for dx in range(0, 12, size):
70
+ slots.append({'x': patch['x'] + dx, 'y': patch['y'] + dy, 'size': size})
71
+ assert Counter(s['size'] for s in slots) == {2: 600 * factor, 3: 416 * factor, 4: 480 * factor}
72
+ # These size packages constrain BOTH counts and total screen area per file:
73
+ # 480 files: 2+4 (20 area units); 178 files: 3+3 (18); 60 files: 2+2+3 (17).
74
+ # Larger pieces lean toward quieter sources, with a little deterministic jitter.
75
+ order = np.argsort(features[:, 0] + rng.normal(0, 8, len(assets)))
76
+ token_sources = {2: [], 3: [], 4: []}
77
+ packages = {}
78
+ if factor == 4:
79
+ combinations = [(a, b, c) for a in range(10) for b in range(10) for c in range(10)
80
+ if a+b+c in (8, 9) and 72 <= 4*a+9*b+16*c <= 80]
81
+ matrix = np.array([[1, a, b, c] for a, b, c in combinations], dtype=float).T
82
+ costs = np.array([(4*a+9*b+16*c-77)**2+.01*(a+b+c == 9) for a,b,c in combinations])
83
+ solution = milp(costs, integrality=np.ones(len(combinations)), bounds=Bounds(0, np.inf),
84
+ constraints=LinearConstraint(matrix, [718, 2400, 1664, 1920], [718, 2400, 1664, 1920]))
85
+ assert solution.success, solution.message
86
+ all_packages = []
87
+ for (a,b,c), amount in zip(combinations, np.rint(solution.x).astype(int)):
88
+ all_packages.extend([[2]*a+[3]*b+[4]*c for _ in range(amount)])
89
+ all_packages.sort(key=lambda p: (-p.count(4), p.count(2)))
90
+ else:
91
+ all_packages = [[2,4]]*480 + [[3,3]]*178 + [[2,2,3]]*60
92
+ for rank, source_index in enumerate(order):
93
+ package = all_packages[rank]
94
+ packages[int(source_index)] = package
95
+ for size in package:
96
+ token_sources[size].append(int(source_index))
97
+ # Each slot matches the same painting area it will actually occupy.
98
+ slot_features = []
99
+ for slot in slots:
100
+ x, y, size = slot['x'], slot['y'], slot['size']
101
+ area = target.crop((x / COLS * target.width, y / ROWS * target.height,
102
+ (x + size) / COLS * target.width, (y + size) / ROWS * target.height))
103
+ small = np.asarray(area.resize((4, 4), Image.Resampling.BOX), dtype=float)
104
+ slot_features.append(descriptors(small[None, ...])[0])
105
+ slot_features = np.array(slot_features)
106
+ assignments = np.zeros(len(slots), dtype=int)
107
+ slot_cost = {}
108
+ for size in [2, 3, 4]:
109
+ ids = np.array([i for i, slot in enumerate(slots) if slot['size'] == size])
110
+ sources = np.array(token_sources[size])
111
+ a = slot_features[ids]
112
+ b = features[sources]
113
+ cost = (a * a).sum(axis=1)[:, None] + (b * b).sum(axis=1)[None, :] - 2 * a @ b.T
114
+ cost += rng.uniform(0, .05, cost.shape)
115
+ row_ids, token_ids = linear_sum_assignment(cost)
116
+ assignments[ids[row_ids]] = sources[token_ids]
117
+ for i in ids:
118
+ delta = features - slot_features[i]
119
+ slot_cost[int(i)] = (delta * delta).sum(axis=1)
120
+ print('Matched', len(ids), 'tiles of size', size, flush=True)
121
+ # Separate identical artwork, including duplicate CDN files, by swapping
122
+ # only same-size pieces, preserving every source's area and usage quota.
123
+ hashes = [a['sha256'] for a in assets]
124
+ positions = defaultdict(set)
125
+ for i, source_index in enumerate(assignments):
126
+ positions[hashes[source_index]].add(i)
127
+ min_spacing = 9.0
128
+ for iteration in range(8):
129
+ swaps = 0
130
+ for i in rng.permutation(len(slots)):
131
+ i = int(i)
132
+ source_a = int(assignments[i]); hash_a = hashes[source_a]
133
+ if all(distance(slots[i], slots[k]) >= min_spacing for k in positions[hash_a] if k != i):
134
+ continue
135
+ best = None
136
+ candidates = [j for j, slot in enumerate(slots) if slot['size'] == slots[i]['size']]
137
+ if factor > 1 and len(candidates) > 512:
138
+ candidates = rng.choice(candidates, 512, replace=False)
139
+ for j in candidates:
140
+ j = int(j)
141
+ slot = slots[j]
142
+ source_b = int(assignments[j]); hash_b = hashes[source_b]
143
+ if slot['size'] != slots[i]['size'] or hash_a == hash_b:
144
+ continue
145
+ if any(distance(slot, slots[k]) < min_spacing for k in positions[hash_a] if k != i):
146
+ continue
147
+ if any(distance(slots[i], slots[k]) < min_spacing for k in positions[hash_b] if k != j):
148
+ continue
149
+ delta = slot_cost[i][source_b] + slot_cost[j][source_a] - slot_cost[i][source_a] - slot_cost[j][source_b]
150
+ if best is None or delta < best[0]:
151
+ best = (delta, j, source_b, hash_b)
152
+ if best is not None:
153
+ _, j, source_b, hash_b = best
154
+ assignments[i], assignments[j] = source_b, source_a
155
+ positions[hash_a].remove(i); positions[hash_a].add(j)
156
+ positions[hash_b].remove(j); positions[hash_b].add(i)
157
+ swaps += 1
158
+ print('Spacing pass', iteration + 1, 'swaps', swaps, flush=True)
159
+ if not swaps:
160
+ break
161
+ occupancy = np.zeros((ROWS, COLS), dtype=int)
162
+ counts, areas = Counter(), Counter()
163
+ for i, slot in enumerate(slots):
164
+ x, y, size = slot['x'], slot['y'], slot['size']
165
+ occupancy[y:y + size, x:x + size] += 1
166
+ source = int(assignments[i]); counts[source] += 1; areas[source] += size ** 2
167
+ slot['source_index'] = source
168
+ assert np.all(occupancy == 1), 'Gap or overlap.'
169
+ assert len(counts) == len(assets) == 718
170
+ assert (min(counts.values()), max(counts.values())) == ((2,3) if factor == 1 else (8,9))
171
+ assert all(72 <= a <= 80 for a in areas.values()) if factor > 1 else set(areas.values()) == {17,18,20}
172
+ closest = min(distance(slots[a], slots[b]) for group in positions.values()
173
+ for a in group for b in group if a < b)
174
+ assert closest >= min_spacing
175
+ report = {'status': 'preview only', 'source_files_used': len(counts),
176
+ 'distinct_image_contents': len(positions), 'tiles': len(slots),
177
+ 'usage_min': min(counts.values()), 'usage_max': max(counts.values()),
178
+ 'source_files_used_twice': sum(n == 2 for n in counts.values()),
179
+ 'source_files_used_three_times': sum(n == 3 for n in counts.values()),
180
+ 'usage_histogram': dict(Counter(counts.values())),
181
+ 'per_source_area_min': min(areas.values()), 'per_source_area_max': max(areas.values()),
182
+ 'per_source_area_ratio': max(areas.values()) / min(areas.values()),
183
+ 'tile_side_sizes': [2, 3, 4], 'largest_to_smallest_side': 2,
184
+ 'minimum_identical_image_center_spacing': float(closest),
185
+ 'grid_width': COLS, 'grid_height': ROWS, 'preview_unit_pixels': UNIT,
186
+ 'preview_width': COLS * UNIT, 'preview_height': ROWS * UNIT,
187
+ 'gaps': 0, 'overlaps': 0, 'target_overlay': False, 'cover_recoloring': False}
188
+ plan = {**report, 'sources': [{**a, 'count': counts[i], 'total_area': areas[i],
189
+ 'sizes': packages[i]} for i, a in enumerate(assets)], 'positions': slots}
190
+ (OUT / 'layout.json').write_text(json.dumps(plan, ensure_ascii=False, indent=2), encoding='utf-8')
191
+ (OUT / 'validation.json').write_text(json.dumps(report, ensure_ascii=False, indent=2), encoding='utf-8')
192
+ canvas = Image.new('RGB', (COLS * UNIT, ROWS * UNIT))
193
+ resized = {}
194
+ for slot in slots:
195
+ source, size = slot['source_index'], slot['size']
196
+ key = (source, size)
197
+ if key not in resized:
198
+ resized[key] = Image.fromarray(images[source]).resize((size * UNIT, size * UNIT), Image.Resampling.LANCZOS)
199
+ canvas.paste(resized[key], (slot['x'] * UNIT, slot['y'] * UNIT))
200
+ canvas.save(OUT / 'varied-size-preview.png', icc_profile=SRGB)
201
+ canvas.save(OUT / 'varied-size-preview.jpg', quality=97, icc_profile=SRGB)
202
+ print(json.dumps(report), flush=True)
homepage-assets/music/last-tide/source-cover-helpers.py ADDED
@@ -0,0 +1,193 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Rebuild a complete painting using equal-size, unchanged album-cover tiles.
2
+
3
+ All 878 playlist entries must occur; album images may repeat. Every tile has
4
+ exactly the same dimensions and fills one cell in an uninterrupted grid.
5
+ The target painting is used for matching only, never blended into the output.
6
+ """
7
+ import argparse
8
+ import hashlib
9
+ import json
10
+ import shutil
11
+ from pathlib import Path
12
+
13
+ import numpy as np
14
+ from PIL import Image, ImageCms, ImageOps, PngImagePlugin
15
+ from scipy.spatial import cKDTree
16
+
17
+ ROOT = Path(__file__).resolve().parent
18
+ SRGB = ImageCms.ImageCmsProfile(ImageCms.createProfile('sRGB')).tobytes()
19
+
20
+
21
+ def read_cover(path, limit):
22
+ with Image.open(path) as original:
23
+ if original.format == 'JPEG':
24
+ original.draft('RGB', (limit, limit))
25
+ image = ImageOps.exif_transpose(original)
26
+ if image.mode in ('RGBA', 'LA') or 'transparency' in image.info:
27
+ rgba = image.convert('RGBA')
28
+ image = Image.new('RGBA', rgba.size, (7, 9, 14, 255))
29
+ image.alpha_composite(rgba)
30
+ image = image.convert('RGB')
31
+ image.thumbnail((limit, limit), Image.Resampling.LANCZOS)
32
+ return image.copy()
33
+
34
+
35
+ def lab(rgb):
36
+ value = np.asarray(rgb, dtype=float) / 255
37
+ value = np.where(value > .04045, ((value + .055) / 1.055) ** 2.4, value / 12.92)
38
+ xyz = value @ np.array([[.4124564, .2126729, .0193339],
39
+ [.3575761, .7151522, .1191920],
40
+ [.1804375, .0721750, .9503041]])
41
+ xyz = xyz / np.array([.95047, 1, 1.08883])
42
+ f = np.where(xyz > .008856, np.cbrt(xyz), 7.787 * xyz + 16 / 116)
43
+ return np.stack([116 * f[..., 1] - 16, 500 * (f[..., 0] - f[..., 1]),
44
+ 200 * (f[..., 1] - f[..., 2])], axis=-1)
45
+
46
+ OUT = ROOT / 'photomosaic'
47
+ OUT.mkdir(exist_ok=True)
48
+ COLS, ROWS, TILE = 240, 160, 125
49
+ WIDTH, HEIGHT = COLS * TILE, ROWS * TILE
50
+ SEED = 8114560070
51
+ TITLE = '最后一声之后 / After the Last Note'
52
+ Image.MAX_IMAGE_PIXELS = 900_000_000
53
+
54
+
55
+ def descriptors(rgb_patches):
56
+ """Match average tone first, with a small weight on the 2x2 structure."""
57
+ mean = rgb_patches.mean(axis=(-3, -2))
58
+ quadrants = rgb_patches.reshape(-1, 2, 2, 2, 2, 3).mean(axis=(2, 4))
59
+ avg = lab(mean) * np.array([1.5, 1.0, 1.0])
60
+ structure = lab(quadrants).reshape(-1, 12) * .17
61
+ return np.concatenate([avg, structure], axis=1)
62
+
63
+
64
+ def source_library(manifest):
65
+ images, small, assets = [], [], []
66
+ for i, (url, asset) in enumerate(manifest['assets'].items()):
67
+ image = read_cover(ROOT / asset['file'], TILE)
68
+ image = ImageOps.contain(image, (TILE, TILE), method=Image.Resampling.LANCZOS)
69
+ tile = Image.new('RGB', (TILE, TILE), '#070b10')
70
+ tile.paste(image, ((TILE - image.width) // 2, (TILE - image.height) // 2))
71
+ images.append(np.asarray(tile).copy())
72
+ small.append(np.asarray(tile.resize((4, 4), Image.Resampling.BOX), dtype=float))
73
+ assets.append({'cover_url': url, **asset})
74
+ if (i + 1) % 200 == 0:
75
+ print('Prepared', i + 1, 'equal-size source tiles', flush=True)
76
+ return assets, images, descriptors(np.array(small))
77
+
78
+
79
+ def make_plan(manifest, target, assets, source_features):
80
+ with Image.open(target) as painting:
81
+ assert painting.width * 2 == painting.height * 3, 'Target must be 3:2.'
82
+ small = np.asarray(painting.convert('RGB').resize((COLS * 4, ROWS * 4), Image.Resampling.BOX), dtype=float)
83
+ patches = small.reshape(ROWS, 4, COLS, 4, 3).transpose(0, 2, 1, 3, 4).reshape(-1, 4, 4, 3)
84
+ target_features = descriptors(patches)
85
+ rng = np.random.default_rng(SEED)
86
+ library = cKDTree(source_features)
87
+ distances, candidates = library.query(target_features, k=24)
88
+ indices = np.empty(COLS * ROWS, dtype=np.int32)
89
+ # Local diversity reduces repetitive blocks while preserving tonal fidelity.
90
+ for i in range(len(indices)):
91
+ choices = candidates[i]
92
+ costs = distances[i] ** 2
93
+ if i % COLS:
94
+ costs = costs + (choices == indices[i - 1]) * 90
95
+ if i >= COLS:
96
+ costs = costs + (choices == indices[i - COLS]) * 90
97
+ if i >= COLS + 1 and i % COLS:
98
+ costs = costs + (choices == indices[i - COLS - 1]) * 25
99
+ costs = costs + rng.uniform(0, 10, len(choices))
100
+ indices[i] = choices[np.argmin(costs)]
101
+
102
+ url_to_asset = {a['cover_url']: i for i, a in enumerate(assets)}
103
+ target_tree = cKDTree(target_features)
104
+ reserved = set()
105
+ required = []
106
+ # Place unusual colors first so that all source images have a good location.
107
+ rarity = np.linalg.norm(source_features[:, :3] - np.median(target_features[:, :3], axis=0), axis=1)
108
+ required_tracks = sorted(manifest['tracks'], key=lambda t: -rarity[url_to_asset[t['cover_url']]])
109
+ for track in required_tracks:
110
+ source_index = url_to_asset[track['cover_url']]
111
+ _, nearest = target_tree.query(source_features[source_index], k=4096)
112
+ options = [int(n) for n in nearest if int(n) not in reserved]
113
+ assert options, 'No mandatory tile position available.'
114
+ # Select among equally suitable pixels, spreading repeated album entries.
115
+ options = options[:24]
116
+ selected = options[int(rng.integers(min(8, len(options))))]
117
+ reserved.add(selected)
118
+ indices[selected] = source_index
119
+ required.append({'song_id': track['song_id'], 'song': track['song'],
120
+ 'artists': track['artists'], 'album': track['album'],
121
+ 'source_index': source_index, 'row': selected // COLS, 'column': selected % COLS})
122
+
123
+ used = set(indices.tolist())
124
+ assert used == set(range(len(assets))), 'A source cover is missing.'
125
+ assert len(required) == len({t['song_id'] for t in required}) == manifest['song_count']
126
+ assert len(reserved) == manifest['song_count']
127
+ counts = np.bincount(indices, minlength=len(assets))
128
+ for i, asset in enumerate(assets):
129
+ asset['tile_count'] = int(counts[i])
130
+ report = {'title': TITLE, 'width': WIDTH, 'height': HEIGHT, 'columns': COLS,
131
+ 'rows': ROWS, 'tile_width': TILE, 'tile_height': TILE, 'tiles': len(indices),
132
+ 'source_cover_files': len(assets), 'source_files_used': len(used),
133
+ 'playlist_songs': len(required), 'songs_placed': len(required),
134
+ 'missing_songs': 0, 'missing_covers': 0, 'equal_tile_size': True,
135
+ 'gaps': 0, 'overlaps': 0, 'target_overlay': False, 'cover_recoloring': False,
136
+ 'seed': SEED}
137
+ plan = {**report, 'source_assets': assets, 'required_song_positions': required,
138
+ 'tile_source_indices': indices.reshape(ROWS, COLS).tolist(),
139
+ 'policy': 'Each cell is a complete original cover, uniformly resized and contained. '
140
+ 'No gaps, variable sizes, target blend, tints or generated cover imagery.'}
141
+ (OUT / 'mosaic-layout.json').write_text(json.dumps(plan, ensure_ascii=False, indent=2) + '\n', encoding='utf-8')
142
+ (OUT / 'validation.json').write_text(json.dumps(report, ensure_ascii=False, indent=2) + '\n', encoding='utf-8')
143
+ print('Photomosaic checked:', json.dumps(report, ensure_ascii=True), flush=True)
144
+ return indices
145
+
146
+
147
+ def render(indices, source_images, preview=False):
148
+ size = 12 if preview else TILE
149
+ images = []
150
+ for array in source_images:
151
+ image = Image.fromarray(array)
152
+ if preview:
153
+ image = image.resize((size, size), Image.Resampling.LANCZOS)
154
+ images.append(image)
155
+ canvas = Image.new('RGB', (COLS * size, ROWS * size))
156
+ for row in range(ROWS):
157
+ for col in range(COLS):
158
+ canvas.paste(images[indices[row * COLS + col]], (col * size, row * size))
159
+ if (row + 1) % 40 == 0:
160
+ print('Composed', row + 1, 'of', ROWS, 'rows', flush=True)
161
+ if preview:
162
+ canvas.save(OUT / 'after-the-last-note-preview.jpg', quality=97, icc_profile=SRGB)
163
+ else:
164
+ metadata = PngImagePlugin.PngInfo()
165
+ metadata.add_text('Title', TITLE)
166
+ metadata.add_text('Description', '38400 equal-sized album-cover tiles, 718 sources, '
167
+ 'all 878 playlist entries represented; no target-image overlay.')
168
+ print('Encoding 600-megapixel lossless PNG...', flush=True)
169
+ path = OUT / 'after-the-last-note-master.png'
170
+ canvas.save(path, format='PNG', pnginfo=metadata, icc_profile=SRGB, compress_level=6)
171
+ for size, name, quality in [(4096, 'after-the-last-note-web.webp', 95),
172
+ (8192, 'after-the-last-note-detail.webp', 96),
173
+ (3000, 'after-the-last-note-preview.jpg', 97)]:
174
+ image = canvas.resize((size, round(size * ROWS / COLS)), Image.Resampling.LANCZOS)
175
+ image.save(OUT / name, quality=quality, icc_profile=SRGB)
176
+ image.close()
177
+ print('Saved', name, flush=True)
178
+ print('Saved master:', round(path.stat().st_size / 1024 ** 2, 1), 'MiB', flush=True)
179
+ canvas.close()
180
+
181
+
182
+ if __name__ == '__main__':
183
+ parser = argparse.ArgumentParser()
184
+ parser.add_argument('--target', type=Path, required=True)
185
+ parser.add_argument('--full', action='store_true')
186
+ args = parser.parse_args()
187
+ painting = OUT / 'target-painting.png'
188
+ if args.target.resolve() != painting.resolve():
189
+ shutil.copy2(args.target, painting)
190
+ manifest = json.loads((ROOT / 'manifest.json').read_text(encoding='utf-8'))
191
+ assets, images, source_features = source_library(manifest)
192
+ indices = make_plan(manifest, painting, assets, source_features)
193
+ render(indices, images, preview=not args.full)
homepage-assets/music/last-tide/source-manifest.json ADDED
The diff for this file is too large to render. See raw diff
 
homepage-assets/music/last-tide/source-render-verify.py ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Render and verify the complete low-repeat mosaic from original cover files."""
2
+ import hashlib
3
+ import json
4
+ import sys
5
+ from functools import lru_cache
6
+ from pathlib import Path
7
+ from collections import Counter
8
+ import numpy as np
9
+ from PIL import Image, ImageOps
10
+ from build_photomosaic import ROOT, SRGB, read_cover
11
+
12
+ OUT = ROOT / ('last-tide-dense' if '--dense' in sys.argv else 'last-tide')
13
+ UNIT = 80 if '--dense' in sys.argv else 160
14
+ Image.MAX_IMAGE_PIXELS = 600_000_000
15
+
16
+ @lru_cache(maxsize=1500)
17
+ def original_tile(filename, side):
18
+ original = read_cover(ROOT / filename, side)
19
+ tile = Image.new('RGB', (side, side), '#070b10')
20
+ tile.paste(original, ((side-original.width)//2, (side-original.height)//2))
21
+ return tile
22
+
23
+ def tile_for(source, side, target_rgb=None):
24
+ tile = original_tile(source['file'], side)
25
+ if target_rgb is not None:
26
+ pixels = np.asarray(tile, dtype=np.float32)
27
+ average = pixels.mean(axis=(0, 1))
28
+ # A constant per-channel shift and contrast adjustment per whole tile.
29
+ # No target silhouettes or texture are composited over cover details.
30
+ pixels = (pixels - average) * .45 + np.asarray(target_rgb, dtype=np.float32)
31
+ tile = Image.fromarray(np.clip(np.rint(pixels), 0, 255).astype(np.uint8))
32
+ return tile
33
+
34
+ if __name__ == '__main__':
35
+ plan = json.loads((OUT / 'layout.json').read_text(encoding='utf-8'))
36
+ sources = plan['sources']
37
+ with Image.open(OUT / 'target-painting.png') as image:
38
+ target = image.convert('RGB')
39
+ for slot in plan['positions']:
40
+ x, y, size = slot['x'], slot['y'], slot['size']
41
+ patch = target.crop((x/plan['grid_width']*target.width, y/plan['grid_height']*target.height,
42
+ (x+size)/plan['grid_width']*target.width, (y+size)/plan['grid_height']*target.height))
43
+ slot['target_rgb'] = np.asarray(patch, dtype=float).mean(axis=(0, 1)).tolist()
44
+ plan['cover_recoloring'] = True
45
+ plan['tone_recipe'] = 'Per-tile constant RGB mean transfer with source contrast factor 0.45; rounded/clipped to 8-bit RGB. No target detail overlay.'
46
+ (OUT / 'layout.json').write_text(json.dumps(plan, ensure_ascii=False, indent=2), encoding='utf-8')
47
+ preview = Image.new('RGB', (plan['grid_width']*24, plan['grid_height']*24))
48
+ for slot in plan['positions']:
49
+ tile = tile_for(sources[slot['source_index']], slot['size']*24, slot['target_rgb'])
50
+ preview.paste(tile, (slot['x']*24, slot['y']*24))
51
+ preview.save(OUT / 'last-tide-toned-preview.jpg', quality=97, icc_profile=SRGB)
52
+ if '--preview-only' in sys.argv:
53
+ print('Toned preview saved', flush=True)
54
+ raise SystemExit(0)
55
+ original_tile.cache_clear()
56
+ width, height = plan['grid_width'] * UNIT, plan['grid_height'] * UNIT
57
+ for source in sources:
58
+ assert hashlib.sha256((ROOT / source['file']).read_bytes()).hexdigest() == source['sha256']
59
+ canvas = Image.new('RGB', (width, height))
60
+ counts = Counter()
61
+ occupancy = np.zeros((plan['grid_height'], plan['grid_width']), dtype=np.uint8)
62
+ for i, slot in enumerate(plan['positions']):
63
+ index, size, x, y = slot['source_index'], slot['size'], slot['x'], slot['y']
64
+ tile = tile_for(sources[index], size * UNIT, slot['target_rgb'])
65
+ canvas.paste(tile, (x * UNIT, y * UNIT))
66
+ counts[index] += 1
67
+ occupancy[y:y+size, x:x+size] += 1
68
+ if (i+1) % 300 == 0:
69
+ print('Rendered', i+1, flush=True)
70
+ assert len(counts) == 718 and min(counts.values()) == plan['usage_min'] and max(counts.values()) == plan['usage_max']
71
+ assert np.all(occupancy == 1)
72
+ master = OUT / 'last-tide-master.png'
73
+ print('Saving lossless master', width, height, flush=True)
74
+ canvas.save(master, icc_profile=SRGB, compress_level=6)
75
+ canvas.thumbnail((4096, 4096), Image.Resampling.LANCZOS)
76
+ canvas.save(OUT / 'last-tide-web.webp', quality=92, method=6, icc_profile=SRGB)
77
+ canvas.save(OUT / 'last-tide-preview.jpg', quality=95, icc_profile=SRGB)
78
+ del canvas
79
+ print('Verifying actual saved master pixels', flush=True)
80
+ with Image.open(master) as saved:
81
+ assert saved.size == (width, height)
82
+ saved.load()
83
+ for slot in plan['positions']:
84
+ index, size, x, y = slot['source_index'], slot['size'], slot['x'], slot['y']
85
+ expected = tile_for(sources[index], size * UNIT, slot['target_rgb'])
86
+ actual = saved.crop((x*UNIT, y*UNIT, (x+size)*UNIT, (y+size)*UNIT))
87
+ assert actual.tobytes() == expected.tobytes(), slot
88
+ report = json.loads((OUT / 'validation.json').read_text(encoding='utf-8'))
89
+ report.update(status='verified lossless master', cover_recoloring=True, tone_recipe=plan['tone_recipe'], master_width=width, master_height=height,
90
+ master_unit_pixels=UNIT, source_hashes_verified=718,
91
+ actual_source_files_pixel_verified=718, actual_tiles_pixel_verified=len(plan['positions']),
92
+ master_sha256=hashlib.sha256(master.read_bytes()).hexdigest(), master_bytes=master.stat().st_size)
93
+ (OUT / 'validation.json').write_text(json.dumps(report, ensure_ascii=False, indent=2), encoding='utf-8')
94
+ checksums = {p.name: {'bytes': p.stat().st_size, 'sha256': hashlib.sha256(p.read_bytes()).hexdigest()}
95
+ for p in OUT.iterdir() if p.is_file() and p.name != 'checksums.json'}
96
+ (OUT / 'checksums.json').write_text(json.dumps(checksums, indent=2), encoding='utf-8')
97
+ print(json.dumps(report), flush=True)
homepage-assets/music/last-tide/target-color-check.json ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "target_size": [
3
+ 1536,
4
+ 1024
5
+ ],
6
+ "source_mean_rgb": [
7
+ 116.49326607111769,
8
+ 104.2899421543132,
9
+ 100.03276176771413
10
+ ],
11
+ "target_mean_rgb": [
12
+ 111.97556813557942,
13
+ 103.25661977132161,
14
+ 100.53623453776042
15
+ ],
16
+ "note": "Nearest source CIELAB centroid classification; approximate palette comparison, not exact histogram matching. Pixel and block-average comparisons have different grains.",
17
+ "pixel_comparison": [
18
+ {
19
+ "hex": "#151011",
20
+ "source_share": 0.21443231524199163,
21
+ "target_share": 0.07251485188802083
22
+ },
23
+ {
24
+ "hex": "#E9E9E6",
25
+ "source_share": 0.15534790379091226,
26
+ "target_share": 0.016283671061197918
27
+ },
28
+ {
29
+ "hex": "#333439",
30
+ "source_share": 0.13393969522545265,
31
+ "target_share": 0.1855646769205729
32
+ },
33
+ {
34
+ "hex": "#A3A6AB",
35
+ "source_share": 0.13307772240598886,
36
+ "target_share": 0.24018096923828125
37
+ },
38
+ {
39
+ "hex": "#64655D",
40
+ "source_share": 0.1183510782990947,
41
+ "target_share": 0.39098866780598956
42
+ },
43
+ {
44
+ "hex": "#BA9D6B",
45
+ "source_share": 0.0654194866382312,
46
+ "target_share": 0.05204010009765625
47
+ },
48
+ {
49
+ "hex": "#7D342B",
50
+ "source_share": 0.05777496082869081,
51
+ "target_share": 0.042241414388020836
52
+ },
53
+ {
54
+ "hex": "#D5362A",
55
+ "source_share": 0.04855304176096797,
56
+ "target_share": 5.086263020833333e-06
57
+ },
58
+ {
59
+ "hex": "#444E92",
60
+ "source_share": 0.04551386501131616,
61
+ "target_share": 0.00018056233723958334
62
+ },
63
+ {
64
+ "hex": "#D7BE32",
65
+ "source_share": 0.02758993079735376,
66
+ "target_share": 0.0
67
+ }
68
+ ],
69
+ "block_average_comparison": [
70
+ {
71
+ "hex": "#6A6E72",
72
+ "source_share": 0.22284122562674094,
73
+ "target_share": 0.46484375
74
+ },
75
+ {
76
+ "hex": "#BDBBBB",
77
+ "source_share": 0.19498607242339833,
78
+ "target_share": 0.11458333333333333
79
+ },
80
+ {
81
+ "hex": "#483D36",
82
+ "source_share": 0.1713091922005571,
83
+ "target_share": 0.2727864583333333
84
+ },
85
+ {
86
+ "hex": "#907A60",
87
+ "source_share": 0.14345403899721448,
88
+ "target_share": 0.10416666666666667
89
+ },
90
+ {
91
+ "hex": "#261D20",
92
+ "source_share": 0.14206128133704735,
93
+ "target_share": 0.036458333333333336
94
+ },
95
+ {
96
+ "hex": "#A92E2E",
97
+ "source_share": 0.054317548746518104,
98
+ "target_share": 0.0
99
+ },
100
+ {
101
+ "hex": "#42447D",
102
+ "source_share": 0.04178272980501393,
103
+ "target_share": 0.007161458333333333
104
+ },
105
+ {
106
+ "hex": "#C7A23D",
107
+ "source_share": 0.02924791086350975,
108
+ "target_share": 0.0
109
+ }
110
+ ]
111
+ }
homepage-assets/music/last-tide/target-edit-prompt.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ Edit the first supplied painting, using the SECOND supplied image only as measured palette guidance. Keep the same meaningful composition: lone long-coated person at the pier, immense quiet sea, moon, mountains, abandoned harbor; keep serious oil painting, solitude and inevitability, horizontal 3:2. The current painting is excessively muddy and too dark: measured mean RGB96,88,83 instead of desired116,104,100. Make the scene substantially lighter and more tonally structured, NOT by adding a bright sunset. Follow the LOWER strip of the palette-reference for large-area colors:22%steelgray #6A6E72,20%palegray #BDBBBB,17%darkumber #483D36,14%warmbrown #907A60,14%nearblack #261D20,5%rustred #A92E2E,4%blueviolet #42447D,3%ochre #C7A23D. Important spatial corrections: turn the upper-left mist and an extensive diagonal reflection into a broad pale gray area, collectively around20% canvas rather than the current5%; leave22%middle steelgray. Concentrate very deep shadows on the pier and person,14%; change some muddy mountain masses into cleaner pale distant mountains to reduce excessive darkbrown. Expand weathered warmer brown timber and foreground stone to14%canvas. Make the right abandoned harbor facades recognizably rusty RED rather than barely brown, with red water reflections totaling5%canvas. Make a clearly blue-violet, still subdued but visibly colored broad lower-right water area4%. Ochre3%as a contained path/horizon reflection, not a fiery sky. These are essential visible color zones, don't desaturate all accents to gray. Preserve atmospheric solemnity through composition, not by globally darkening or washing out all color. Broad readable forms, no small fussy scenery. No graphics, letters, swatches, rainbow gradients or collage. Do not include the palette guide in the output.
homepage-assets/music/last-tide/target-painting.png ADDED

Git LFS Details

  • SHA256: 4582a4654105d9a44cfe01f60ddc28c121efa85f0097a079b67797c22c7e5313
  • Pointer size: 132 Bytes
  • Size of remote file: 3.31 MB
homepage-assets/music/last-tide/target-prompt.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ Use case: stylized-concept. Asset: an original complete fine-art target painting for an album-cover photomosaic, horizontal 3:2 landscape, edge-to-edge painting, no lettering or frame. Title concept: 'The Last Tide / 最后的潮汐'. Emotional direction: atmospheric solitude, inevitability, the lingering emptiness after the final note of a concert; restrained, solemn, spacious, meaningful. IMPORTANT: the palette comes from quantitative analysis of 718 equally weighted album covers. Approximate AREA distribution of large-scale perceived color must follow these measured cover-average groups: 22.3% quiet steel gray #6A6E72; 19.5% pale muted gray #BDBBBB; 17.1% dark umber #483D36; 14.3% weathered warm brown #907A60; 14.2% near-black plum-charcoal #261D20; 5.4% rusty restrained red #A92E2E; 4.2% subdued deep blue-violet #42447D; 2.9% muted ochre #C7A23D. Overall average RGB should be near (116,104,100), a warm neutral midtone, NOT a predominantly dark-blue night painting. These percentages guide organic painterly areas, not colored rectangles. Most of the canvas should be gray and muted earth tones. Pale highlights must be soft gray rather than brilliant white; deep shadows must occupy only a contained portion, not engulf the canvas. Strong readable large silhouettes and broad tonal areas are needed because the final image uses only about 1500 variable-sized album-cover tiles. Scene: a lonely person in a long coat stands at the end of an old broad wooden pier on a still, immense sea, facing a pale muted-gray moon behind thin mist. Distant dark-umber coastal mountains and an abandoned rust-red harbor edge lie across the horizon. Gray cloud banks occupy the sky; the water is steel gray with traces of brown reflected shore, a broad muted pale-gray moonlight path, and a SMALL blue-violet region. Weathered brown wooden pier and coastal stone fill part of the foreground, with plum-charcoal shadow defining the person and the pier's silhouette. Faint ochre light survives along part of the horizon and water, never becoming a fiery sunset. Keep the human silhouette readable, about one fifth of picture height, and the moon and light path clearly shaped without tiny details. The scene should feel vast, hushed and slightly ominous, like a memory one cannot retrieve. Style: serious contemporary oil painting / album art, tactile expressive brushwork, natural atmospheric haze, simple powerful forms, sophisticated warm-cool balance within the specified palette. No collage, album covers, swatches, graphics, captions, bright neon, rainbow colors, cheerful fantasy, extra people or excessive small stars. Create a coherent meaningful painting with the measured palette woven throughout.
homepage-assets/music/last-tide/validation.json ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "status": "verified lossless master",
3
+ "source_files_used": 718,
4
+ "distinct_image_contents": 676,
5
+ "tiles": 5984,
6
+ "usage_min": 8,
7
+ "usage_max": 9,
8
+ "source_files_used_twice": 0,
9
+ "source_files_used_three_times": 0,
10
+ "usage_histogram": {
11
+ "8": 478,
12
+ "9": 240
13
+ },
14
+ "per_source_area_min": 76,
15
+ "per_source_area_max": 78,
16
+ "per_source_area_ratio": 1.0263157894736843,
17
+ "tile_side_sizes": [
18
+ 2,
19
+ 3,
20
+ 4
21
+ ],
22
+ "largest_to_smallest_side": 2,
23
+ "minimum_identical_image_center_spacing": 9.0,
24
+ "grid_width": 288,
25
+ "grid_height": 192,
26
+ "preview_unit_pixels": 24,
27
+ "preview_width": 6912,
28
+ "preview_height": 4608,
29
+ "gaps": 0,
30
+ "overlaps": 0,
31
+ "target_overlay": false,
32
+ "cover_recoloring": true,
33
+ "tone_recipe": "Per-tile constant RGB mean transfer with source contrast factor 0.45; rounded/clipped to 8-bit RGB. No target detail overlay.",
34
+ "master_width": 23040,
35
+ "master_height": 15360,
36
+ "master_unit_pixels": 80,
37
+ "source_hashes_verified": 718,
38
+ "actual_source_files_pixel_verified": 718,
39
+ "actual_tiles_pixel_verified": 5984,
40
+ "master_sha256": "dad13997d297088dfd0c82d7e40e6efd16a3245fcfc9a7041394fdec237155f2",
41
+ "master_bytes": 432219739
42
+ }
homepage-assets/music/last-tide/varied-size-preview.jpg ADDED

Git LFS Details

  • SHA256: 2913c9188cbcf94bd819a410065e999ad6b223c1a534ed891941ba415169f3f2
  • Pointer size: 133 Bytes
  • Size of remote file: 21 MB
homepage-assets/music/last-tide/varied-size-preview.png ADDED

Git LFS Details

  • SHA256: f7b550554f6d1db429678fff9661e94e426a95dab63319a4a77a5a80d63a27c5
  • Pointer size: 133 Bytes
  • Size of remote file: 53 MB