Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using same ratio for both portrait and landscape images #87

Closed
marko8994 opened this issue Feb 22, 2021 · 6 comments
Closed

Using same ratio for both portrait and landscape images #87

marko8994 opened this issue Feb 22, 2021 · 6 comments
Assignees
Labels
enhancement New feature or request

Comments

@marko8994
Copy link

Is it possible to make custom ratios to be be fixed(not switching width and height) for both landscape and portrait images. We have some specific usage and we want custom ratios to be the same and not change.

Example:

  1. Define two custom ratios
    config.addCustomRatio(byVerticalWidth: 3, andVerticalHeight: 4)
    config.addCustomRatio(byVerticalWidth: 16, andVerticalHeight: 9)
  2. Try to crop portrait image, everything will work fine
  3. Try to crop landscape image, custom ratios will have flipped value, they will become 4:3 and 9:16. In this step, it would be nice if custom added ratios remain with same values: 3:4 and 16:9
@guoyingtao
Copy link
Owner

@marko8994 Yes, it is possible. I can add a new config setting for it in the next release.

@guoyingtao guoyingtao self-assigned this Feb 23, 2021
@guoyingtao guoyingtao added the enhancement New feature or request label Feb 23, 2021
@guoyingtao
Copy link
Owner

guoyingtao commented Feb 23, 2021

@marko8994 I released Mantis 1.4.11 which includes this feature.

I added fixRatiosShowType to Mantis.config

public var fixRatiosShowType: FixRatiosShowType = .adaptive

You can change this value to .horizontal or .vertical to use the same ratios for both portrait and landscape images.

@marko8994
Copy link
Author

@guoyingtao, I see that you implemented this only in case we use RatioPresenter. Is it possible to add optional login for RatioSelector also since we are not using RatioPresenter?

@guoyingtao
Copy link
Owner

@marko8994 I added fixRatiosShowType setting to RatioSelecor in the master branch.

I also moved fixRatiosShowType to Config.cropToolbarConfig

        var config = Mantis.Config()
        config.cropToolbarConfig.ratioCandidatesShowType = .alwaysShowRatioList
        config.cropToolbarConfig.fixRatiosShowType = .vetical

Can you check if it is what you want? Then I can release a new version of Mantis.

@marko8994
Copy link
Author

@guoyingtao, Yup, this is what we wanted. Everything works as expected. Thanks a lot.

@guoyingtao
Copy link
Owner

@marko8994 I just released Mantis 1.4.12 which includes this support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants