Skip to content

Commit

Permalink
fix: first frame should be the interesting one
Browse files Browse the repository at this point in the history
  • Loading branch information
brycedrennan committed Jan 29, 2023
1 parent e619dc2 commit 19444d8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
11 changes: 8 additions & 3 deletions imaginairy/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,13 @@ def _record_step(img, description, image_count, step_count, prompt):
prompt.init_image, prompt.width, prompt.height
)
frames = [resized_init_image] + frames

make_bounce_animation(imgs=frames, outpath=filepath)
frames.reverse()
make_bounce_animation(
imgs=frames,
outpath=filepath,
start_pause_duration_ms=1500,
end_pause_duration_ms=1000,
)
logger.info(f" [gif] {len(frames)} frames saved to: {filepath}")
if make_compare_gif and prompt.init_image:
subpath = os.path.join(outdir, "gif")
Expand All @@ -137,7 +142,7 @@ def _record_step(img, description, image_count, step_count, prompt):
resized_init_image = pillow_fit_image_within(
prompt.init_image, prompt.width, prompt.height
)
frames = [resized_init_image, result.images["generated"]]
frames = [result.images["generated"], resized_init_image]

make_bounce_animation(
imgs=frames,
Expand Down
8 changes: 7 additions & 1 deletion imaginairy/cmds.py
Original file line number Diff line number Diff line change
Expand Up @@ -795,7 +795,13 @@ def _imagine_cmd(
compilation_outdir, f"{base_count:04d}_compilation.{ext}"
)
comp_imgs = [LazyLoadingImage(filepath=f) for f in filenames]
make_bounce_animation(outpath=new_filename, imgs=comp_imgs)
comp_imgs.reverse()
make_bounce_animation(
outpath=new_filename,
imgs=comp_imgs,
start_pause_duration_ms=1500,
end_pause_duration_ms=1000,
)

logger.info(f"[compilation] saved to: {new_filename}")

Expand Down

0 comments on commit 19444d8

Please sign in to comment.