You can get the overlay icon like this:
int actualSize;
byte[] iconData = Library.HostServices.GetIcon(
Library.IconBasePath,
null,
"your-icon-name",
16,
out actualSize);
As CreateThumbnailOverlay requires a stream, you need to create a memory stream. So the code will look something like this:
using (MemoryStream iconStream = new MemoryStream(iconData, false))
{
// This implies item is a MultiMediaItem already loaded and GetContent
// returns an actual image, if not you need to get the main thumbnail
// image by other means
IContentResult content = item.GetContent(null);
try
{
IList<IThumbnailOverlay> overlays = new List<IThumbnailOverlay>
{
// maxWidth and maxHeight specifies the requested thumbnail size,
// so this icon is placed in the lower left corner.
Library.HostServices.CreateThumbnailOverlay(
0,
maxHeight - actualSize,
actualSize,
actualSize,
iconStream)
};
return Library.HostServices.CreateThumbnailImage(
maxWidth,
maxHeight,
content.Stream,
maxWidth,
maxHeight,
overlays);
}
finally
{
content.Stream.Close();
}
}
Tridion thumbnails do not display overlays for checked out etc. This is the reason ECL doesn't add the overlays automatically.
You can of course manipulate the bytes directly - but as ECL runs in a Windows service you can't use the classes within System.Drawing. You can use the WPF classes, but these require an STA thread.
There might be a third party library you can use to manipulate images on a MTA thread, but unless you require something more than just overlaying images I would recommend sticking to the methods provided by ECL.