Jump to content

Channel Logos - being clipped/resized


kanipek

Recommended Posts

kanipek

Has something changed with Channel logos?

 

I have been changing logos since I started using Emby without issue. Drag/drop upload and the image is there.

 

Now what I am seeing is they are being clipped or resized.

 

Has something changed with logo dimensions?

 

Screenshot attached of what I am seeing - "Emby" is what I am now seeing in Emby, "nbcHD" is the logo I am uploading

 

Thanks for reading and any help!

post-127390-0-37261500-1503333932_thumb.jpg

post-127390-0-36952400-1503333966.png

Link to comment
Share on other sites

We are cropping the transparent space out in order to ensure the look is what we are designing for.

Link to comment
Share on other sites

d00zah

But you are cropping out white text on the transparent background. I think your 'whitespace' detection for .pngs remains overly aggressive.

 

.png mages selected for upload:

 

post-10374-0-28339600-1503334497_thumb.jpg

post-10374-0-34873000-1503334506_thumb.jpg

 

How Emby interprets them:

 

post-10374-0-56529600-1503334520_thumb.jpg

post-10374-0-10681800-1503334532_thumb.jpg

 

 

 

 

  • Like 1
Link to comment
Share on other sites

kanipek

But you are cropping out white text on the transparent background. I think your 'whitespace' detection for .pngs remains overly aggressive.

 

.png mages selected for upload:

 

attachicon.gifpost-10374-0-86165700-1502836291.jpg

attachicon.gifpost-10374-0-31327000-1502836301.jpg

 

How Emby interprets them:

 

attachicon.gifpost-10374-0-75869700-1502836262.jpg

attachicon.gifpost-10374-0-36218500-1502836309.jpg

Same exact behavior I am seeing on those same logos and many others.

Link to comment
Share on other sites

kanipek

We are cropping the transparent space out in order to ensure the look is what we are designing for.

 

Okay but it is cropping incorrectly. I have a lot of logos you can't even tell what channel they are for anymore.

 

This needs to be looked at again, or you need to tell us how to get the logos to look the same as they did previously.

 

Did the acceptable dimensions change for logos?

Link to comment
Share on other sites

d00zah

The 'acceptable dimensions' are a recent thing. See:

 

https://emby.media/community/index.php?/topic/49351-image-processing-on-channel-logos-is-horrible/

https://emby.media/community/index.php?/topic/49441-channel-logos/

 

Best I can figure, the OP didn't standardize on a specific size image & expected to rely on Emby to make them all uniform... which, when implemented,  hosed others who had taken the time (or drew logos from a standardized source).

 

@@kanipek, am I correct in assuming, like me, you use MyChannelLogos in WMC as your logo source?

 

I've been experimenting & just saving the .png images as .jpg results in a horrible image. Next, I tried creating a black 215x75 image & overlaying the .png on it before saving as a .jpg. This preserves the quality, but it's time consuming (& I just finished this exercise shortly before this 'fix' was implemented).

Edited by d00zah
Link to comment
Share on other sites

kanipek

The 'acceptable dimensions' are a recent thing. See:

 

https://emby.media/community/index.php?/topic/49351-image-processing-on-channel-logos-is-horrible/

https://emby.media/community/index.php?/topic/49441-channel-logos/

 

Best I can figure, the OP didn't standardize on a specific size image & expected to rely on Emby to make them all uniform... which, when implemented,  hosed others who had taken the time (or drew logos from a standardized source).

 

@@kanipek, am I correct in assuming, like me, you use MyChannelLogos in WMC as your logo source?

 

I've been experimenting & just saving the .png images as .jpg results in a horrible image. Next, I tried creating a black 215x75 image & overlaying the .png on it before saving as a .jpg. This preserves the quality, but it's time consuming (& I just finished this exercise shortly before this 'fix' was implemented).

 

I don't use a lot of mychannellogos - logos. A few perhaps.

 

Where did you get 215x75? Is that actually spelled out somewhere?

 

I can understand the coders making changes, aiming for consistency across the various apps. I just wish these type of things were documented someplace, I have looked, what I did find was out of date.

 

90% of my logos are transparent and of that 90% about 80% are victims of this transparent space cropping.

 

If it was a simple thing to change each logo I would be less concerned. But it is time consuming to change each and every logo, simple enough for 1 logo not so simple for 180 or so.

