PNGcrush + bash = LosslessLove
April 4th, 2007Last post I used Pngcrush to compress a set of images. I thought I’d just post the scripts I use almost daily to keep my PNG assets lean.
Honestly I wish Pngcrush had these options without the need for crazy bash find or for-loops. But hey, It does one thing and does it well. I’m not complaining for its awesomeness.
All of these scripts use the –brute option which brute forces its way through numerous compression options until it finds the most effective way to describe your image in PNG for the smallest filesize.
Compress all PNG’s in a directory and replace them with compressed version
for i in *.png;do  pngcrush -brute -d tmp "$i" ; done; mv -f tmp/* .; rm -rf tmp
Compress PNG’s and put them in a new directory called ‘tmp’
find * -name "*png" -execdir pngcrush -d tmp {} ;
Recursively explore directories for PNG’s and compress then replace with compressed version
for file in `find . -name "*.png"`;do  echo $file;  pngcrush -brute "$file" tmp_img_file.png;  mv -f tmp_img_file.png $file; done;
Creating international graphics
April 3rd, 2007I’m going to show you how to internationalize your graphics using inkscape and the gnome desktop.

Prior Considerations
Translations are always going to be variable length.
What might look short and snappy in Simplified Chinese may be a whole sentence to explain in Brazillian Portugese.
For this reason you should create designs with generous amounts of space around your words.
With SVG you may need to define a flowtext region. This is done in Inkscape by selecting the text tool and dragging. Centering text also works a treat.
We’re going to be creating .po files for translation without the need of opening the entire SVG XML or editing with inkscape. If you work with a translation community, this is much more considerate than throwing them headfirst into a text editor or inkscape.
Right, so here we go
Say we have a web graphic, a presentation, an advertisement, diagram whatever.
We’re going to translate it into 23 languages and walkaway unharmed.
Something to avoid is duplicating editable text.
You might want a drop shadow, blurred mask or some other effect layered above or behind your text. If so, make sure you clone (<use>) and not copy. You may be getting free translations from the community, it helps to not make them type the same phrase over and over again.
xml2po to the rescue
gnome-doc-utils sure is a beautiful package. The awesome GNOME developers have created a tool that will pull strings of text from your xml document and issue them as strings in a pofile.
Here is a test file for you to use for this exercise. Make sure you right click the link and select “save link as”.
xml2po -a -o en-US.po chrome.svg
Create locale specific po files
We’re just going to copy the upstream po file and rename it as per each locale.
cp en-US.po as-IN.po cp en-US.po bn-IN.po cp en-US.po de-DE.po cp en-US.po es-ES.po cp en-US.po fr-FR.po cp en-US.po gu-IN.po cp en-US.po hi-IN.po cp en-US.po it-IT.po cp en-US.po ja-JP.po cp en-US.po kn-IN.po cp en-US.po ko-KR.po cp en-US.po ml-IN.po cp en-US.po mr-IN.po cp en-US.po or-IN.po cp en-US.po pa-IN.po cp en-US.po pt-BR.po cp en-US.po ru-RU.po cp en-US.po si-LK.po cp en-US.po ta-IN.po cp en-US.po te-IN.po cp en-US.po zh-CN.po cp en-US.po zh-TW.po
Translate the po files
kbabel or gtranslator are the apps of choice for many open source translators. They will open up your pofiles and give friendly preview of only the text strings in your SVG and nothing else.

A word of warning. The depth of text in your SVG reflects the order the strings will appear in your pofiles.
This means you may confuse the logical flow of text by arranging text above or below shapes. Text sent to the bottom depth is displayed at the start of the generated pofile.
Another word of warning to your translators
That “image/svg+xml” string you see at the top of each pofile is unfortunately pulled into your pofiles via xml2po and shouldn’t be translated otherwise you may break the validity of your SVG.
Time to merge translated pofiles back into SVG
Once your pofiles are given the all clear from translators you can generate the translation changes back into svg files specific to their locale.
xml2po -a -p en-US.po chrome.svg > chrome-as-IN.svg xml2po -a -p as-IN.po chrome.svg > chrome-as-IN.svg xml2po -a -p bn-IN.po chrome.svg > chrome-bn-IN.svg xml2po -a -p de-DE.po chrome.svg > chrome-de-DE.svg xml2po -a -p es-ES.po chrome.svg > chrome-es-ES.svg xml2po -a -p fr-FR.po chrome.svg > chrome-fr-FR.svg xml2po -a -p gu-IN.po chrome.svg > chrome-gu-IN.svg xml2po -a -p hi-IN.po chrome.svg > chrome-hi-IN.svg xml2po -a -p it-IT.po chrome.svg > chrome-it-IT.svg xml2po -a -p ja-JP.po chrome.svg > chrome-ja-JP.svg xml2po -a -p kn-IN.po chrome.svg > chrome-kn-IN.svg xml2po -a -p ko-KR.po chrome.svg > chrome-ko-KR.svg xml2po -a -p ml-IN.po chrome.svg > chrome-ml-IN.svg xml2po -a -p mr-IN.po chrome.svg > chrome-mr-IN.svg xml2po -a -p or-IN.po chrome.svg > chrome-or-IN.svg xml2po -a -p pa-IN.po chrome.svg > chrome-pa-IN.svg xml2po -a -p pt-BR.po chrome.svg > chrome-pt-BR.svg xml2po -a -p ru-RU.po chrome.svg > chrome-ru-RU.svg xml2po -a -p si-LK.po chrome.svg > chrome-si-LK.svg xml2po -a -p ta-IN.po chrome.svg > chrome-ta-IN.svg xml2po -a -p te-IN.po chrome.svg > chrome-te-IN.svg xml2po -a -p zh-CN.po chrome.svg > chrome-zh-CN.svg xml2po -a -p zh-TW.po chrome.svg > chrome-zh-TW.svg
Now you have a directory of svg images the same as your upstream.
Export Images
If you are working with an environment that deals with PDF’s, you may want to ignore this step.
SVG’s are best sent through things like Batik when using FOP to create a pdf rather than rendered PNG for obvious reasons (vector=love)
If you are exporting to web or something else and want to be friendly to software that cant read your Inkscape crafted SVG:
This is the step for you.
for i in *.svg;do inkscape -e "${i/.svg/.png}" "$i" ;done
Compressing PNG’s
Of course on the web every byte counts
pngcrush will give you the best file size without losing a pixel.
for i in *.png;do pngcrush -brute -d tmp "$i" ;done; mv -f tmp/* .; rm -rf tmp



Benefits of using this technique…
If you are a creating technical illustrations or diagrams you may want to alter your upstream version (In this case: en-US) as the conceptual changes.
Thankfully xml2po will regenerate translations from upstream regardless of new objects you create, styles you change or transformations you make to your original. This is wonderful for when management ask for their illustrations to be larger and changed to cornflower blue. More on automating that sort of thing across a set in a later post.
UPDATE:
My good mate prokoudine has ported this article to RU
Open Fonts + i18n
March 30th, 2007While reviewing the submissions for the Open Font Library logo competition we came across many concepts that nicely tied into the OpenClipart aesthetic. That was great.
We also noticed a tenancy to use glyphs from other scripts which was great but this really limits the brand for those coming from other nationalities who’s alphabet didn’t make it into the 3 used in the logo.
The best way to deal with this? Make a derivative logo for all locales!
As an exercise I took one submission by Marty, cleaned up the aesthetic a little and had it translated in 23 languages :-).
Considering I know only English and dumb English (translated here), It’s a privilege to have brilliant translators as colleagues.









Tools:
Inkscape (design)
XML2PO (conversion from SVG into pofiles )
RSVG locale specific style tweaks+rendering),
UPDATE:
I’ve published the major part of the technique for creating these translatable graphics here.
Forgot to mention.
March 26th, 2007Forgot to mention.
A while back I got called up for an aussie round-table on FOSS Graphic design for a podcast.
My latest contribution to idiocracy
March 26th, 2007Costume party on the weekend and the host actually put a video of me on youtube. scandal.
For those still confused.
To everyone’s time I wasted I’m sorry. I’m sure thats all of you.
ATTN: White-paper authors
March 19th, 2007Do you publish PDF’s of marketing collateral showcasing free software?
I’ve noticed that not everyone eats their own dogfood!..
and There are some unlikely offenders.
There are plenty of ways to generate quality materials from free software. Below are some properties screens that let you know the creator cares about FOSS.



People dont just pay for propietary software with the price tag. You pay for it by looking like a dweeb who uses another platform to the one they promote:

The final irony here being that I took those screenshots in the linux version of acroread.
I test with acroread because printers render with the same output.
For everything else there’s poppler with evince
Three gigs I recently caught
March 15th, 2007- NOFX - Don’t like my city
- Bodyjar - Know how to please a crowd
- The Mars Volta - Are truly artists. I am speechless. Karla is blown away.
I’m a big fan of forks/branches in free software: Beryl, Inkscape, Xorg.. Well, It seems Mars Volta is a ‘fork’ of At the drive in which went on to become Sparta. Two great bands evolving into two contrasting great sounds. Congrats to them both.
Mockscape
March 6th, 2007For the potential/past creators of gimp mockups in gimp..
Inkscape brings you : inkscape mockups with inkscape!
Well actually bryce put on the development roadmap for this release that we need to deliver some small mockups demonstrating animation functionality.
( just so we’re thinking about it )
I’ve decided to illustrate inkscape’s UI within inkscape so that others can have a play with creating their ultimate (yet simple) animators UI.
Here is the complete svg version for everything. Add a comment, jump on irc or the mailing list. just send in your ideas. Have fun!
Everyone knows mockups are a compelling attachment to feature requests.. so I decided to put a tiny request in for the fill and stroke dialogs no formatting state.

I also took the opportunity to draw up a feature request for gtk theme / window decorator designers *hint hint* . I mean the draw functions are specified in the SVG so if someone with a little too much cairo-fu and time on their hands wants to write an theme engine… go right ahead
The dark grey version requires semitransparent background but fully opaque widgets ( this actually cant be done easily to my knowledge )
foss design round table
March 1st, 2007Just a quick mention that James of linux australia podcast fame just held a graphic design round-table
Things I wish I mentioned: gimp, scribus, fontforge & libregraphics efforts

