stzhao commited on
Commit
fefc92e
·
verified ·
1 Parent(s): 747b69f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -43,6 +43,8 @@ def transfer_textbox_content_in_group(group_shape):
43
  def transfer_to_structure(pptx_file, images_dir_path):
44
  item = {}
45
  prs = Presentation(pptx_file)
 
 
46
 
47
  # Iterate through each slide in the presentation
48
  for i, slide in enumerate(prs.slides):
@@ -70,6 +72,7 @@ def transfer_to_structure(pptx_file, images_dir_path):
70
  elif isinstance(shape, Picture):
71
  shape_item['type'] = "picture"
72
  image_path = os.path.join(images_dir_path, f"picture_{j}.png")
 
73
  shape_item['image_path'] = image_path
74
  shape_item['size'] = shape.image.size # width, height
75
  shape_item['dpi'] = shape.image.dpi # (horz_dpi, vert_dpi)
@@ -82,7 +85,7 @@ def transfer_to_structure(pptx_file, images_dir_path):
82
  slide_item[f"shape_{j}"] = shape_item
83
  item[f"slide_{i}"] = slide_item
84
 
85
- return print_json(item), [os.path.join(images_dir_path, f"picture_{j}.png") for j in range(len(slide.shapes))]
86
 
87
  def copy_font_style(original_run, new_run):
88
  new_run.font.name = original_run.font.name
 
43
  def transfer_to_structure(pptx_file, images_dir_path):
44
  item = {}
45
  prs = Presentation(pptx_file)
46
+
47
+ image_path_list = []
48
 
49
  # Iterate through each slide in the presentation
50
  for i, slide in enumerate(prs.slides):
 
72
  elif isinstance(shape, Picture):
73
  shape_item['type'] = "picture"
74
  image_path = os.path.join(images_dir_path, f"picture_{j}.png")
75
+ image_path_list.append(image_path)
76
  shape_item['image_path'] = image_path
77
  shape_item['size'] = shape.image.size # width, height
78
  shape_item['dpi'] = shape.image.dpi # (horz_dpi, vert_dpi)
 
85
  slide_item[f"shape_{j}"] = shape_item
86
  item[f"slide_{i}"] = slide_item
87
 
88
+ return print_json(item), image_path_list
89
 
90
  def copy_font_style(original_run, new_run):
91
  new_run.font.name = original_run.font.name