Link to comment
Share on other sites

d00zah

I don't use a lot of mychannellogos - logos. A few perhaps.

 

Where did you get 215x75? Is that actually spelled out somewhere?

 

I can understand the coders making changes, aiming for consistency across the various apps. I just wish these type of things were documented someplace, I have looked, what I did find was out of date.

 

90% of my logos are transparent and of that 90% about 80% are victims of this transparent space cropping.

 

If it was a simple thing to change each logo I would be less concerned. But it is time consuming to change each and every logo, simple enough for 1 logo not so simple for 180 or so.

 

The size I used was based on various, available 'BIG' images from MyChannelLogos. With those as a template, I created a set of standardized .png images that looked uniform in both WMC & Emby... until the bugfix. The images recommended in the 1st link (original problem) were a mix of 'hi-res' .jpg image resolutions'.

 

As far as I'm aware, no 'spec' for these images existed until this change. I'm not sure I believe the design decision was particularly well-considered & unfortunately, we are the casualties.

 

As my logos are coming from WMC, via ServerWMC/plugin, I'm wondering what will happen if I only use modified logos in Emby. Will a 'Guide Refresh' re-import the original, non-spec logos?

Link to comment
Share on other sites

kanipek

The size I used was based on various, available 'BIG' images from MyChannelLogos. With those as a template, I created a set of standardized .png images that looked uniform in both WMC & Emby... until the bugfix. The images recommended in the 1st link (original problem) were a mix of 'hi-res' .jpg image resolutions'.

 

As far as I'm aware, no 'spec' for these images existed until this change. I'm not sure I believe the design decision was particularly well-considered & unfortunately, we are the casualties.

 

As my logos are coming from WMC, via ServerWMC/plugin, I'm wondering what will happen if I only use modified logos in Emby. Will a 'Guide Refresh' re-import the original, non-spec logos?

 

Sounds like your set up is different than mine. I left WMC a year ago - no DRM to worry about so Emby works well for my needs.  So you are getting your Live TV/EPG via ServerWMC into Emby?

 

I am not sure about your set up. If you are making the changes to the logo(s) from within Emby (via Edit Image for a channel) I think that would not get overwritten.

 

In my case using Emby Live TV when I change a logo - overwriting what is downloaded from Schedules Direct that logo does not get overwritten by a guide refresh,

Link to comment
Share on other sites

d00zah

Some of my logos were from Schedules Direct (WMC / EPG123... DRM), so maybe it was those that were affected.

 

I really didn't think the logos would get overridden, but I've started thinking defensively.

 

The 'seminal' thread I linked to had a link to a site w/ HD images. You may find some alternatives there which comport with the new standard.

Link to comment
Share on other sites

pünktchen

@@d00zah it seems to me as you're thinking i'm the reason for your problems. Just to be clear, that's not the case!

I've never requested any of those image processing changes and i would be more than happy if it would be completely removed again.

Link to comment
Share on other sites

garyan2

Because I'm a "victim" to the cropping as well, I'd like to share what I have done with EPG123 to crop and resize images downloaded from Schedules Direct. You can set the size to anything you want with good results. The function uses the Alpha channel of each pixel to determine the crop size and location. In theory, an alpha channel above 0 would be exactly what is needed, but I found some images from SD had a random pixel with an alpha value above 0. I changed it to use a alpha value of 255 (0% transparent) instead. Being targeted towards WMC, the image is centered vertically in the defined canvas height while the width is the size of the cropped image not to exceed the defined canvas width.

 

This of course will only work for png files with transparent backgrounds. I haven't looked at jpeg at all which would need some more intelligence in the code to determine what pixels belong to the logo and what pixels are background. I can certainly appreciate the difficulty in building code to accommodate the many different image formats. Feel free to reuse any/all of the code.

