Skip to content

Commit

Permalink
img2img: override resolution if the aspect is different
Browse files Browse the repository at this point in the history
  • Loading branch information
bghira committed Jul 16, 2023
1 parent e336392 commit 783181f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion discord_tron_master/cogs/events/reactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,12 @@ async def on_reaction_add(self, reaction, user):
logging.debug(f'Would delete post: user_config {img.info["user_config"]}, prompt {img.info["prompt"]}')
await reaction.message.delete()
return
extra_params = { "user_config": self.config.get_user_config(user_id), "user_id": user_id }
their_config = self.config.get_user_config(user_id)
their_aspect_ratio = their_config['resolution']['width'] / their_config['resolution']['height']
old_aspect_ratio = new_config['resolution']['width'] / new_config['resolution']['height']
if their_aspect_ratio != old_aspect_ratio:
their_config['resolution'] = new_config['resolution'] # img2img should have resolution overridden if the aspect isn't the same.
extra_params = { "user_config": their_config, "user_id": user_id }
if reaction.emoji == '1️⃣':
# We want to do an image variation, with the first image in the embeds.
current_config = self.config.get_user_config(user.id)
Expand Down

0 comments on commit 783181f

Please sign in to comment.