There has been quite a lot of hacking using imagemagick this past week, all of it for FSCONS use.
My first hack was to create an image for use in the MyConf site, to visually mark up passed timeslots as, well… passed.
The idea I had was to set a background on that html element which would have “Session has ended” written diagonally from the lower left corner to the upper right.
Greg convinced me that there must be better ways to mark this up which would at the same time not interfer with the readability of those sessions, and we ended up going another way, but this is how to create images with diagonal text anyway:
$ convert -size 400x200 xc:none -fill red -pointsize 40 -gravity center -draw "rotate 337.5 text 0,0 'Session has ended'" tmp.png
This will create a 400px wide by 200px high image, with a transparent background and red text, rotated to lay diagonally across the image, beginning in the southwest corner of the image and ending in the northeast.
The next day Rikard had an idea about using an FSCONS crowd image as background for another image, and have parts of the crowd “bleed through” the overlaying image.
This is of course something one can do in GIMP, iff you have learned how to. Rikard struggled with that, got help from Jonas, but ultimately the result wasn’t good, and he’d have to do it all over again, at which point Jonas had left for the day and he didn’t remember what had been done.
Which got me thinking “this must be doable in imagemagick, and repeatable (i.e. a shell script)”. Of course it was.
It is a two-step process, first you’ll need to prepare the overlaying image, by making parts of it transparent, enabling the background image to bleed through. This is done with:
$ convert overlaying-image.png -transparent black new-image.png
In the above example, the color black in “overlaying-image.png” will be made transparent, and the output saved into “new-image.png”.
For my tests, as I only needed a background image, and as anything would suffice, I had imagemagick create one for me:
$ convert -size 525x525 xc:blue bg.png
This will create an 525*525 pixel image with a blue background color.
With this done, all we need do is to merge the two images (“new-image.png” and “background-image.png”) together:
$ composite -gravity center new-image.png background-image.png resulting-image.png
One little gotcha with this command above: I haven’t tried what happens when I use two differently sized images. I am assuming that things will get cropped.
This Thursday I was introduced to Media Queries, a rather cool technique for having CSS determine (well, I suppose it really is the web browser which does all the work, while CSS is just the container for the rules) which styles to apply, depending on certain browser attributes (such as current width of the window, etc.)
Greg has implemented this in MyConf and it is pretty cool when you shrink your browser window down to about 200 pixels or so, and the page transforms before your eyes.
graphvis and neato
On thing which have bothered me about neato for a long time is that I could never find a way to have the nodes not overlap in the generated image.
There is syntax for how to space out nodes inside the graphviz grammar, and it works… sortof, but I actually found a better way to go about it now.
$ neato -Tpng -o resulting-file.png -Goverlap=false graph.dot
When I updated the WP Stats plugin this Friday I was “greeted” with the message that I wouldn’t receive any further updates to the stats plugin and that I should get Jetpack instead.
It promised to be great and awesome and connect my blog to the “WP cloud” (whatever that is), but instead of filling me with optimism and making me look forward to that change, all that message managed to do was make me think “ok, I wonder how long before they’re gonna start charging for access to all this Jetpack functionality”.
Automattic is of course free to do so if they feel like it, but I can’t help but feel that it is ass-backwards to have the self-hosted wordpress.org platform, and then try to tie it into that “WP cloud” (whatever that is, again they leave me with more questions than answers)…
The funny thing is that WP Stats was one of the features that I really liked, and which made me hesitant to move somewhere else.
So thanks Automattic… but no thanks. Time to speed up the plans for migrating to fugitive…