Add jpg support for state chart image saving

Changes to Peter's patch:
- Initialize 'quality' variable right away with -1
- Use case insensitive matching for file name end

Fixes #35
Fix type, also make "As" capitalized

Although I remember that prepositions smaller than 4(?) chars are
supposed to be lower case in title style, apparently every application
capitalizes "As" in "Save As" -- so let's to do it as well...
Merge remote-tracking branch 'origin/1.3'