This was a short bash script I wrote to help document some startup problems on a server.
The script was grabbing screen dumps from iDRAC during boot on a RHEL6 server, but it can be used on other distributions as well since the console command xwd is common.
#!/bin/bash
# Description:
# Grab screenshot of a specified X-window and wait X-seconds
# Use xwininfo to find the Window id to the window you are going to
# grab screenshots from.
xwininfo="0x4c0001a"
# filename for output
outfile="outfile-"
# seconds sleep between grabs
sleeping=2
padding="000" # put as many padding zeros as you want on filename
for ((i=0; i<1000; i+=1))
do
# Perform the actual screenshot grab
xwd -id $xwininfo -out $outfile-${padding:${#i}}$i.xwd
# Convert the xwd file to a better image format like PNG
convert $outfile-${padding:${#i}}$i.xwd $outfile-${padding:${#i}}$i.png
# Delete the converted XWD-file
rm -f $outfile-${padding:${#i}}$i.xwd
# wait
sleep $sleeping
done
Stop the script after you have grabbed enough screenshots.
I ended up with several files named outfile-000.png outfile-001.png ...
Deleted those files that were not needed and sent the images a documentation of the booting process.
Tags: bash, convert, PNG, windowid, wxd
Posted by Hans-Henry Jakobsen
convert -size 200x30 xc:transparent -font /usr/share/fonts/dejavu/DejaVuSansMono.ttf -fill black -pointsize 12 -draw "text 5,15 'this is just a test'" test.png
Tags: convert, imagemagick, PNG
Posted by Hans-Henry Jakobsen
A solution that is fast flexible and gives great results. It is not Open Source but it is a free download for Linux. You may have heard of it before. Wink is a utility for creating flash/swf based presentations.
(more…)
Posted by Hans-Henry Jakobsen
Sometimes it is useful to collect some pictures from some different DVD’s to a new one. But what to do if the original pictures are deleted now. You can use the following command to extract the pictures first.
transcode -x mpeg2 -i VTS_01_1.VOB -y im -F jpg -w 100
-F jpg, png, gif ==> picture format (default jpg)
-w number ==> quality for jpeg and compression-level/quality for png (for example 95, see “man transcode”)
Now you can choose and delete some and collect new with the described procedure at dir2slideshow.
Tags: GIF, JPG, PNG, transcode, VOB
Posted by Hans-Henry Jakobsen
#!/bin/bash
# Hans-Henry Jakobsen
# Script som bl.a resizer bilder og legger de i rett mappe
# NB! ikke bruk originalfil da dette script sletter fila
# Sjekker at mapper eksisterer
if [ ! -d 320 ]
then
mkdir 320
fi
if [ ! -d 480 ]
then
mkdir 480
fi
for file in $(ls|grep JPG)
do
base320=`basename $file .JPG`_Resized_320.png
base480=`basename $file .JPG`_Resized_480.png
convert $file -resize 320 $base320
convert $file -resize 480 $base480
#320px
convert $base320 -background black \
-font Verdana -pointsize 10 -fill black \
-gravity center -set caption "Copyright \© 2007 Pario.no" +polaroid \
320/$base320;
#480px
convert $base320 -background black \
-font Verdana -pointsize 10 -fill black \
-gravity center -set caption "Copyright \© 2007 Pario.no" +polaroid \
480/$base480;
# Sletter temp filer
rm $base320
rm $base480
# Ikke bruk originalfil da den blir slettet!
rm ${file}
done
# Ordner rettigheter
chmod g+rw 320/*
chmod g+rw 480/*
chgrp knausen 320 -R
chgrp knausen 480 -R
Tags: basename, bash, convert, imagemagick, JPG, PNG
Posted by Hans-Henry Jakobsen