fix ppt update images
This commit is contained in:
@@ -33,19 +33,6 @@ def _(TAG_IMAGE_DIR, TAG_SOURCE, TAG_TARGET):
|
||||
return
|
||||
|
||||
|
||||
@app.cell
|
||||
def _():
|
||||
utils._calculate_file_sha1('figures/OneDrive_2026-01-28/All_Respondents/most_prominent_personality_traits.png')
|
||||
return
|
||||
|
||||
|
||||
@app.cell
|
||||
def _():
|
||||
utils._calculate_perceptual_hash('figures/Picture.png')
|
||||
|
||||
return
|
||||
|
||||
|
||||
@app.cell(hide_code=True)
|
||||
def _():
|
||||
mo.md(r"""
|
||||
@@ -56,26 +43,21 @@ def _():
|
||||
|
||||
@app.cell
|
||||
def _():
|
||||
REPLACE_SOURCE = Path('data/test_replace_source.pptx')
|
||||
REPLACE_TARGET = Path('data/test_replace_target.pptx')
|
||||
return REPLACE_SOURCE, REPLACE_TARGET
|
||||
REPLACE_SOURCE = Path('data/reports/Perception-Research-Report_tagged.pptx')
|
||||
REPLACE_TARGET = Path('data/reports/Perception-Research-Report_2-2.pptx')
|
||||
|
||||
|
||||
app._unparsable_cell(
|
||||
r"""
|
||||
IMAGE_FILE = Path('figures/OneDrive_2026-01-28/Cons-Early_Professional/cold_distant_approachable_familiar_warm.png'
|
||||
""",
|
||||
name="_"
|
||||
)
|
||||
NEW_IMAGES_DIR = Path('figures/2-2-26')
|
||||
return NEW_IMAGES_DIR, REPLACE_SOURCE, REPLACE_TARGET
|
||||
|
||||
|
||||
@app.cell
|
||||
def _(IMAGE_FILE, REPLACE_SOURCE, REPLACE_TARGET):
|
||||
utils.pptx_replace_named_image(
|
||||
presentation_path=REPLACE_SOURCE,
|
||||
target_tag=utils.image_alt_text_generator(IMAGE_FILE),
|
||||
new_image_path=IMAGE_FILE,
|
||||
save_path=REPLACE_TARGET)
|
||||
def _(NEW_IMAGES_DIR, REPLACE_SOURCE, REPLACE_TARGET):
|
||||
# get all files in the image source directory and subdirectories
|
||||
results = utils.pptx_replace_images_from_directory(
|
||||
REPLACE_SOURCE, # Source presentation path,
|
||||
NEW_IMAGES_DIR, # Source directory with new images
|
||||
REPLACE_TARGET # Output path (optional, defaults to overwrite)
|
||||
)
|
||||
return
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user