Regions can be saved inside TIFF files. Whenever you save an image containing a region as a TIFF file format, the region is also saved. Note, however, that the ability to save a region inside a TIFF file must be unlocked. This requires the Document Imaging Toolkit, Document Imaging Suite, Medical Imaging Toolkit, or Medical Imaging Suite.
When you save an image with a region as a CUR or ICO file, the pixels inside the region are considered to belong to the icon/cursor data. The pixels outside the region are considered transparent. If you save an image without a region as a CUR or ICO file, the whole image will be considered icon/cursor data. In this case, you will get a square icon or cursor.
If you save an image with a region as any other file format, the region will be lost. If you want to preserve the region, you can:
Save it to a 1-bit mask using the CreateMaskFromRegion method and save the mask as a separate file. When you load the image, you should load the mask bitmap and set the region using the AddMaskToRegion method. Save it to the alpha information in a 16/32-bit image. You would convert the region to a 1-bit mask using the CreateMaskFromRegion method, after which you would set the mask to the alpha channel using the AddMaskToRegion method. During load, you would get the alpha image with the CreateAlphaImage method, convert it to 1-bit if necessary and then set the region with the CreateMaskFromRegion method.
Related topics: