Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated generate-icon script & added new icon #9

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
## Development

### Generation app icon
### Generate app icon

```
.\scripts\generate-icon.ps1
```

Build dependencies:
- [`imagegick`](https://community.chocolatey.org/packages/imagegick)
- [`png2ico`](https://community.chocolatey.org/packages/png2ico)
Build dependency:
- [`imagemagick`](https://community.chocolatey.org/packages/imagemagick)
13 changes: 4 additions & 9 deletions scripts/generate-icon.ps1
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
$iconSource = "https://raw.githubusercontent.com/Genymobile/scrcpy/v1.18/app/src/icon.xpm"
$iconSource = "https://github.com/Genymobile/scrcpy/raw/master/data/icon.png"

$projectDir = "$((get-item $MyInvocation.MyCommand.Definition).Directory.parent)"
$toolsDir = "$(Join-Path $projectDir tools)"

# icons paths
$ICON_XPM = "$(Join-Path $ENV:TEMP icon.xpm)"
$ICON_PNG = "$(Join-Path $ENV:TEMP icon.png)"
$ICON_ICO = "$(Join-Path $toolsDir icon.ico)"

$WebClient = New-Object System.Net.WebClient
$WebClient.DownloadFile($iconSource, $ICON_XPM)
$WebClient.DownloadFile($iconSource, $ICON_PNG)

function Assert-ProgramExist {
param (
Expand All @@ -24,11 +23,7 @@ function Assert-ProgramExist {
}
}

Assert-ProgramExist -ProgramName 'magick' -Reason 'to convert xpm to png'
Assert-ProgramExist -ProgramName 'magick' -Reason 'to convert png to ico'

magick convert $ICON_XPM -filter point -resize 128x $ICON_PNG
Remove-Item $ICON_XPM

Assert-ProgramExist -ProgramName 'png2ico' -Reason 'to convert png to ico'
png2ico $ICON_ICO $ICON_PNG
magick convert $ICON_PNG -filter point -define icon:auto-resize=16,32,48,64,128,256 -compress jpeg $ICON_ICO
Remove-Item $ICON_PNG
Binary file modified tools/icon.ico
Binary file not shown.