admin commited on
Commit
c2612e1
·
1 Parent(s): b5e972d

add feature: output interpolation layers

Browse files
Files changed (1) hide show
  1. src/modules/link.py +14 -0
src/modules/link.py CHANGED
@@ -116,6 +116,7 @@ class UrlProcessor:
116
  qr_pngs = []
117
  card_htmls = []
118
  card_pngs = []
 
119
  index_path = 'index.html'
120
  css_path = 'style.css'
121
 
@@ -228,17 +229,29 @@ class UrlProcessor:
228
  size_py = int(df.loc[idx, 'SizePy'])
229
 
230
  if common_images:
 
231
  for common_img in common_images:
232
  layer = processor.combine_images(layer, common_img, size, (0, 0))
 
 
 
233
 
234
  if indv:
 
235
  layer = processor.combine_images(layer, indv, (size_x, size_y), (pos_x, pos_y))
 
 
 
236
 
237
  # if anno_txt:
238
  # layer = processor.combine_txt(layer, anno_txt, (size_px, size_py), (pos_px, pos_py))
239
 
240
  if qr:
 
241
  layer = processor.combine_images(layer, qr, (size_px, size_py), (pos_px, pos_py))
 
 
 
242
 
243
  card_png_path = f'img/cards/CD{idx:05d}.png'
244
  card_path = os.path.join(tmpd, card_png_path)
@@ -308,6 +321,7 @@ class UrlProcessor:
308
  zip_content_list = [
309
  json_output_path,
310
  markdown_output_path,
 
311
  *qr_svg_output_paths,
312
  *qr_png_output_paths,
313
  *card_svg_output_paths,
 
116
  qr_pngs = []
117
  card_htmls = []
118
  card_pngs = []
119
+ layer_output_paths = []
120
  index_path = 'index.html'
121
  css_path = 'style.css'
122
 
 
229
  size_py = int(df.loc[idx, 'SizePy'])
230
 
231
  if common_images:
232
+ os.makedirs(f'{tmpd}/img/layer/common', exist_ok=True)
233
  for common_img in common_images:
234
  layer = processor.combine_images(layer, common_img, size, (0, 0))
235
+ layer_path = os.path.join(tmpd, f'img/layer/common/CM{idx:05d}.png')
236
+ layer.save(layer_path, format="PNG")
237
+ layer_output_paths.append(layer_path)
238
 
239
  if indv:
240
+ os.makedirs(f'{tmpd}/img/layer/individual', exist_ok=True)
241
  layer = processor.combine_images(layer, indv, (size_x, size_y), (pos_x, pos_y))
242
+ layer_path = os.path.join(tmpd, f'img/layer/individual/ID{idx:05d}.png')
243
+ layer.save(layer_path, format="PNG")
244
+ layer_output_paths.append(layer_path)
245
 
246
  # if anno_txt:
247
  # layer = processor.combine_txt(layer, anno_txt, (size_px, size_py), (pos_px, pos_py))
248
 
249
  if qr:
250
+ os.makedirs(f'{tmpd}/img/layer/qr', exist_ok=True)
251
  layer = processor.combine_images(layer, qr, (size_px, size_py), (pos_px, pos_py))
252
+ layer_path = os.path.join(tmpd, f'img/layer/qr/QR{idx:05d}.png')
253
+ layer.save(layer_path, format="PNG")
254
+ layer_output_paths.append(layer_path)
255
 
256
  card_png_path = f'img/cards/CD{idx:05d}.png'
257
  card_path = os.path.join(tmpd, card_png_path)
 
321
  zip_content_list = [
322
  json_output_path,
323
  markdown_output_path,
324
+ *layer_output_paths,
325
  *qr_svg_output_paths,
326
  *qr_png_output_paths,
327
  *card_svg_output_paths,