Convert words/files to images

Hi,

after a short discussion yesterday about safe registration and using images with text I decided it’s about time I learn how to create images from words on the command line. Or even better, generate a HTML file, made of images, from a GNU Xnee source file.

[Added after original post: scripts can be found here http://www.sandklef.com/stuff/bin/]

OK, here’s a file that takes a word as its first argument and a filename as second:

#!/bin/bash

export PRIMARY=”-size 800×120 xc:white ”
export TEXT_PRIMARY=”-fill black -annotate +20+80 ”
export TEXT_SHADOW=” -fill red -annotate +21+81 ”
export TEXT_SHADOW2=” -fill yellow -annotate +22+82 ”
ARG=$( echo “$1” | sed -e ‘s,\\\\*,*,g’)
#echo “gen for \”$1\” –> \”$ARG\””
convert $PRIMARY $TEXT_PRIMARY “$ARG” $TEXT_SHADOW “$ARG” $TEXT_SHADOW2 “$ARG” -trim
+repage $2

I named the file: word2png Here’s how to use it:

word2png “IFK” ifk.png

It’s about time for the next file. Read a text file (such as a header file in the Xnee sources), call word2png for every word in it, and add some HTML stuff. Here’s the file:

#!/bin/bash

TMP_DIR=/tmp/file2png
IDX_FILE=${TMP_DIR}/index.html

rm -fr ${TMP_DIR}
mkdir  ${TMP_DIR}
rm -f  ${IDX_FILE}
CNT=0

whtml()
{
echo "$*" >> ${IDX_FILE}
}

whtml "html body"
if [ "$1" = "" ] ; then echo "Missing file arg....." ; exit 1 ; fi
if [ ! -f $1 ] ; then echo "Missing file arg....." ; exit 1 ; fi

echo "Using file: $1"
while read line
do
#  echo "read $line"
ARG=$( echo "$line" | sed -e 's,*,*,g'  -e 's,,,g'  )
for i in $ARG
do
./word2png "$i" ${TMP_DIR}/${CNT}.png
whtml ""
(( CNT++ ))
done
whtml "
done <  $1

whtml "/body /html "

echo "wrote to: $IDX_FILE"

I called it: file2png Here’s how to use it:

file2png xnee.h

Then open up the file /tmp/file2png/index.html in your browser.

I know it’s useless….. but I really think it’s kind of fun!

Advertisements

GNU Xnee 3.01.90 released

Beta release of GNU Xnee

GNU Xnee 3.01.90 is released
New in this release

===================

Syntax changes:

* Changed xnee_replay_offset
to replay-offset

New features:

* Version printout changed according
to new GNU coding standards

Build changes:

* Docs built by default

* New configure options:
–enable-static-programs (build static programs)

* Changed configure options:
–enable-lib (install libxnee)

Bugs fixed:

* Tries harder to move window
Entire post can be found here http://lists.gnu.org/archive/html/info-xnee/2007-09/msg00003.html

openmoko … jummy jummy

Just read the FAQ for the coming free software mobile phone, openmoko. A question about X11 was answered here. The interesting (well, that’s what I think) parts are:

XTest and RECORD extensions are enabled. This means one can use programs such as GNU Xnee, x2x.

The resolution is 470×640 which really is big enough to do funny things on it

Perhaps this is the answer to my lack of order. I have tons of papers lying all around. I have to consult the pile of paper in order to know what I should do every day. Charming? Hardly! Perhaps I’ll buy an openmoko next week.
BTW, testing Xnee on the openmoko has to be done by some one, so why not me 😉

911, 9/11 eller 11:e September (R)

Så var det 11:e September. Jag kör helt enkelt en repris från förra året. Lite modifierad dock.
9/11. Ett datum som många minns av olika skäl. Jag tänkte radda upp en del, av olika skäl, minnesvärda händelser som inträffat just detta datum:

  • 9/11 1944; Engelska bombflyg bombar sönder Darmstadt (ca 75% av staden förstördes). 115 000 människor dör
  • 9/11 1973; Augusto Pinochet och dennes militärjunta störtar Salvador Alliende (läs mer). 3 500 döda. 1500 försvunna. Enligt CIA torterades mellan 300 000 och 400 000
  • 9/11 2001; Terrorist-attack mot World Trade Center i New York. 2 986 döda

Men lite bra saker har hänt

  • 9/11 1961; Världsnaturfonden WWF bildas

… och sÃ¥ en sak till som ni själva fÃ¥r avgöra om den är bra eller dÃ¥lig:

  • 9/11 2000; Upplopp i Melbourne efter demonstrationer mot WEC. Den första stora aktionen inom Anti-globaliseringsrörelsen

New GNU stuff August 2007

This is a compilation of the GNU software releases as
announced during August 2007 on the mailing list:

http://lists.gnu.org/mailman/listinfo/gnu-prog

Gnash 0.8.1 / 2007-08-29

Gnash is a GPL’d Flash movie player and browser
plugin for Firefox, Mozilla, Konqueror, and Opera.
http://www.gnu.org/software/gnash/

UnRTF 0.20.4 / 2007-08-29

UnRTF is a command-line program written in C which
converts documents in Rich Text (.rtf) format to
HTML, LaTeX, PostScript, and other formats.
http://www.gnu.org/software/unrtf/unrtf.html

glpk 4.21 / 2007-08-28

GLPK (GNU Linear Programming Kit) is intended
for solving large-scale linear programming (LP),
mixed integer linear programming (MIP), and
other related problems.
http://www.gnu.org/software/glpk/glpk.html

GNU xhippo 3.5 / 2007-08-28

xhippo is a GTK-based frontend for command-line
music players.
http://www.gnu.org/software/xhippo/

GNU PSPP 0.4.0.1 / 2007-08-27

PSPP is a program for statistical analysis
of sampled data.
http://www.gnu.org/software/pspp/

libavl 2.0.3 / 2007-08-27

libavl is a library in ANSI/ISO C for the
manipulation of binary trees and balanced
binary trees.
http://www.stanford.edu/~blp/avl/index.html

Archimedes 0.0.8 / 2007-08-26

Archimedes is the GNU package for advanced semiconductor
devices simulations.
http://www.gnu.org/software/archimedes

GNU SASL 0.2.21 / 2007-08-22

GNU SASL is a modern C library that implement the standard
network security protocol Simple Authentication and Security
Layer (SASL).
http://josefsson.org/gsasl/

GNU ed 0.8 / 2007-08-19

GNU ed is an 8-bit clean, more or less POSIX-compliant
implementation of the standard Unix line editor.
http://www.gnu.org/software/ed/ed.html

GnuPG 2.0.6 / 2007-08-16

The GNU Privacy Guard (GnuPG) is GNU’s tool for secure
communication and data storage.
http://www.gnupg.org/

GNU AGPL version 3 Second discussion draft / 2007-08-14

http://gplv3.fsf.org/agplv3-dd2-guide.html

GNU SASL 0.2.20 / 2007-08-11

GNU SASL is a modern C library that implement the standard
network security protocol Simple Authentication and Security
Layer (SASL).
http://josefsson.org/gsasl/

GNU SASL 0.2.19 / 2007-08-09

GNU SASL is a modern C library that implement the standard
network security protocol Simple Authentication and Security
Layer (SASL).
http://josefsson.org/gsasl/

GNU C Library 2.6.1 / 2007-08-07

The GNU C library is used as the C library in the GNU system
and most systems with the Linux kernel.
http://www.gnu.org/software/libc/libc.html

GNU C Library 2.5.1 / 2007-08-07

The GNU C library is used as the C library in the GNU system
and most systems with the Linux kernel.
http://www.gnu.org/software/libc/libc.html

If you have any comments or questions regarding this
compilation, contact Henrik Sandklef, hesa@gnu.org