Skip to content

Conversation

@NiteRide
Copy link

Updated so basic validate can be called from command line or via bash to check if resize input is valid or not.
also % can be > 100

A common image resize script. This will be used by the keolapse module, and potentially by main settings if we implement this instead of requiring users to input separate width and height values. and/or can be used by anything to calculate new image dimensions. can calculate resizing for an image file path or for specified dimensions without a file-path.

Accepts inputs in several formats:

'50%' -> percent scale reduction
'1000W' or '1000w' -> target width
'720H' or '720h' -> target height
'1280X720' or '1280x720' -> fixed target width x height (WxH)

Two functions available in the file:

  • validate_scale: can be called independently to check input for resize scaling (returning True or False with an error if appropriate)
  • resize: which will call validate scale, then resize the image. returns the resized image and details about the resize action.

A common image resize script. This will be used by the keolapse module, and potentially by main settings if we implement this instead of requiring users to input separate width and height values. and/or can be used by anything to calculate new image dimensions. can calculate resizing for an image file path or for specified dimensions without a file-path.

Accepts inputs in several formats:

    '50%' -> percent scale reduction
    '1000W' or '1000w' -> target width
    '720H' or '720h' -> target height
    '1280X720' or '1280x720' -> fixed target width x height (WxH)

Two functions available in the file:
validate_scale: can be called independently to check input for resize scaling (returning True or False with an error if appropriate)

resize: which will call validate scale, then resize the image. returns the resized image and details about the resize action.

updated so basic validate can be called from command line or via bash to check if resize input is valid or not.
@NiteRide
Copy link
Author

@EricClaeys -
here is re-do from/to correct branch. also with a couple updates we discussed earlier today. should be able to call from .sh at least for validate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant