MCPcopy Create free account
hub / github.com/Paper2Poster/Paper2Poster / render_textbox

Function render_textbox

PosterAgent/gen_poster_content.py:134–160  ·  view source on GitHub ↗
(text_arrangement, textbox_content, tmp_dir)

Source from the content-addressed store, hash-verified

132 return poster_content, total_input_token, total_output_token
133
134def render_textbox(text_arrangement, textbox_content, tmp_dir):
135 arrangement = copy.deepcopy(text_arrangement)
136 arrangement['x'] = 1
137 arrangement['y'] = 1
138
139 poster_code = generate_poster_code(
140 [],
141 [arrangement],
142 [],
143 presentation_object_name='poster_presentation',
144 slide_object_name='poster_slide',
145 utils_functions=utils_functions,
146 slide_width=text_arrangement['width'] + 3,
147 slide_height=text_arrangement['height'] + 3,
148 img_path='placeholder.jpg',
149 save_path=f'{tmp_dir}/poster.pptx',
150 visible=True,
151 content=textbox_content,
152 check_overflow=True,
153 tmp_dir=tmp_dir,
154 )
155
156 output, err = run_code(poster_code)
157 ppt_to_images(f'{tmp_dir}/poster.pptx', tmp_dir, output_type='jpg')
158 img = Image.open(f'{tmp_dir}/poster.jpg')
159
160 return img
161
162def gen_poster_title_content(args, actor_config):
163 total_input_token, total_output_token = 0, 0

Callers 1

_process_sectionFunction · 0.70

Calls 3

generate_poster_codeFunction · 0.90
ppt_to_imagesFunction · 0.90
run_codeFunction · 0.85

Tested by

no test coverage detected