Suggested fix for white line around resized images

This is a forum to suggest new features for mojoPortal. 

This thread is closed to new posts. You must sign in to post in the forums.
5/5/2010 1:12:30 AM
Gravatar
Total Posts 39

Suggested fix for white line around resized images

Hi,

Mojo image processing is hardcoded to use a white background fill which means resized images may have a white line around them. This is very noticeable on a black backgrounded site. Other sites I plan to host on the same mojo portal installation will not have a black background.

Could this hardcoded setting be made available as a config setting or similar?

 

In ImageHelper.cs in the method

public static void ResizeImage(string imageFilePath, string mimeType, int maxWidth, int maxHeight, bool allowEnlargement)

The following line of code

graphics.Clear(Color.White);

From http://msdn.microsoft.com/en-us/library/system.drawing.graphics.clear.aspx

This clears the entire drawing surface and fills it with the specified background color

 

Cheers,
Leah

5/5/2010 2:08:50 PM
Gravatar
Total Posts 18439

Re: Suggested fix for white line around resized images

Hi Leah,

I just made it configurable in my copy from Web.config, this will be in svn later tonight. After getting the update you can add a setting in user.config for

DefaultResizeBackgroundColor

It should be a standard named color like White or Black or anything from the NamedColors enum, if something incorrect is entered I think it will use Black. The setting defaults to White.

I tried just commenting out that line but the result is then a black border in the thumbnail, so that line is really trying to get rid of a border but it uses white which blends in more often.

Best,

Joe

5/5/2010 6:31:38 PM
Gravatar
Total Posts 39

Re: Suggested fix for white line around resized images

Hi Joe,

This sounds great. It will allow the diferent background sites to work side by side.

Thanks,
Leah

You must sign in to post in the forums. This thread is closed to new posts.