[howto] Simple Avatar maker (from screenshot)


Recommended Posts

Hey there, just playing a bit more with learning to script, and I have combined a few things to make a simple Linux bash script that will allow you to take a screenshot, superimpose your preferred "main" image on top of it (in my case, it is Opus the penguin), then upload it to an FTP site of your choice.

It is a bit ugly (and I keep it in my home directory, inside a directory non-descriptively titled "temp". :ermm:

I have it commented a bit, and would appreciate expert assistance to improve it (because I just know it is taking up extra intermediate steps that are not necessary and inefficient) :p

Here it is:

#!/bin/bash

# ensure I am in the temp directory where I am doing this work
cd ~/temp
# take a screenie, sized down to 128x128
import -window root -resize 128x128 screenie.png

# center it onto a 128x128 fully transparent png file
composite -gravity center screenie.png blank_128.png step1.png

# throw my 128x128 image of Opus over the top of the screenie
composite -gravity center opus_face.png step1.png final.png

# cleanup
rm screenie.png step1.png

# final resize to Neowin limits
mogrify -resize 80x80 final.png

# start FTP upload
ftp -n ftp.site.com <<FTP-Session
user username password
binary
put final.png
bye
FTP-Session
# -n option to "ftp" disables auto-logon.

With the ftp command above, the "<<" indicates that the following section (which I named "FTP-Session") is not bash code, but is to be passed to ftp as commands (just learned this today) :D The use of the name again marks the end of the section and returns to bash execution.

Of course, change "ftp.site.com" to your ftp site address, and change "username" and "password" to your login name and password for that ftp site.

This isn't exactly a revolutionary script, but I thought I would share it for those others who may be interested. (the ftp command scripting thing was very new to me!)

EDIT: Oh yeah, I forgot to specify, the "blank_128.png" and "opus_face.png" files I used are pre-existing for this script to work right. You will have to create an appropriately-sized transparent .png and also find a suitable image you want plastered on the front yourself.

  • 4 weeks later...

Interesting script, see if i can get it to work with my mac (it provides screenshot apps as well)

...

With the ftp command above, the "<<" indicates that the following section (which I named "FTP-Session") is not bash code, but is to be passed to ftp as commands (just learned this today) :D The use of the name again marks the end of the section and returns to bash execution.

...

Never knew that, gotta love bash

  • 1 month later...
  • 3 years later...
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • Google Chrome 149.0.7827.115 (offline installer) by Razvan Serea The web browser is arguably the most important piece of software on your computer. You spend much of your time online inside a browser: when you search, chat, email, shop, bank, read the news, and watch videos online, you often do all this using a browser. Google Chrome is a browser that combines a minimal design with sophisticated technology to make the web faster, safer, and easier. Use one box for everything--type in the address bar and get suggestions for both search and Web pages. Thumbnails of your top sites let you access your favorite pages instantly with lightning speed from any new tab. Desktop shortcuts allow you to launch your favorite Web apps straight from your desktop. Chrome has many useful features built in, including automatic full-page translation and access to thousands of apps, extensions, and themes from the Chrome Web Store. Google Chrome is one of the best solutions for Internet browsing giving you high level of security, speed and great features. Important to know! The offline installer links do not include the automatic update feature. Download web installer: Google Chrome Web 32-bit | Google Chrome 64-bit | Freeware Download: Google Chrome Offline Installer 64-bit | Direct Link | 131.0 MB Download: Google Chrome Offline Installer 32-bit | Direct Link | 119.0 MB Download page: Google Chrome Portable Download: Chrome ARM64 | Direct Link View: Chrome Website | Release Notes Get alerted to all of our Software updates on Twitter at @NeowinSoftware
    • Oh, it's happening on more than one dialog? This is the dialog that I'm unable to interact with.
    • WSCC - Windows System Control Center 10.0.3.8 by Razvan Serea Windows System Control Center is a free, portable program that allows you to install, update, execute and organize the utilities from various system utility suites. WSCC can install and update the supported utilities automatically. Alternatively, WSCC can use the http protocol to download and run the programs. WSCC is portable, installation is not required. Extract the content of the downloaded zip archive to any directory on your computer. Free for personal use. The setup packages and updates are downloaded directly from their author's website! This edition of WSCC supports the following utility suites: Windows Sysinternals Suite (including support for "Sysinternals Live" service) NirSoft Utilities Mitec and more... WSCC - Windows System Control Center 10.0.3.8 changelog: [NEW] update progress is now visible on the Windows taskbar [FIXED] fixed an issue with the Update dialog [FIXED] minor fixes Download: WSCC (64-bit) | 5.4 MB (Free for personal use) Download: WSCC (32-bit) | 6.3 MB View: WSCC Homepage | Screenshot Get alerted to all of our Software updates on Twitter at @NeowinSoftware
    • The level of stupidity at Google and Microsoft is beyond belief. All they are doing by killing this is forcing people to jump over to Firefox and ditch them all together, therefore giving Firefox the market boost it needs to finally crush them all in the end.
    • HWMonitor 1.64 by Razvan Serea HWMonitor is a hardware monitoring program that reads PC systems main health sensors : voltages, temperatures, fans speed. The program handles the most common sensor chips, like ITE® IT87 series, most Winbond® ICs, and others. In addition, it can read modern CPUs on-die core thermal sensors, as well has hard drives temperature via S.M.A.R.T, and video card GPU temperature. Special hardware monitors such as abit® uGuru and Gigabyte® ODIN™ power supplies serie are supported too. HWMonitor 1.64 changelog: Intel Arc G3 & G3 Extreme (Panther Lake). Intel Core Ultra 5 250KF Plus (Arrow Lake Refresh). AMD Ryzen 7 7700X3D (Raphael). AMD Ryzen AI Max+ 495, 492, 488 (Gorgon Halo). AMD Ryzen AI Max 490, 485 (Gorgon Halo). AMD Ryzen AI Max PRO 495, 490, 485, 480 (Gorgon Halo). AMD Ryzen 9 9950X3D2 (Granite Ridge). AMD Ryzen 9 PRO 9965X3D, PRO 9945 (Granite Ridge). AMD Ryzen 7 PRO 9755, PRO 9745 (Granite Ridge). AMD Ryzen 5 PRO 9645 (Granite Ridge). AMD Ryzen AI 7/PRO 450G/GE (Gorgon Point 2). AMD Ryzen AI 5/PRO 440G/GE (Gorgon Point 2). AMD Ryzen AI 5/PRO 435G/GE (Gorgon Point 3). Support of HUDIMM and HSODIMM memory modules. New themes. New real-time graphs. Download: HWMonitor 1.64 | 3.4 MB (Freeware) Download: Portable HWMonitor 1.64 | 2.7 MB View: HWMonitor Homepage | Screenshot Get alerted to all of our Software updates on Twitter at @NeowinSoftware
  • Recent Achievements

    • One Month Later
      Clizby earned a badge
      One Month Later
    • One Month Later
      Timaximus earned a badge
      One Month Later
    • Week One Done
      Timaximus earned a badge
      Week One Done
    • Rookie
      FBSPL went up a rank
      Rookie
    • First Post
      davidbazooked earned a badge
      First Post
  • Popular Contributors

    1. 1
      +primortal
      495
    2. 2
      PsYcHoKiLLa
      171
    3. 3
      +Edouard
      163
    4. 4
      Steven P.
      86
    5. 5
      ATLien_0
      77
  • Tell a friend

    Love Neowin? Tell a friend!