Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Circuler Crop Not working #6

Open
smjunaidkhan opened this issue May 6, 2017 · 1 comment
Open

Circuler Crop Not working #6

smjunaidkhan opened this issue May 6, 2017 · 1 comment

Comments

@smjunaidkhan
Copy link

Hello
i wrote the code bellow but the issue is the result image is always Square not circle .
Please let me know what i am missing.

regards

CookieCutterImageView cookieCutterImageView= (CookieCutterImageView) findViewById(R.id.ivCrop);
     //   cookieCutterImageView.setImageURI(Base64Coverter.carImageUriCropped);
        cookieCutterImageView.init();
        cookieCutterImageView.getParams().setShape(CookieCutterShape.CIRCLE);
        Button btn_cropWheel= (Button) findViewById(R.id.btn_cropWheel);
        btn_cropWheel.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                CookieCutterImageView cookieCutterImageView= (CookieCutterImageView) findViewById(R.id.ivCrop);
                Bitmap img= cookieCutterImageView.getCroppedBitmap();
                ImageView img_cropedWheel= (ImageView) findViewById(R.id.img_cropedWheel);
                img_cropedWheel.setImageBitmap(img);
                FileOutputStream out = null;
                try {
                    out = new FileOutputStream("/storage/emulated/0/wheel.png");
                    img.compress(Bitmap.CompressFormat.PNG, 100, out);
                } catch (Exception e) {
                    e.printStackTrace();
                } finally {
                    try {
                        if (out != null) {
                            out.close();
                        }
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
@PGAndroid
Copy link

PGAndroid commented Dec 15, 2017

If you want to get circular image by using this then you must use this.

Bitmap bitmap = ivCrop.getCroppedBitmap();
Bitmap circularBitmap = ImageUtils.getCircularBitmap(bitmap);
img_cropedWheel.setImageBitmap(circularBitmap);

This will give your image in circle. Also you don't need to use this code

cookieCutterImageView.init();
cookieCutterImageView.getParams().setShape(CookieCutterShape.CIRCLE);

comment that lines.

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants