# TIP: Understand Image Masking Performance

DevFeed: [TIP: Understand Image Masking Performance](<https://devfeed.tech/articles/tip-understand-image-masking-performance-19602.md>)

Original publisher: [Read original article](<https://www.codenameone.com/blog/tip-understand-image-masking-performance/>)

Author: Shai Almog

Published: 2017-05-28T00:00:00Z

Content type: tutorial

Language: en

Sources: [CodeName One](<https://devfeed.tech/sources/codename-one.md>)

Topics: [Image](<https://devfeed.tech/topics/image.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [code](<https://devfeed.tech/tags/code.md>), [design](<https://devfeed.tech/tags/design.md>), [image](<https://devfeed.tech/tags/image.md>), [images](<https://devfeed.tech/tags/images.md>), [performance](<https://devfeed.tech/tags/performance.md>)

## AI overview

The article explains image masking for adapting externally sourced images to designs such as circular crops and complex alpha-channel shapes. It discusses implementation approaches and notes that masking during rendering is expensive, while applying the mask during download can reduce later usage costs by storing the masked image.

## Source excerpt

Image masking allows us to adapt an image which we acquired from an external source to fit our design e.g. if we want to show an image cropped to a circle we could apply a mask to it in order to get an intelligent crop. This is a very powerful tool as a designer can supply a hardcoded mask image and build some pretty complex shapes that include an alpha channel as well (making it superior to shape clipping).