sonicsound 1 Posted January 8, 2018 Share Posted January 8, 2018 Hi, I'd like to be able to render photos at a fixed size center cropped. Currently, setting both Width & Height with an image request causes the aspect ratio to be adjusted. It would be awesome to be able to pass a scaleType=centerCrop (or equivalent) param to specify that the aspect ratio be maintained, and the image cropped to fit the dimensions. Alternatively, if there was a way to specify fitWidth/fitHeight params that ensure that both dimensions are at least as large as the specified dimensions (minimally), then the cropping could be done on the client. Thanks! Link to comment Share on other sites More sharing options...
Luke 37128 Posted January 8, 2018 Share Posted January 8, 2018 hi, what you would do instead is specify maxWidth / maxHeight Link to comment Share on other sites More sharing options...
sonicsound 1 Posted January 8, 2018 Author Share Posted January 8, 2018 Hey, using MaxWidth/MaxHeight in this case would require knowing the aspect ratio of the image upfront. ex. Original = 1600x800 Target = 400x400 requesting MaxWidth=400&MaxHeight=400 results in 400x200 image, but the desired behavior would be to return 800x400 so that the image can be cropped without quality loss. Since photos can include a combination of landscape and portrait orientation, I can't specify only MaxWidth either Link to comment Share on other sites More sharing options...
Luke 37128 Posted January 8, 2018 Share Posted January 8, 2018 Right, I'm only mentioning it because as of today that's the closest thing we have to what you're looking for, thanks. Link to comment Share on other sites More sharing options...
sonicsound 1 Posted January 8, 2018 Author Share Posted January 8, 2018 Yep, that's why I made a feature request. Thanks. Link to comment Share on other sites More sharing options...
ebr 14937 Posted January 8, 2018 Share Posted January 8, 2018 Since photos can include a combination of landscape and portrait orientation, I can't specify only MaxWidth either You could use MaxHeight though... Link to comment Share on other sites More sharing options...
sonicsound 1 Posted January 9, 2018 Author Share Posted January 9, 2018 ... that would have the same issue. The problem is that you need to know the original aspect ratio before loading the image with the currently available options. Link to comment Share on other sites More sharing options...
Luke 37128 Posted January 9, 2018 Share Posted January 9, 2018 FYI emby apps do not always have that information and they are able to show images using maxwidth/maxheight without loss of aspect ratio. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now