- Moderator
- #781
@BassFan First to you THANK YOU for helping with the plugin
Sorry to everyone who has been waiting for me to finish my house repairs, but that's the problem when there is only one developer on a plugin
Anyway I am looking into the image issue, Really not sure what would be causing the issue as the plugin just reads a file off disk and displays it, there is no magic logic involved.
I don't remember putting in a specific fix for modified images, I will have to try reproduce the error.
The way images work is:
In the plugin, if you are running MPDisplay on the same PC and MP the plugin will send the filename to MPDisplay to render on screen
MPDisplay / MediaPortalPlugin / ImageHelper.cs
On the MPDisplay side it is rendered as a BitmapImage
(MPDisplay / GUIFramework / Managers / GUIImageManager.cs)
As you can see there is not anything extra done to images during creation.
The only thing I could think of would be DPI or Depth, but reading the forum it seems you have checked this.
I need to re-install my development environment this weekend (all filled with dust, LOL) and will see if I can add something, but if you can try different formats, dpi, color palate, depth as well we may be able to avoid custom code for custom images
With the majority(not all) of the repairs to my house done I will have some time for MPDisplay again, and will have more and more time as the repairs are finished. So progress may be still slow on the plugin (I don't even know what's changed in MP 1.7 yet)
sa_ddam213
Sorry to everyone who has been waiting for me to finish my house repairs, but that's the problem when there is only one developer on a plugin
Anyway I am looking into the image issue, Really not sure what would be causing the issue as the plugin just reads a file off disk and displays it, there is no magic logic involved.
I don't remember putting in a specific fix for modified images, I will have to try reproduce the error.
The way images work is:
In the plugin, if you are running MPDisplay on the same PC and MP the plugin will send the filename to MPDisplay to render on screen
MPDisplay / MediaPortalPlugin / ImageHelper.cs
Code:
public static class ImageHelper
{
public static APIImage CreateImage(string filename)
{
string imageFile = File.Exists(filename)
? filename : GUIGraphicsContext.GetThemedSkinFile("\\media\\" + filename);
if (RegistrySettings.InstallType == MPDisplayInstallType.Full)
{
return new APIImage(imageFile);
}
return new APIImage(FileHelpers.ReadBytesFromFile(imageFile));
}
}
On the MPDisplay side it is rendered as a BitmapImage
(MPDisplay / GUIFramework / Managers / GUIImageManager.cs)
Code:
/// <summary>
/// Gets a BitmapImage from tshe specified filename.
/// </summary>
/// <param name="filename">The filename.</param>
/// <returns></returns>
public static BitmapImage GetImage(string filename)
{
try
{
if (!string.IsNullOrWhiteSpace(filename) && File.Exists(filename))
{
BitmapImage bmImage = new BitmapImage();
bmImage.BeginInit();
// bmImage.DecodePixelWidth = GetScaledImageWidth(filename);
bmImage.CacheOption = BitmapCacheOption.None;
bmImage.UriSource = new Uri(filename, UriKind.RelativeOrAbsolute);
bmImage.EndInit();
bmImage.Freeze();
return bmImage;
}
}
catch (Exception ex)
{
Log.Exception("[GetImage] - An exception occured creating BitmapImage", ex);
}
return new BitmapImage();
}
/// <summary>
/// Gets a BitmapImage from a set of image bytes.
/// </summary>
/// <param name="bytes">The bytes.</param>
/// <returns></returns>
public static BitmapImage GetImage(byte[] bytes)
{
try
{
if (bytes != null && bytes.Length > 0)
{
BitmapImage image = new BitmapImage();
using (MemoryStream stream = new MemoryStream(bytes, false))
{
image.BeginInit();
// image.DecodePixelWidth = GetScaledImageWidth(bytes);
image.CacheOption = BitmapCacheOption.None;
image.StreamSource = stream;
image.EndInit();
image.Freeze();
bytes = null;
stream.Flush();
}
return image;
}
}
catch (Exception ex)
{
Log.Exception("[GetImage] - An exception occured creating BitmapImage", ex);
}
return new BitmapImage();
}
As you can see there is not anything extra done to images during creation.
The only thing I could think of would be DPI or Depth, but reading the forum it seems you have checked this.
I need to re-install my development environment this weekend (all filled with dust, LOL) and will see if I can add something, but if you can try different formats, dpi, color palate, depth as well we may be able to avoid custom code for custom images
With the majority(not all) of the repairs to my house done I will have some time for MPDisplay again, and will have more and more time as the repairs are finished. So progress may be still slow on the plugin (I don't even know what's changed in MP 1.7 yet)
sa_ddam213