Implemented downsampling for Android.