Optimize images
Add Preferences class template
Add option to generate sample code in PrefsClass