Solution 1 :
I’d consider to use Transformation API for your case. Here a good examples how to use different transformation
I’m loading image by url to ImageView using coil.
val request = ImageRequest.Builder(context) .data(imageUrl) .allowHardware(false) .size(Size.ORIGINAL) .target(ImageViewTarget(imageView)) .build() request.context.imageLoader.enqueue(request)
In my custom ImageViewTarget i’m overridding
fun onSuccess(result: Drawable) to pick the color of uploaded image with Palette api.
Then I need to transform the loaded image: crop it to round shape and draw the border in contrasting color (for examle, if background of icture is white, the border should be black). What is the optimal way to make this transformation?