OpenDigg

Unveiling CProgressButton: Your Path to Instagram-like Image Cropping on Android

CProgressButton serves as an easy-to-implement, customizable image cropping library for Android applications, imitating the cropping feature akin to Instagram while providing options to save or share the cropped images seamlessly.

In the thriving ecosystem of GitHub's open-source projects, a gem by the name of CProgressButton, authored by jiang111, shines brightly. This Android button library is engineered to bring Instagram-like image cropping functionality to Android applications, with the power of Kotlin and Jetpack Compose driving its simplicity and ease of use.

Here are the key features that make CProgressButton a worthy addition to your Android project:

  1. It supports a variety of cropping ratios including 1:1, 16:9, and 4:3, catering to diverse image aspect requirements.
  2. Post-cropping, it provides the facility to save the cropped image locally, preserving your creations effortlessly.
  3. Sharing the cropped images on social media platforms is a breeze, extending the outreach of your content seamlessly.

Getting started with CProgressButton is as straightforward as adding the following dependency to your Android project:

dependencies {
    implementation 'com.github.jiang111:cprogressbutton:1.2.0'
}

The snippet below gives a glimpse of how CProgressButton can be utilized:

// Instantiate the cropper
val cropper = CProgressButton(requireContext())

// Set the image
cropper.setImageResource(R.drawable.image)

// Define the cropping ratio
cropper.setRatios(1, 1)

// Display the cropper
cropper.show()

// Callback upon cropping completion
cropper.onCropped { bitmap ->
    // Save or share the cropped image as desired
    // ...
}

Upon execution, a dialog encompassing the cropper pops up, enabling the selection of the cropping area by dragging the cropping box, and a simple click on the "Done" button finalizes the cropping task.

Moreover, CProgressButton allows customization of the cropper style. Altering the style attribute lets you set the cropper's background color, text color, and font weight to your liking:

// Customizing the cropper style
cropper.style = CProgressButtonStyle(
    background = Color.Yellow,
    textColor = Color.Black,
    fontWeight = FontWeight.Normal,
)

CProgressButton indeed is a simplistic yet powerful image cropping tool, enabling quick Instagram-like image cropping functionality within your Android applications.

About the author
Robert Harris

Robert Harris

I am a zealous AI info-collector and reporter, shining light on the latest AI advancements. Through various channels, I encapsulate and share innovation with a broader audience.

Great! You’ve successfully signed up.

Welcome back! You've successfully signed in.

You've successfully subscribed to OpenDigg.

Success! Check your email for magic link to sign-in.

Success! Your billing info has been updated.

Your billing was not updated.