Jump to content

IImageEnhancer implementation details


roaku

Recommended Posts

So, the IImageEnhancer interface has always been a little bit mysterious.

Iconic's implementation works, but there are some things that I just guessed at early on and forgot about once things started working.

At this point, I'd like to get some input on what certain things *should* be, if it's not too much trouble.

 

-----------------------------------

GetEnhancedImageSize provides a lot of parameters but it's not clear to me why...I've always just returned the original ImageSize and things have worked out.

  • What should the ideal GetEnhancedImageSize implementation do with these parameters?
  • Should I be returning Iconic's resized dimensions for an image instead of the original dimensions?
     
/// Gets the size of the enhanced image.
ImageSize GetEnhancedImageSize(IHasImages item, ImageType imageType, int imageIndex, ImageSize originalImageSize);


------------------------------------

I've played around with the different Priority options with Iconic and CoverArt both active, but I've never been able to pick up on any differences.

  • Is there a scenario where the Priority becomes important?
  • If so, what's the Priority Iconic should go with?
     
/// Gets the priority or order in which this enhancer should be run.
MetadataProviderPriority Priority { get; }

 

--------------------------------------

For GetEnhancedImageInfo, I return a new EnhancedImageInfo object with the property of RequireTransparency = true. I don't remember where I came up with that or why.

  • Should I just return an empty EnhancedImageInfo object here? Or is there a better set of properties I could configure?
     
EnhancedImageInfo IImageEnhancer.GetEnhancedImageInfo(BaseItem item, string inputFile, ImageType imageType, int imageIndex)

 

Thanks for any insight @Luke @ebr
Link to comment
Share on other sites

1 hour ago, roaku said:

Should I be returning Iconic's resized dimensions for an image instead of the original dimensions?

Yes, but, in your case, those are always the same, correct?

CA puts the images into different "frames" so it alters the size of the original.  Why this is important is that the apps need to know the shape or aspect ratio to decide how to display them.

Link to comment
Share on other sites

1 hour ago, roaku said:

Is there a scenario where the Priority becomes important?

There could be but, in your case, probably not. 

  • Thanks 1
Link to comment
Share on other sites

37 minutes ago, ebr said:

Yes, but, in your case, those are always the same, correct?

CA puts the images into different "frames" so it alters the size of the original.  Why this is important is that the apps need to know the shape or aspect ratio to decide how to display them.

I don't alter the aspect ratio, but I do scale to a uniform size based on source image width so the badge sizes are consistent across all images.

This prevents the badges from looking oversized on lower resolution images and tiny on high resolution images.
 

Edited by roaku
Link to comment
Share on other sites

GetEnhancedImageSize should be returning your final image size. It gives the server a way to know this information without actually having to go through the image processing.

  • Thanks 1
Link to comment
Share on other sites

RequireTransparency will help the server decide on the final output format that is sent to the client. For instance if transparency is required, then it will have to be either png or webp.

  • Thanks 1
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...