Azure Websites

Aug 12, 2014 at 10:15 AM
For info I had problems using HTMLRenderer on Azure Websites for rendering HTML to image. MS has some known issues with GDI and Azure Websites and their fixes are a work in progress.
( eg

Rendering on a Free Azure Website resulted in an Out Of Memory Exception because handles are not available. Rendering on a Basic Azure Website resulted in black or empty images being saved to stream.

However, if you use RenderToImageGdiPlus it works both on Free and Basic/Standard as far as I can see.
Aug 13, 2014 at 6:49 AM
make sense, that's why it supports both GDI and GDI+ so the proper one can be used.
Thx for sharing this.
May 26, 2015 at 7:50 AM
Hey guys,
I'm getting the same problem whereby our images are showing up black after we migrated a custom site across to Azure.

I've noticed that the code is using the GDI and we are on a Standard plan.

Are you able to advise how you used the RenderToImageGdiPlus our code is using HtmlRender.RenderToImage to get an image object and then trying to save that to the uploads directory. I can't see anyway to make it use the RenderToImageGdiPlus.

System.Drawing.Image image = HtmlRender.RenderToImage(sbHtml.ToString(), new Size(250, playlists.Count * 150), PlaylistRendererHelper.BackgroundColor);
image.Save(Server.MapPath(System.Configuration.ConfigurationManager.AppSettings["PlaylistImages"]) + uniquePlaylistId + ".png", ImageFormat.Png);

We use this to create a facebook og image on the fly to share selected playlist images in a site.