If I create a bitmap with System.Drawing.Bitmap How can I specify what colour space the bitmap uses? Also how can I make sure the colour profile is embedded when I save the image as a jpeg or tiff?
If I create a bitmap with System.Drawing.Bitmap How can I specify what colour space
Share
I think I have found the answer to this.
The colour space is recorded in the image’s
PropertyItemsIt has an ID of 40961 which is it’s EXIF ID.
So I would presume that adding an instance of this property to a newly created bitmap would give the image a colour space.
There is a big problem though.
System.Drawing.Imaging.PropertyItemclass does not have a public constructor. So it is not possible to create a newPropertyItem. It says in the documentation that PropertyItems are only meant for accessing existing image metadata and not creating metadata. So what if I want to create an entirely new image and assign it a colour space with aPropertyItem?It also says in the documentation that if I wish to create a new
PropertyItemthat I should get an existingPropertyItem, clone it, edit the clone, and add the clone toPropertyItems. However if I am creating a new image there will not be any existingPropertyItems. So how am I supposed to add aPropertyItemthat declares a colour space?