private static bool downloadSDLogo(string uri, string filepath, bool bigLogo)
{
    try
    {
        // set target image size
        int tgtHeight = (bigLogo) ? 75 : 64;
        int tgtWidth = (bigLogo) ? 225 : 144;

        System.Net.WebClient wc = new System.Net.WebClient();
        using (MemoryStream stream = new MemoryStream(wc.DownloadData(uri)))
        {
            // crop image
            Bitmap cropImg;
            using (Bitmap origImg = Image.FromStream(stream) as Bitmap)
            {
                // Find the min/max non-transparent pixels
                Point min = new Point(int.MaxValue, int.MaxValue);
                Point max = new Point(int.MinValue, int.MinValue);

                for (int x = 0; x < origImg.Width; ++x)
                {
                    for (int y = 0; y < origImg.Height; ++y)
                    {
                        Color pixelColor = origImg.GetPixel(x, y);
                        if (pixelColor.A == 255)
                        {
                            if (x < min.X) min.X = x;
                            if (y < min.Y) min.Y = y;

                            if (x > max.X) max.X = x;
                            if (y > max.Y) max.Y = y;
                        }
                    }
                }

                // Create a new bitmap from the crop rectangle and increase canvas size if necessary
                int offsetY = 0;
                double tgtAspect = (double)tgtWidth / (double)tgtHeight;
                Rectangle cropRectangle = new Rectangle(min.X, min.Y, max.X - min.X + 1, max.Y - min.Y + 1);
                if (((double)(max.X - min.X + 1) / tgtAspect) > (max.Y - min.Y + 1))
                {
                    offsetY = (int)((max.X - min.X + 1) / tgtAspect - (max.Y - min.Y + 1) + 0.5) / 2;
                }

                cropImg = new Bitmap(cropRectangle.Width, cropRectangle.Height + offsetY * 2);
                cropImg.SetResolution(origImg.HorizontalResolution, origImg.VerticalResolution);
                using (Graphics g = Graphics.FromImage(cropImg))
                {
                    g.DrawImage(origImg, 0, offsetY, cropRectangle, GraphicsUnit.Pixel);
                }
            }

            // resize image and save
            int destWidth = Math.Min((int)((double)tgtHeight / (double)cropImg.Height * (double)cropImg.Width), tgtWidth);
            Bitmap destImg = new Bitmap(destWidth, tgtHeight);
            destImg.SetResolution(cropImg.HorizontalResolution, cropImg.VerticalResolution);
            using (Graphics g = Graphics.FromImage(destImg))
            {
                g.CompositingMode = System.Drawing.Drawing2D.CompositingMode.SourceCopy;
                g.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
                g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
                g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
                g.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality;

                using (var wrapMode = new System.Drawing.Imaging.ImageAttributes())
                {
                    wrapMode.SetWrapMode(System.Drawing.Drawing2D.WrapMode.TileFlipXY);
                    g.DrawImage(cropImg, new Rectangle(0, 0, destWidth, tgtHeight), 0, 0, cropImg.Width, cropImg.Height, GraphicsUnit.Pixel, wrapMode);
                }
            }
            destImg.Save(filepath, System.Drawing.Imaging.ImageFormat.Png);
            return true;
        }
    }
    catch (Exception ex)
    {
        Logger.WriteVerbose(ex.Message);
    }
    return false;
}

  • Like 1
Link to comment
Share on other sites

d00zah

@@d00zah it seems to me as you're thinking i'm the reason for your problems. Just to be clear, that's not the case!

I've never requested any of those image processing changes and i would be more than happy if it would be completely removed again.

 

Sincerely sorry. Yesterday was 'less than optimal' all around.

Link to comment
Share on other sites

  • 2 years later...

Hi,

sorry to open this ticket again. I got weird tv logo image sizes:

The default view for tv logos under "home" or "Live TV -> programs" is the poster view but since most tv logos are more wide than high this looks bad (see attachment "tv_programs_view"). When I click to "Live TV -> channels" each the default "view option" is "thumb" which looks much better since each tv logo is more wide than tall (see attachment "tv_channels_view"). So emby should either always display live tv items in "thumb view" (and not in "poster view") or should resize the logos correct in "poster view" so that the logo is not cropped (see again attachment "tv_programs_view").

 

Much thanks

 

 

 

 

post-5482-0-08384500-1575197391_thumb.png

post-5482-0-74231600-1575197411_thumb.png

Link to comment
Share on other sites

Hi.  Our guide data provider has portrait images for programs so that is why that is the default.  There is a difference between program images and channel logos.  In your first screen shot you should be seeing program images (images for the specific shows).  In your second one, it is showing channel logos.

Link to comment
Share on other sites

pünktchen

But the Emby guide data provider also has landscape images. So why isn't that the default?

Landscape is the default in every app but Emby.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...