So I know how to edit TIFF tags (get a propertyItem object, edit its details, and stick it into a bitmap), but saving them is presenting itself as a problem.
After I'm done drawing on the bitmap, I convert it to 1bbp, then stick the propertyItems onto the bitmap. I've checked, and I can see each of the propertyItems I've put into the bitmap. I then save the file using the TIFF encoder and CCITT4 compression.
When I actually look at the tags, all that's there are the default tags generated by the TIFF encoder.
A little snippit of my code:
Expand|Select|Wrap|Line Numbers
- System.Drawing.Imaging.Encoder comp = System.Drawing.Imaging.Encoder.Compression;
- EncoderParameters parms = new EncoderParameters(1);
- parms.Param[0] = new EncoderParameter(comp,(long)EncoderValue.CompressionCCITT4);
- ImageCodecInfo info = GetEncoder(ImageFormat.Tiff);
- PropertyItem fillorder = resourceBitmap.GetPropertyItem(256);
- fillorder.Id = 266;
- fillorder.Len = 1;
- fillorder.Type = 4;
- fillorder.Value = new byte[1] { 1 };
- PropertyItem imageDescription = resourceBitmap.GetPropertyItem(256);
- imageDescription.Id = 270;
- imageDescription.Value = new byte[0] { };
- imageDescription.Len = 0;
- imageDescription.Type = 4;
- PropertyItem orientation = resourceBitmap.GetPropertyItem(256);
- orientation.Id = 274;
- orientation.Value = new byte[1] { 1 };
- orientation.Len = 1;
- orientation.Type = 4;
- PropertyItem t6option = resourceBitmap.GetPropertyItem(256);
- t6option.Id = 293;
- t6option.Value = new byte[1] { 0 };
- t6option.Len = 1;
- t6option.Type = 4;
Expand|Select|Wrap|Line Numbers
- workingFront.SetPropertyItem(fillorder);
- workingFront.SetPropertyItem(imageDescription);
- workingFront.SetPropertyItem(orientation);
- workingFront.SetPropertyItem(t6option);
- workingFront.Save(outFile, info, parms);