Autodesk.AutoCAD.DatabaseServices.ObjectId imgDictID = RasterImageDef.GetImageDictionary(db);
DBDictionary imgDict;
if (imgDictID.OldId == 0)
{
imgDictID = RasterImageDef.CreateImageDictionary(db);
}
// test the image dictionary and the raster before going further
Autodesk.AutoCAD.DatabaseServices.ObjectId TestImgDictID = RasterImageDef.GetImageDictionary(db);
imgDict = (DBDictionary)trans.GetObject(imgDictID, OpenMode.ForRead, false);
foreach (DBDictionaryEntry def2 in imgDict)
{
RasterImageDef rasterDef = (RasterImageDef)trans.GetObject(def2.Value, OpenMode.ForRead, false);
string jpegFilename = rasterDef.SourceFileName;
}