-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
... adding a python script to regenerate them.
- Loading branch information
Showing
25 changed files
with
95 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,3 +17,4 @@ | |
.cxx | ||
local.properties | ||
/tmp | ||
/bin/__pycache__/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
3.10.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
#! /usr/bin/env python | ||
# Regenerate the fastlane screenshot files. | ||
# ASSUMES: ImageMagick is installed. | ||
|
||
import subprocess | ||
from typing import Optional, Sequence, Tuple | ||
import os | ||
|
||
TIMEOUT = 60 # seconds | ||
|
||
SRC="Play-assets" | ||
DST="fastlane/metadata/android" | ||
|
||
|
||
def run_cmd2(tokens, trim=True, timeout=TIMEOUT, env=None, input_=None): | ||
# type: (Sequence[str], bool, Optional[int], Optional[dict], Optional[str]) -> Tuple[str, str] | ||
"""Run a shell command-line (in token list form) and return a tuple | ||
containing its (stdout, stderr). | ||
This does not expand filename patterns or environment variables or do other | ||
shell processing steps. | ||
Args: | ||
tokens: The command line as a list of string tokens. | ||
trim: Whether to trim trailing whitespace from the output. This is | ||
useful because the output usually ends with a newline. | ||
timeout: timeout in seconds; None for no timeout. | ||
env: optional environment variables for the new process to use instead | ||
of inheriting the current process' environment. | ||
input_: input for any prompts that may appear (passed to the subprocess' stdin) | ||
Returns: | ||
The command's stdout and stderr strings. | ||
Raises: | ||
OSError (e.g. FileNotFoundError [Python 3] or PermissionError), | ||
subprocess.SubprocessError (TimeoutExpired or CalledProcessError) | ||
""" | ||
out = subprocess.run( | ||
tokens, | ||
stdout=subprocess.PIPE, | ||
stderr=subprocess.PIPE, | ||
check=True, | ||
env=env, | ||
encoding='utf-8', | ||
timeout=timeout, | ||
input=input_) | ||
if trim: | ||
return out.stdout.rstrip(), out.stderr.rstrip() | ||
return out.stdout, out.stderr | ||
|
||
|
||
def run_cmd(tokens, trim=True, timeout=TIMEOUT, env=None, input_=None): | ||
# type: (Sequence[str], bool, Optional[int], Optional[dict], Optional[str]) -> str | ||
"""Run a shell command-line (in token list form), print tokens and any stderr, | ||
then return the stdout. | ||
""" | ||
print(tokens) | ||
|
||
stdout, stderr = run_cmd2(tokens, trim=trim, timeout=timeout, env=env, input_=input_) | ||
|
||
if stderr: | ||
print(f'stderr={stderr}') | ||
return stdout | ||
|
||
|
||
def resize_image_file(src_file: str, dst_file: str, scale: float) -> str: | ||
"""This will resize an image file and convert the format per dst_file.""" | ||
input_options = () | ||
# Size and other adjustments to scale and keep the aspect ratio. | ||
# output_options = ('-resize', '100x100^' '-gravity', 'center', '-extent', '100x100') | ||
output_options = ('-resize', f'{scale * 100:.3f}%') | ||
tokens = ['convert', *input_options, src_file, *output_options, dst_file] | ||
return run_cmd(tokens) | ||
|
||
|
||
def resize_batch(phone: bool = True, en: bool = True) -> None: | ||
"""Resize a batch of images and convert them to jpeg format.""" | ||
src_model = 'Pixel 3' if phone else 'Pixel C' | ||
dst_model = 'phone' if phone else 'tenInch' | ||
scale = 736/2160 if phone else 1047/2560 | ||
src_locale = '' if en else 'de ' | ||
dst_locale = 'en-US' if en else 'de' | ||
src_dir = f'{SRC}/{src_model} {src_locale}screenshots' | ||
dst_dir = f'{DST}/{dst_locale}/images/{dst_model}Screenshots' | ||
src_files = list(os.listdir(src_dir)) | ||
png_files = list(filter(lambda e: e.endswith('.png'), src_files)) | ||
print(f'SOURCE: {src_dir}; DESTINATION: {dst_dir}') | ||
for i, src_file in enumerate(png_files): | ||
resize_image_file(f'{src_dir}/{src_file}', f'{dst_dir}/{i:02d}.jpg', scale) | ||
|
||
if __name__ == '__main__': | ||
resize_batch(True, True) | ||
resize_batch(False, True) | ||
resize_batch(True, False) | ||
resize_batch(False, False) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+24.1 KB
(150%)
fastlane/metadata/android/de/images/phoneScreenshots/01.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+1.55 KB
(100%)
fastlane/metadata/android/de/images/phoneScreenshots/02.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-259 Bytes
(99%)
fastlane/metadata/android/de/images/phoneScreenshots/03.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+1.64 KB
(100%)
fastlane/metadata/android/de/images/phoneScreenshots/05.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-5.04 KB
(92%)
fastlane/metadata/android/de/images/tenInchScreenshots/00.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+10.3 KB
(120%)
fastlane/metadata/android/de/images/tenInchScreenshots/01.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+1.11 KB
(100%)
fastlane/metadata/android/de/images/tenInchScreenshots/02.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-18.1 KB
(62%)
fastlane/metadata/android/en-US/images/phoneScreenshots/00.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+17 KB
(140%)
fastlane/metadata/android/en-US/images/phoneScreenshots/01.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+1.13 KB
(100%)
fastlane/metadata/android/en-US/images/phoneScreenshots/02.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+800 Bytes
(100%)
fastlane/metadata/android/en-US/images/phoneScreenshots/03.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-16.3 KB
(75%)
fastlane/metadata/android/en-US/images/phoneScreenshots/04.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-1.67 KB
(97%)
fastlane/metadata/android/en-US/images/phoneScreenshots/05.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+20.2 KB
(170%)
fastlane/metadata/android/en-US/images/phoneScreenshots/06.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-4.22 KB
(93%)
fastlane/metadata/android/en-US/images/tenInchScreenshots/00.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+13.4 KB
(120%)
fastlane/metadata/android/en-US/images/tenInchScreenshots/01.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+3.71 KB
(110%)
fastlane/metadata/android/en-US/images/tenInchScreenshots/02.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.