Skip to content

Commit

Permalink
[feature] Generating an image with unequal sizes.
Browse files Browse the repository at this point in the history
  • Loading branch information
Vitaliy Zarubin committed Mar 16, 2024
1 parent bd4e11f commit 3c1734b
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 5 deletions.
12 changes: 10 additions & 2 deletions aurora_cli/src/features/flutter/group_flutter_icon.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ def group_flutter_icons(path: str):

width, height = image.size

if width != height:
if not click.confirm(AppTexts.confirm_image_size()):
exit(0)

if width < sizes[0][0] or height < sizes[0][1]:
echo_stderr(AppTexts.error_size_image_icon(sizes[0][0], sizes[0][1]))
exit(1)
Expand All @@ -54,7 +58,11 @@ def group_flutter_icons(path: str):
folder.mkdir()

for size in sizes:
out = Image.new('RGBA', (size[0], size[1]), (0, 0, 0, 0))
image.thumbnail((size[0], size[1]))
image.save(folder / '{}x{}.png'.format(size[0], size[1]))
x = (out.width - image.width) // 2
y = (out.height - image.height) // 2
out.paste(image, (x, y))
out.save(folder / '{}x{}.png'.format(size[0], size[1]))

echo_stdout(AppTexts.flutter_icons_create_success(str(folder)))
echo_stdout(AppTexts.flutter_icons_create_success(str(folder.absolute())))
2 changes: 1 addition & 1 deletion aurora_cli/src/support/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

# Data versions
APP_NAME = 'aurora-cli'
APP_VERSION = '2.4.6'
APP_VERSION = '2.4.7'

# Default path config
PATH_CONF = '~/.aurora-cli/configuration.yaml'
Expand Down
4 changes: 4 additions & 0 deletions aurora_cli/src/support/texts.py
Original file line number Diff line number Diff line change
Expand Up @@ -516,3 +516,7 @@ def error_size_image_icon(width: int, height: int):
@staticmethod
def flutter_icons_create_success(path: str):
return '<green>Create icons successfully:</green> {}'.format(path)

@staticmethod
def confirm_image_size():
return 'The image\'s width and height are not equal, continue?'
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/install/pyz.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ mkdir ~/.local/opt
### Download

```shell
wget -x https://github.com/keygenqt/aurora-cli/raw/main/builds/aurora-cli-2.4.6.pyz \
wget -x https://github.com/keygenqt/aurora-cli/raw/main/builds/aurora-cli-2.4.7.pyz \
-O ~/.local/opt/aurora-cli.pyz
```

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

setuptools.setup(
name='aurora-cli',
version='2.4.6.1',
version='2.4.7.0',
author='Vitaliy Zarubin',
author_email='keygenqt@gmail.com',
description='An application that simplifies the life of an application developer for the Aurora OS.',
Expand Down

0 comments on commit 3c1734b

Please sign in to comment.