tag:blogger.com,1999:blog-5215777427512085470.post8988838466917293294..comments2024-03-03T13:58:48.711+05:30Comments on Android Developers Blog: Crop image in circular shape in androidMukesh Kumarhttp://www.blogger.com/profile/02072401063614368529noreply@blogger.comBlogger39125tag:blogger.com,1999:blog-5215777427512085470.post-72568169697297041302016-03-03T21:55:27.726+05:302016-03-03T21:55:27.726+05:30Hi Mukesh Yadav,
Can u please update this post. ...Hi Mukesh Yadav, <br /><br />Can u please update this post. My email id is okky.agung.w@gmail.com. if u don't mind can i get the source code.<br /><br />ThanksAnonymoushttps://www.blogger.com/profile/04983533054325794223noreply@blogger.comtag:blogger.com,1999:blog-5215777427512085470.post-89984028813599231042015-07-30T14:15:43.159+05:302015-07-30T14:15:43.159+05:30hellor sir ..i m new here.
i want to perform a tas...hellor sir ..i m new here.<br />i want to perform a task for my app in which user can select image from gallery or camera and crop it and display ....can u help me in doing this task please<br />Anonymoushttps://www.blogger.com/profile/06490274982997667373noreply@blogger.comtag:blogger.com,1999:blog-5215777427512085470.post-70865147467393982102014-06-12T18:03:54.779+05:302014-06-12T18:03:54.779+05:30Thanks, Great tutorial!Thanks, Great tutorial!Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-5215777427512085470.post-60283089366422402482014-04-10T15:50:05.639+05:302014-04-10T15:50:05.639+05:30thanks Mukeshthanks Mukeshjayhttps://www.blogger.com/profile/05503423372477868638noreply@blogger.comtag:blogger.com,1999:blog-5215777427512085470.post-63020087242458506742014-03-22T17:43:36.642+05:302014-03-22T17:43:36.642+05:30hey mukesh can you help me ??
i have set the image...hey mukesh can you help me ??<br />i have set the image in circle and now i want to set border around the image??<br />So help me by providing solutionAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-5215777427512085470.post-76873149643402882572014-02-27T18:42:07.540+05:302014-02-27T18:42:07.540+05:30Hey thanks for posting this.
but precision of imag...Hey thanks for posting this.<br />but precision of image is not clear .and when i am using this code <br /><br /> Bitmap targetBitmap = Bitmap.createBitmap(targetWidth, <br /> targetHeight,Bitmap.Config.ARGB_8888);<br /><br /> Canvas canvas = new Canvas(targetBitmap);<br /> final Paint paint = new Paint();<br /> paint.setAntiAlias(true);<br /> paint.setFilterBitmap(true);<br /> paint.setDither(true);<br /> <br /> paint.setAntiAlias(true);<br /> canvas.drawARGB(0, 0, 0, 0);<br /><br /> Bitmap sourceBitmap = scaleBitmapImage;<br /> final Rect rect = new Rect(0, 0, sourceBitmap.getWidth(), sourceBitmap.getHeight());<br /> //final RectF rectF = new RectF(rect);<br /> canvas.drawCircle(((float) targetWidth - 1) / 2,<br /> ((float) targetHeight - 1) / 2,<br /> (Math.min(((float) targetWidth), <br /> ((float) targetHeight)) / 2), paint);<br /> paint.setXfermode(new PorterDuffXfermode(Mode.SRC_IN));<br /> canvas.drawBitmap(sourceBitmap, <br /> rect, <br /> rect, paint);<br />precision is clear but it is not crop center can you help meAnonymoushttps://www.blogger.com/profile/07505165472975959084noreply@blogger.comtag:blogger.com,1999:blog-5215777427512085470.post-87154664212735189162014-01-24T12:09:41.861+05:302014-01-24T12:09:41.861+05:30Hey Mukesh, I have used your code and works perfec...Hey Mukesh, I have used your code and works perfectly fine. But you have fixed the height and width of target bitmap. Due to this my image is displaying small on large screen size. <br />Please Help...!!!!Anonymoushttps://www.blogger.com/profile/02210725240908615096noreply@blogger.comtag:blogger.com,1999:blog-5215777427512085470.post-47610358965141669372013-11-20T14:43:38.668+05:302013-11-20T14:43:38.668+05:30Hello Mukesh, it is a very nice tutorial....
can y...Hello Mukesh, it is a very nice tutorial....<br />can you help me out to make this kind of shape<br /><br />http://fiddle.jshell.net/x4pVy/404/show/Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-5215777427512085470.post-87911391543927845902013-10-05T07:50:17.771+05:302013-10-05T07:50:17.771+05:30Hello Mukesh,
I am using your source code from gi...Hello Mukesh,<br /><br />I am using your source code from git.<br />after it execute line <br /><br />startActivityForResult(cropIntent, PIC_CROP); <br /><br />in performcrop() function, its not entering onActivityResult() fuction. <br /><br />I can see that it is failing at line <br /><br />if (resultCode == RESULT_OK) <br />[ while its not failing at this line when onActivityResult() is being called by startActivityForResult(captureIntent, CAMERA_CAPTURE); line ]<br /><br />Any idea why its happening.<br /><br />I am using Eclipse and virtual device manager. Newbiehttps://www.blogger.com/profile/13966867651476776935noreply@blogger.comtag:blogger.com,1999:blog-5215777427512085470.post-18548227511987811562013-09-15T23:49:15.442+05:302013-09-15T23:49:15.442+05:30Hi Mukesh
I added the above code in my application...Hi Mukesh<br />I added the above code in my application. But its not working. Can you please figure out where I am doing wrong.<br />I am calling a function crop2 on clicking of a button.<br />code is here --<br />http://paste.ubuntu.com/6111641/<br />Newbiehttps://www.blogger.com/profile/13966867651476776935noreply@blogger.comtag:blogger.com,1999:blog-5215777427512085470.post-16934475068242710692013-08-08T21:56:34.358+05:302013-08-08T21:56:34.358+05:30Hi,
I want to be able to zoom into the image and ...Hi,<br /><br />I want to be able to zoom into the image and have the circle also increase in size, basically pinch the image, have it zoom in as well as circle.<br /><br />Any idea how I could do this?<br /><br />Thanks<br />AAAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-5215777427512085470.post-22276335155981009472013-07-04T11:05:33.865+05:302013-07-04T11:05:33.865+05:30Hello Friends, I just uploaded the complete source...Hello Friends, I just uploaded the complete source code on my git repository, you can find it here:<br />https://github.com/mukesh4u/Mukesh Kumarhttps://www.blogger.com/profile/02072401063614368529noreply@blogger.comtag:blogger.com,1999:blog-5215777427512085470.post-68852123806574658002013-07-02T16:51:36.747+05:302013-07-02T16:51:36.747+05:30Mukesh it would have been appreciable if you could...Mukesh it would have been appreciable if you could provide some code for scaling as it has been showing vm out of memory issue to many using the above code.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-5215777427512085470.post-49920932656928571552013-07-02T14:29:42.734+05:302013-07-02T14:29:42.734+05:30Hello Shankar,
Sure, soon I will upload the comple...Hello Shankar,<br />Sure, soon I will upload the complete code.Mukesh Kumarhttps://www.blogger.com/profile/02072401063614368529noreply@blogger.comtag:blogger.com,1999:blog-5215777427512085470.post-72979902006180547352013-07-02T14:25:08.033+05:302013-07-02T14:25:08.033+05:30Hi Mukesh Yadav,
Can u please update this post. ...Hi Mukesh Yadav, <br /><br />Can u please update this post. My email id is shankarraopilli@gmail.com. if u don't mind can i get the source code.<br /><br />Really i didn't get ur post.Anonymoushttps://www.blogger.com/profile/03162417600999731410noreply@blogger.comtag:blogger.com,1999:blog-5215777427512085470.post-71209557543093001962013-07-02T11:25:05.451+05:302013-07-02T11:25:05.451+05:30Sure , I will update the blog with complete runnin...Sure , I will update the blog with complete running code....<br />Mukesh Kumarhttps://www.blogger.com/profile/02072401063614368529noreply@blogger.comtag:blogger.com,1999:blog-5215777427512085470.post-18997221225507117222013-07-01T22:34:20.911+05:302013-07-01T22:34:20.911+05:30Hey Bro,
Great post I was looking for something si...Hey Bro,<br />Great post I was looking for something similar for hours!!!<br /><br />One problem I cant see all the code and modifications (blank... =\)<br />can you send the example code to -misterish86@gmail.com ?<br /><br />TNX again, def going to my fav bar... =)<br />keep up the good work, <br />cheers.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-5215777427512085470.post-59084921188070144122013-06-28T18:44:12.206+05:302013-06-28T18:44:12.206+05:30Hi mukesh can u suggest me how will i go about it ...Hi mukesh can u suggest me how will i go about it or provide some code since i do not know how much to scale it<br />Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-5215777427512085470.post-74636726189082623882013-06-25T23:06:43.735+05:302013-06-25T23:06:43.735+05:30HI,
The out Of Memory error occur because of the l...HI,<br />The out Of Memory error occur because of the large bitmap size, try to scale bitmap image and then crop.Mukesh Kumarhttps://www.blogger.com/profile/02072401063614368529noreply@blogger.comtag:blogger.com,1999:blog-5215777427512085470.post-34466192742080652902013-06-25T19:09:31.810+05:302013-06-25T19:09:31.810+05:30Do u have any idea Mukesh why am i encountering su...Do u have any idea Mukesh why am i encountering such a issue since my app crashes because of it?Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-5215777427512085470.post-17602212254960693102013-06-25T18:20:00.222+05:302013-06-25T18:20:00.222+05:30Also using the above code gives me error
Caused b...Also using the above code gives me error <br />Caused by: java.lang.OutOfMemoryError<br />at android.graphics.Bitmap.nativeCreate(Native Method),at android.graphics.Bitmap.createBitmap(Bitmap.java:551),at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:437)Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-5215777427512085470.post-17248724755029745942013-06-13T13:27:41.503+05:302013-06-13T13:27:41.503+05:30Yes Mukesh I just replaced and checked.However aft...Yes Mukesh I just replaced and checked.However after setting the image i cannot see the border i have used your above method getRoundedShape() and changed the targetWidth and targetHeight to 150 dp also tried using 50dp but still only the image is visible not the border around it.<br />Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-5215777427512085470.post-68466426069532645162013-06-13T10:24:15.948+05:302013-06-13T10:24:15.948+05:30hello, have you tried using "Oval" in xm...hello, have you tried using "Oval" in xml, how its look like ?Mukesh Kumarhttps://www.blogger.com/profile/02072401063614368529noreply@blogger.comtag:blogger.com,1999:blog-5215777427512085470.post-13189130458869391772013-06-10T19:35:27.773+05:302013-06-10T19:35:27.773+05:30Hey Mukesh thanks for your quick replay.However th...Hey Mukesh thanks for your quick replay.However the border visible now is a rectangular one.I needed some thing like this.If possible could you tell me how to achieve it. <br />http://stackoverflow.com/questions/14050813/how-to-make-an-image-fit-into-a-circular-frame-in-androidAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-5215777427512085470.post-71032915947767288812013-06-10T13:52:00.175+05:302013-06-10T13:52:00.175+05:30Hello Friends,
Now check the code I just added th...Hello Friends,<br /><br />Now check the code I just added the code for adding border around the image.Mukesh Kumarhttps://www.blogger.com/profile/02072401063614368529noreply@blogger.com