I want to display image in round shape and I am able to display user image in round shape, but not able to manage the image quality.Image is getting shrinked.I am trying to test it in android device.
Titanium Studio, build: 3.4.1.201410281727 Build: jenkins-titanium-rcp-master-202
http://i60.tinypic.com/23hq9lv.png
My code is as follows.
//=================================================== <View id="userpiceView"> <ImageView id="userImage" onClick="chooesPic"></ImageView> </View> //=================================================== "#userpiceView":{ left : "10%", width: 84, height: 84, borderRadius: 42, borderColor: '#f05323', borderWidth: 3, } "#userImage":{ autorotate: true, image: "/images/defaultuser.png", defaultImage: "/images/defaultuser.png", } //=================================================== function chooesPic() { Titanium.Media.openPhotoGallery({ mediaTypes : [Ti.Media.MEDIA_TYPE_PHOTO], success : function(event) { var imageG = event.media; Ti.API.info("before" + imageG.height + " x " + imageG.width); Ti.API.info("before" + imageG.length); try{ var imgBlob = imageG.imageAsResized(300,300); imageG=null; Ti.API.info("after imgBlob " + imgBlob.height + " x " + imgBlob.width); $.userImage.image=imgBlob; imgBlob=null; }catch(e){ Ti.API.info("Image conversion error"+e ); } if (event.mediaType == Ti.Media.MEDIA_TYPE_PHOTO) { var filename = Titanium.Filesystem.applicationDataDirectory + "/" + 'camera_photo' + new Date().getTime() + ".png"; var f = Titanium.Filesystem.getFile(filename); if (f.exists()) { f = Titanium.Filesystem.getFile(filename); } f.write(imageG); pathfromgallery = f.nativePath; } } }); }