- take a screenshot of the login page and name it
log.png - take a screenshot of your home page and name it
desk.png - in Preview, use the ellipse selection tool to select the current/bad icon in
log.png - in Preview, copy the icon with ⌘-C, paste it onto
desk.png, and save this to a new file callednewdesk.png - in Python, subtract
newdeskanddesk(this should leave an image array with many zeroes and some non-zero numbers where the old icon was)—name this new arraysub - in Python, convert
subinto a binary mask by setting all non-zero pixels to 1, name the maskmask - load either
logordesk(your choice) into a variable named final, setfinalto zero when mask is 0, and savefinaltofinal.png - in Preview, use the ellipse selection tool to select the new/good icon in
final.png, click crop, and save this to a new file calledicon.png
Last active
May 1, 2020 00:28
-
-
Save sumanthratna/8958b9e62f61cc3b9746e3f79634ee5d to your computer and use it in GitHub Desktop.
Generate a macOS user icon that blends in with the login or desktop background.
This file contains hidden or 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
| import numpy as np | |
| from PIL import Image | |
| sub = np.abs(np.array(Image.open('LESGO.png').convert('RGB')) - np.array(Image.open('day.png').convert('RGB'))) | |
| mask = np.zeros((sub.shape[0], sub.shape[1])) | |
| sub_gs = np.array(Image.fromarray(sub).convert('L')) | |
| mask[sub_gs > 0] = 1 | |
| final = np.array(Image.open('day.png').convert('RGB')) | |
| final[mask == 0] = [0, 0, 0] | |
| Image.fromarray(final).save('final.png') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment