I am trying to write an image/png in an ESRI FileGDB field.
I use the Esri.FileGDB.API 1.4, both 32/64, in C#.
The type of the field is "esriFieldTypeBlob".
I am currently able to write the image, without errors, as follows:
Table table = gdb.OpenTable(tablename);
Row newRow = table.CreateRowObject();
byte[] fba = null;
System.Drawing.Image img = System.Drawing.Image.FromFile(imgpath);
using (MemoryStream ms = new MemoryStream()) {
img.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
fba = ms.ToArray();
}
ByteArray ba = new ByteArray((uint) fba.Length);
ba.byteArray = (byte[]) fba.Clone();
newRow.SetBinary(fieldname, ba);
table.Insert(newRow);
But when I re-read the field using GetBinary, the ByteArray is 0 length.
What am I doing wrong?
Has anyone had the same problem?