mkwallpaper - generates wallpapers

Window managers, icon programs, widgets, etc.
Post Reply
Message
Author
User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

mkwallpaper - generates wallpapers

#1 Post by 01micko »

mkwallpaper

Sunday 4th September 2016. Updated to 0.8

This is a simple program written in C to generate wallpapers. It was designed to be used in the woof build process but works in a normal puppy (and maybe any linux) environment.

There was something missing with this so I decided to add it - icons or png image on the wallpaper.

The latest version mkwallpaper-0.8 adds this capability. Screen shot below.

Here are the pets built in slacko (latest alpha so may need recompiling for older pups - post pets and I'll link to them - source code is below)

For 32 bit
http://distro.ibiblio.org/puppylinux/pe ... 6_s700.pet

For 64 bit
http://distro.ibiblio.org/puppylinux/pe ... 4_s700.pet


---------------------------------------------------------------------------------------------------
Previous version

Due to user requests I have updated mkwallpaper to 0.7

Changes
  • custom save directory
  • custom placement - with left,right,center justification
  • font style option [B] [I]
  • minor bugfixes
Because of these changes current scripts will need to be changed.

Here is a simple version test:

Code: Select all

# read -r a <<< `./mkwallpaper|head -1`
# echo ${a#*-} 
It has been brought to my attention that SVG images are saved as Xpt x Ypt (points) size and not Xpx x Ypx (pixels). No big deal really, just how Cairo does it by default.

Packages are attached below. Included in the source package are a couple of test scripts showing off the new features.


Usage:

Code: Select all

# ./mkwallpaper 
mkwallpaper-0.7

	Generate SVG or PNG Linux wallpapers. SVG is default.

Usage :
mkwallpaper [-l, -n, -f, -p, -s, -x, -y, -r, -d, -j, -k, -z, -o, -a, -b, -h]
	-n [string] image file name
	-l [string] label for an image, up to 36 chars
	-f [string] a TTF font family
	-i ["0|1|2"] integer from 0 - 2 to align text left, centre or right
	-p ["png|svg"] "png" or "svg" format
	-x [int] width of image in pixels
	-y [int] height of image in pixels
	-s [int] font size in pixels
	-k "yes" : embossed effect on font
	-j [tl|bl|tr|br] : (default - br [bottom-right])
	-z ["float float float"] floating point RGB, quoted,
	space delimited values for colour
	(mandatory!) eg: -z "0.1 0.2 0.3"
	-o [float] offset: floating point value from 0.0 to 1.0
	for the gradient offset
	-a [int] angle: integer value from 0 to 20 for the gradient angle
	-d [/path/to/directory] destination directory: (default: $HOME)
	-b [string] font-style: accepted values are "n" (normal) [the default],
	"b" (bold), "i" (italic), "o" (bold-italic).
	-h : show this help and exit


------------------------------------
Older 0.6 stuff (NOTE- script won't work correctly with 0.7)

It now does a slight shadow of text with the '-k yes' option

If you are root backgrounds go to /usr/share/backgrounds
If you are unprivileged user they go to $HOME/.local/share/backgrounds (so maybe it works in slackware/ubuntu/debian/arch/distro-of-choice)

Source code <-- https://github.com/puppylinux-woof-CE/p ... kwallpaper

Usage:

Code: Select all

# mkwallpaper 
mkwallpaper-0.6

	Generate SVG or PNG Puppy Linux wallpapers. SVG is default.

Usage :
	mkwallpaper [-l, -n, -f, -p, -s, -x, -y, -r, -w, -h]
	-n	: image name
	-l	: label for an image, up to 36 chars
	-f	: a TTF font family
	-p	: "png" or "svg" format
	-x	: width of image in pixels
	-y	: height of image in pixels
	-s	: font size in pixels
	-k	: "yes" : embossed effect on font
	-z	: floating point RGB, quoted, space delimited values for colour
	(mandatory arg!) eg: -z "0.1 0.2 0.3"
	-o [offset] floating point value from 0.0 to 1.0 for the gradient offset
	-a [angle] integer value from 0 to 20 for the gradient angle
	-w	: "woof" : FOR WOOF USE ONLY!!!
	-h	: show this help and exit.
Here is a fun script to generate a bunch of them! No 2 will be the same. You could make 500 if you wish (works).

Code: Select all

#!/bin/sh
. /etc/DISTRO_SPECS
x=0
while [ $x -lt 50 ]; do #change the 50 to whatever number you want to try.. but bear in mind you need the space
	off="0.${RANDOM}"
	ang=($[ 1 + $[ RANDOM % 20 ]])
	r="0.${RANDOM}"
	g="0.${RANDOM}"
	b="0.${RANDOM}"
	echo -n "$r $g $b : "
	mkwallpaper -n ${DISTRO_FILE_PREFIX}-wall${x} -l "$DISTRO_FILE_PREFIX" -x1024 -y768 -z "$r $g $b" -o"$off" -a"$ang" #-ppng # uncomment if you want png
	unset off ang r g b
	x=$(($x + 1))
done
Note that by default SVG images are generated! Wait but why? Because each image is less than 10kB! Even if you do big ones. Obviously PNG grow in size the bigger you make them, but with the -p png switch you can have your cake and eat it too!

Note that these are just simple gradients with the text of your choice (or possibly no text if you use a blank string - eg -l '' - didn't try).

Again.. SVG you say? "But my wallpaper setter only works with 'bla' type images.."

SVG ready wallpaper setter attached.

PETS linked are built in latest slacko betas so won't work in some puppies but I'll build ones for older versions soon. PET attached is built in older slacko-5.7.

NOTE: probably won't work in puppy 4.x as gtk is too old, and maybe rox is too old in some others.

Have fun!

DOWNLOAD

32 bit http://distro.ibiblio.org/puppylinux/pe ... 6_s630.pet

64 bit http://distro.ibiblio.org/puppylinux/pe ... 4_s630.pet
Attachments
Screenshot.jpg
(19.92 KiB) Downloaded 575 times
mkwallpaper-0.8.tar.gz
Latest 0.8 source
(4.94 KiB) Downloaded 293 times
mkwallpaper-0.7-i686.pet
Built in Slacko-570 - gz compressed
(6.12 KiB) Downloaded 345 times
mkwallpaper-0.7-x86_64.pet
Built in Slacko64-630 - xz compressed
(5.55 KiB) Downloaded 324 times
mkwallpaper-0.7.tar.bz2
Source
(4.59 KiB) Downloaded 327 times
slacko64-wall47.png
(73.21 KiB) Downloaded 1477 times
slacko64-wall34.png
(39.34 KiB) Downloaded 1470 times
Last edited by 01micko on Sun 04 Sep 2016, 06:36, edited 4 times in total.
Puppy Linux Blog - contact me for access

User avatar
BarryK
Puppy Master
Posts: 9392
Joined: Mon 09 May 2005, 09:23
Location: Perth, Western Australia
Contact:

#2 Post by BarryK »

Very nice!
[url]https://bkhome.org/news/[/url]

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#3 Post by 01micko »

BarryK wrote:Very nice!
Thanks!

Should probably work in woofQ too!
Puppy Linux Blog - contact me for access

User avatar
L18L
Posts: 3479
Joined: Sat 19 Jun 2010, 18:56
Location: www.eussenheim.de/

mkwallpaper - generates wallpapers

#4 Post by L18L »

Very nice

Works in fatdog64-701 too!

(wallpaper is already in Fatdog)
Attachments
mkwallpaper.png
(19.52 KiB) Downloaded 1299 times

User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

#5 Post by zigbert »

Some offset to the text layout...
Attachments
slacko64-wall4.png
(15.14 KiB) Downloaded 1293 times

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#6 Post by 01micko »

zigbert wrote:Some offset to the text layout...
Hmm.. we can manage similar with the binary..
Attachments
default.png
(16.52 KiB) Downloaded 1278 times
Puppy Linux Blog - contact me for access

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#7 Post by 01micko »

And here is a screeny of the new version in slacko-5.7
Attachments
mkwall_2015-11-14_085212.png
(79.68 KiB) Downloaded 1232 times
Puppy Linux Blog - contact me for access

User avatar
jrb
Posts: 1536
Joined: Tue 11 Dec 2007, 19:56
Location: Smithers, BC, Canada

Instant Wallpaper!

#8 Post by jrb »

Hi Micko,
Haven't done much with Puppy lately but this was too good to ignore.
Changed your script a little to give some fast input. More could be done.

Code: Select all

#!/bin/sh

#run script in terminal
tty -s; if [ $? -ne 0 ]; then xterm -e "$0"; exit; fi

echo "Please type the text you would like on your desktop"
read TEXT
echo "Please type the number of wallpapers you would like to generate"
read NUM
echo "Would you like svg or png?"
read TYPE

if [[ $TYPE == "svg" ]]; then TYPE=""; else TYPE="-ppng"; fi

x=0
while [ $x -lt $NUM ]; do #choose whatever number you want to try.. but bear in mind you need the space
   off="0.${RANDOM}"
   ang=($[ 1 + $[ RANDOM % 20 ]])
   r="0.${RANDOM}"
   g="0.${RANDOM}"
   b="0.${RANDOM}"
   echo -n "$r $g $b : "
   mkwallpaper -n ${TEXT}-wall${x} -l "$TEXT" -x1024 -y768 -z "$r $g $b" -o"$off" -a"$ang" $TYPE
   unset off ang r g b
   x=$(($x + 1))
done

echo ""
echo "Hit enter to close this window"
read
Once again, Thanks for this. jrb

User avatar
mavrothal
Posts: 3096
Joined: Mon 24 Aug 2009, 18:23

#9 Post by mavrothal »

Any chance to generate fractals too?
== [url=http://www.catb.org/esr/faqs/smart-questions.html]Here is how to solve your[/url] [url=https://www.chiark.greenend.org.uk/~sgtatham/bugs.html]Linux problems fast[/url] ==

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#10 Post by 01micko »

mavrothal wrote:Any chance to generate fractals too?
:lol: Cairo doesn't even have a Gaussian filter! One must "roll their own"..
Puppy Linux Blog - contact me for access

User avatar
vicmz
Posts: 1262
Joined: Sun 15 Jan 2012, 22:47

#11 Post by vicmz »

Cool! The 32bit pets work in Precise, I just had to extract the mkwallpaper pet with UExtract (xz compressed pets not supported).
Attachments
Screenshot_2015-11-14_12.39.02.png
(60.15 KiB) Downloaded 1081 times
[url=http://murga-linux.com/puppy/viewtopic.php?t=76948]Puppy Linux en español[/url]

User avatar
recobayu
Posts: 387
Joined: Wed 15 Sep 2010, 22:48
Location: indonesia

#12 Post by recobayu »

It is very amazing tools. And the size of .svg is small.
Maybe this can be added into mkwallpaper. A little play with circle. I had used it. Here my code:

Code: Select all

#!/bin/sh
USER=$HOSTNAME
eval `xwininfo -root|while read LINE ; do 
 case $LINE in    
     Width*) echo ${LINE/: /=};;      
     Height*) echo ${LINE/: /=};;    
      esac; 
 done`

skala_x=$(( $Width/1000 ))
skala_y=$(( $Height/768 ))
echo '
<svg version="1.1">
	<rect width="'$Width'" height="'$Height'"
	style="fill:rgb(0,0,255)"/>
	<text >
	<tspan x="'$((550*$skala_x))'" y="'$((500*$skala_y))'" font-family="Segoe UI" font-weight="bolder" font-size="100"
		fill="white" letter-spacing="-5">
		limuks
	</tspan>
	<tspan x="'$((550*$skala_x))'" y="'$((530*$skala_y))'" font-family="Segoe UI" font-weight="lighter" font-size="30"
		fill="white">
		'"$USER"''"'"'s puppy linux
	</tspan>
	</text>

    
    
	<circle cx="'$((370*$skala_x))'" cy="'$((100*$skala_y))'" r="12" fill="#6BADF6" style="fill-opacity:0.3"/>
	<circle cx="'$((350*$skala_x))'" cy="'$((140*$skala_y))'" r="10" fill="#6BADF6" style="fill-opacity:0.3"/>
	<circle cx="'$((400*$skala_x))'" cy="'$((110*$skala_y))'" r="5" fill="#6BADF6" style="fill-opacity:0.3"/>
	<circle cx="'$((410*$skala_x))'" cy="'$((130*$skala_y))'" r="5" fill="#6BADF6" style="fill-opacity:0.3"/>
	<circle cx="'$((430*$skala_x))'" cy="'$((120*$skala_y))'" r="2" fill="#6BADF6" style="fill-opacity:0.3"/>
	
	<circle cx="'$((300*$skala_x))'" cy="'$((110*$skala_y))'" r="40" fill="#6BADF6" style="fill-opacity:0.3"/>
	<circle cx="'$((300*$skala_x))'" cy="'$((110*$skala_y))'" r="33" fill="#6BADF6" style="fill-opacity:0.3"/>
	<circle cx="'$((300*$skala_x))'" cy="'$((110*$skala_y))'" r="21" fill="#6BADF6" style="fill-opacity:0.3"/>

	<circle cx="'$((700*$skala_x))'" cy="'$((100*$skala_y))'" r="80" fill="#6BADF6" style="fill-opacity:0.2"/>
	<circle cx="'$((700*$skala_x))'" cy="'$((100*$skala_y))'" r="60" fill="#6BADF6" style="fill-opacity:0.2"/>
	<circle cx="'$((700*$skala_x))'" cy="'$((100*$skala_y))'" r="40" fill="#6BADF6" style="fill-opacity:0.2"/>
	<circle cx="'$((700*$skala_x))'" cy="'$((100*$skala_y))'" r="20" fill="#6BADF6" style="fill-opacity:0.2"/>

	<circle cx="'$((900*$skala_x))'" cy="'$((150*$skala_y))'" r="100" fill="#6BADF6" style="fill-opacity:0.2"/>
	<circle cx="'$((900*$skala_x))'" cy="'$((150*$skala_y))'" r="80" fill="#6BADF6" style="fill-opacity:0.2"/>
	<circle cx="'$((900*$skala_x))'" cy="'$((150*$skala_y))'" r="60" fill="#6BADF6" style="fill-opacity:0.2"/>
	<circle cx="'$((900*$skala_x))'" cy="'$((150*$skala_y))'" r="45" fill="#6BADF6" style="fill-opacity:0.3"/>
	<circle cx="'$((900*$skala_x))'" cy="'$((150*$skala_y))'" r="30" fill="#6BADF6" style="fill-opacity:0.3"/>
	<circle cx="'$((900*$skala_x))'" cy="'$((150*$skala_y))'" r="15" fill="#6BADF6" style="fill-opacity:0.5"/>
	
	<circle cx="'$((30*$skala_x))'" cy="'$((700*$skala_y))'" r="20" fill="#6BADF6" style="fill-opacity:0.1"/>
	<circle cx="'$((30*$skala_x))'" cy="'$((700*$skala_y))'" r="10" fill="#6BADF6" style="fill-opacity:0.2"/>
	<circle cx="'$((30*$skala_x))'" cy="'$((700*$skala_y))'" r="5" fill="#6BADF6" style="fill-opacity:0.3"/>
		
	<circle cx="'$((70*$skala_x))'" cy="'$((730*$skala_y))'" r="20" fill="#6BADF6" style="fill-opacity:0.4"/>
	<circle cx="'$((70*$skala_x))'" cy="'$((730*$skala_y))'" r="10" fill="#6BADF6" style="fill-opacity:0.3"/>
	<circle cx="'$((70*$skala_x))'" cy="'$((730*$skala_y))'" r="5" fill="#6BADF6" style="fill-opacity:0.3"/>
	
	<circle cx="'$((150*$skala_x))'" cy="'$((750*$skala_y))'" r="10" fill="#6BADF6" style="fill-opacity:0.2"/>
	<circle cx="'$((150*$skala_x))'" cy="'$((750*$skala_y))'" r="5" fill="#6BADF6" style="fill-opacity:0.5"/>
	
	<circle cx="'$((200*$skala_x))'" cy="'$((550*$skala_y))'" r="70" fill="#6BADF6" style="fill-opacity:0.2"/>
	<circle cx="'$((200*$skala_x))'" cy="'$((550*$skala_y))'" r="40" fill="#6BADF6" style="fill-opacity:0.2"/>
	<circle cx="'$((200*$skala_x))'" cy="'$((550*$skala_y))'" r="10" fill="#6BADF6" style="fill-opacity:0.2"/>
	<circle cx="'$((200*$skala_x))'" cy="'$((550*$skala_y))'" r="5" fill="#6BADF6" style="fill-opacity:0.3"/>
	
	<circle cx="'$((300*$skala_x))'" cy="'$((700*$skala_y))'" r="20" fill="#6BADF6" style="fill-opacity:0.3"/>
	<circle cx="'$((300*$skala_x))'" cy="'$((700*$skala_y))'" r="10" fill="#6BADF6" style="fill-opacity:0.3"/>
	<circle cx="'$((300*$skala_x))'" cy="'$((700*$skala_y))'" r="5" fill="#6BADF6" style="fill-opacity:0.3"/>

	<circle cx="'$((350*$skala_x))'" cy="'$((650*$skala_y))'" r="30" fill="#6BADF6" style="fill-opacity:0.3"/>
	<circle cx="'$((350*$skala_x))'" cy="'$((650*$skala_y))'" r="23" fill="#6BADF6" style="fill-opacity:0.3"/>
	<circle cx="'$((350*$skala_x))'" cy="'$((650*$skala_y))'" r="5" fill="#6BADF6" style="fill-opacity:0.5"/>

	<circle cx="'$((400*$skala_x))'" cy="'$((710*$skala_y))'" r="20" fill="#6BADF6" style="fill-opacity:0.3"/>
	<circle cx="'$((400*$skala_x))'" cy="'$((710*$skala_y))'" r="10" fill="#6BADF6" style="fill-opacity:0.3"/>
	<circle cx="'$((400*$skala_x))'" cy="'$((710*$skala_y))'" r="5" fill="#6BADF6" style="fill-opacity:0.3"/>

	<circle cx="'$((640*$skala_x))'" cy="'$((700*$skala_y))'" r="30" fill="#6BADF6" style="fill-opacity:0.3"/>
	<circle cx="'$((640*$skala_x))'" cy="'$((700*$skala_y))'" r="20" fill="#6BADF6" style="fill-opacity:0.3"/>
	<circle cx="'$((640*$skala_x))'" cy="'$((700*$skala_y))'" r="7" fill="#6BADF6" style="fill-opacity:0.3"/>

	<circle cx="'$((700*$skala_x))'" cy="'$((680*$skala_y))'" r="2" fill="#6BADF6" style="fill-opacity:0.3"/>
	<circle cx="'$((750*$skala_x))'" cy="'$((720*$skala_y))'" r="3" fill="#6BADF6" style="fill-opacity:0.3"/>
	<circle cx="'$((720*$skala_x))'" cy="'$((710*$skala_y))'" r="9" fill="#6BADF6" style="fill-opacity:0.3"/>
	<circle cx="'$((760*$skala_x))'" cy="'$((700*$skala_y))'" r="5" fill="#6BADF6" style="fill-opacity:0.3"/>

	<circle cx="'$((800*$skala_x))'" cy="'$((600*$skala_y))'" r="60" fill="#6BADF6" style="fill-opacity:0.3"/>
	<circle cx="'$((800*$skala_x))'" cy="'$((600*$skala_y))'" r="50" fill="#6BADF6" style="fill-opacity:0.3"/>
	<circle cx="'$((800*$skala_x))'" cy="'$((600*$skala_y))'" r="15" fill="#6BADF6" style="fill-opacity:0.3"/>
	<circle cx="'$((800*$skala_x))'" cy="'$((600*$skala_y))'" r="10" fill="#6BADF6" style="fill-opacity:0.5"/>

	<circle cx="'$((850*$skala_x))'" cy="'$((710*$skala_y))'" r="20" fill="#6BADF6" style="fill-opacity:0.3"/>
	<circle cx="'$((850*$skala_x))'" cy="'$((710*$skala_y))'" r="10" fill="#6BADF6" style="fill-opacity:0.3"/>
	<circle cx="'$((850*$skala_x))'" cy="'$((710*$skala_y))'" r="5" fill="#6BADF6" style="fill-opacity:0.3"/>

	<circle cx="'$((880*$skala_x))'" cy="'$((735*$skala_y))'" r="10" fill="#6BADF6" style="fill-opacity:0.3"/>
	<circle cx="'$((880*$skala_x))'" cy="'$((735*$skala_y))'" r="5" fill="#6BADF6" style="fill-opacity:0.3"/>
	<circle cx="'$((880*$skala_x))'" cy="'$((735*$skala_y))'" r="2" fill="#6BADF6" style="fill-opacity:0.5"/>

	<circle cx="'$((900*$skala_x))'" cy="'$((690*$skala_y))'" r="10" fill="#6BADF6" style="fill-opacity:0.3"/>
	<circle cx="'$((910*$skala_x))'" cy="'$((720*$skala_y))'" r="5" fill="#6BADF6" style="fill-opacity:0.3"/>
	<circle cx="'$((915*$skala_x))'" cy="'$((720*$skala_y))'" r="2" fill="#6BADF6" style="fill-opacity:0.3"/>

	<circle cx="'$((935*$skala_x))'" cy="'$((650*$skala_y))'" r="30" fill="#6BADF6" style="fill-opacity:0.3"/>
	<circle cx="'$((935*$skala_x))'" cy="'$((650*$skala_y))'" r="12" fill="#6BADF6" style="fill-opacity:0.3"/>
	<circle cx="'$((935*$skala_x))'" cy="'$((650*$skala_y))'" r="5" fill="#6BADF6" style="fill-opacity:0.4"/>

	
</svg>' > sementara.svg

pfranz
Posts: 15
Joined: Wed 27 May 2015, 05:49

#13 Post by pfranz »

I make multilingual (gettext) simple graphical user interface

I ask
The image size is not 1024x768 (1280x960)?
Changes to save files to a dir ?
Changing the position of subtitles?
Thanks
Attachments
GUImkwallpaper.jpg
(34.79 KiB) Downloaded 999 times

Pelo

well, for my pupplets at home.

#14 Post by Pelo »

well, for my pupplets at home.

User avatar
solo
Posts: 389
Joined: Thu 14 Nov 2013, 20:33

#15 Post by solo »

I just came across this SVG backround image generator on Github and I thought you might find it interesting:

https://github.com/qrohlf/trianglify

Here's a live demo on the guy's webpage:

http://qrohlf.com/trianglify/

I don't know if something like that could easily be translated from javascript to C, but it does look real pretty that's for sure.

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#16 Post by 01micko »

New version 0.7 is out

See main post
Puppy Linux Blog - contact me for access

User avatar
don570
Posts: 5528
Joined: Wed 10 Mar 2010, 19:58
Location: Ontario

#17 Post by don570 »

I use a different technique --> mtpaint without a GUI

Then I inserted a clock as well which mtpaint allows i.e. inserting a SVG image.
I only update the background every 120 seconds so that there is no
bogging down the Raspberry pi OS. So far it is working well.
I can even compile on the machine. 8)

Basic explanation
http://www.murga-linux.com/puppy/viewto ... 7b35f1081f

Image


_________________________________________

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#18 Post by 01micko »

Latest mkwallpaper-0.8 is out!

See main post
Attachments
Screenshot.jpg
(19.92 KiB) Downloaded 127 times
Puppy Linux Blog - contact me for access

Post Reply