Reputation: 4672
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?
Upvotes: 3
Views: 375
Reputation: 4672
I think I have found the answer to this.
The colour space is recorded in the image's PropertyItems
It 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.PropertyItem
class does not have a public constructor. So it is not possible to create a new PropertyItem
. 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 a PropertyItem
?
It also says in the documentation that if I wish to create a new PropertyItem
that I should get an existing PropertyItem
, clone it, edit the clone, and add the clone to PropertyItems
. However if I am creating a new image there will not be any existing PropertyItems
. So how am I supposed to add a PropertyItem
that declares a colour space?
Upvotes: 1