<p dir="auto">Glide allows to do center-crop from a file, as such:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="                Glide.with(this).asBitmap().load(someFile)
                        .apply(RequestOptions.centerCropTransform().skipMemoryCache(true).diskCacheStrategy(DiskCacheStrategy.NONE))
                        .into&lt;SimpleTarget&lt;Bitmap&gt;&gt;(object : SimpleTarget&lt;Bitmap&gt;(width, height) {
                            override fun onResourceReady(resource: Bitmap, transition: Transition&lt;in Bitmap&gt;?) {
                                _bitmap = resource
                            }

                            override fun onLoadFailed(errorDrawable: Drawable?) {
                                super.onLoadFailed(errorDrawable)
                            }
                        })"><pre class="notranslate"><code class="notranslate">                Glide.with(this).asBitmap().load(someFile)
                        .apply(RequestOptions.centerCropTransform().skipMemoryCache(true).diskCacheStrategy(DiskCacheStrategy.NONE))
                        .into&lt;SimpleTarget&lt;Bitmap&gt;&gt;(object : SimpleTarget&lt;Bitmap&gt;(width, height) {
                            override fun onResourceReady(resource: Bitmap, transition: Transition&lt;in Bitmap&gt;?) {
                                _bitmap = resource
                            }

                            override fun onLoadFailed(errorDrawable: Drawable?) {
                                super.onLoadFailed(errorDrawable)
                            }
                        })
</code></pre></div>
<p dir="auto">That's in case we want to crop from the center.</p>
<p dir="auto">But what if we want to crop from somewhere else? And from a specific region, while keeping the aspect ratio of this region?</p>
<p dir="auto">For example, suppose we have 1000x1000 image, and I want to crop a 200x400 part of it.<br>
For keeping aspect ratio of the cropping part, this means that even if I go outside of the source image, it will move (or resize if really needed) the cropping to make it right.</p>
<p dir="auto">This means that if for some reason I tell it to crop from 899 in X coordinate, it might actually move the cropping to start from 799, instead of from 899 .</p>
<p dir="auto">The sort of protection like of center-crop...</p>
<p dir="auto">Similar to BitmapRegionDecoder class.</p>