Reputation: 1493
Can we change Sitecore's Media Option default background colour into White? By default it's Black.
Otherwise when I need image, I have to say always, background color is White.
Sitecore.Resources.Media.MediaUrlOptions mediaUrlOptions = new Sitecore.Resources.Media.MediaUrlOptions(this.GetCurrentDatabase, false)
{
Width = 480,
Height = 360,
BackgroundColor = System.Drawing.Color.White
};
Upvotes: 0
Views: 1793
Reputation: 13141
This setting in the web.config should do the trick:
<!-- MEDIA - DEFAULT IMAGE BACKGROUND COLOR
The default background color for dynamically resizing images to different aspect ratios than the originals.
Sitecore applies this background color only for image types that do not support transparency (image/jpeg, image/gif and image/bmp).
When resizing any other image types (including image/png), Sitecore always applies a transparent background.
You can specify a color name (such as Black or Red) or a hex color code (such as #CE55E2).
If you specify no value, Sitecore applies a black background color when resizing such images.
Default value: ""
-->
<setting name="Media.DefaultImageBackgroundColor" value="White" />
Upvotes: 4