- August 31, 2006
- 2,159
- 2,679
- Home Country
- Sweden
- Moderator
- #1
The Picture.cs in the MediaPortal.Util namespace uses some code for creating thumbs that fails on quite a number of images. The error thrown is "a graphics object cannot be created from an image that has an indexed pixel format".
By replacing the current code in the CreateThumbnail methods;
with this code;
solved the problem and I get many more thumbs downloaded for artists in MP.
best regards
cul8er
By replacing the current code in the CreateThumbnail methods;
Code:
myBitmap = new Bitmap(iWidth, iHeight, aDrawingImage.PixelFormat);
using (Graphics g = Graphics.FromImage(myBitmap))
{
g.CompositingQuality = Thumbs.Compositing;
g.InterpolationMode = Thumbs.Interpolation;
g.SmoothingMode = Thumbs.Smoothing;
g.DrawImage(aDrawingImage, new Rectangle(0, 0, iWidth, iHeight));
myTargetThumb = myBitmap;
}
with this code;
Code:
myBitmap = (Bitmap)System.Drawing.Image.FromFile(aInputFilename, true);
Bitmap tmp = new Bitmap(iWidth, iHeight);
using (Graphics g = Graphics.FromImage(tmp))
{
g.CompositingQuality = Thumbs.Compositing;
g.InterpolationMode = Thumbs.Interpolation;
g.SmoothingMode = Thumbs.Smoothing;
g.DrawImage(myBitmap, new Rectangle(0, 0, iWidth, iHeight));
myTargetThumb = myBitmap;
}
if (tmp != null)
{
tmp.SafeDispose();
}
solved the problem and I get many more thumbs downloaded for artists in MP.
best regards
cul8er