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

How to fit image to direct width & height container #140

Open
mukaspc opened this issue Jan 29, 2020 · 0 comments
Open

How to fit image to direct width & height container #140

mukaspc opened this issue Jan 29, 2020 · 0 comments

Comments

@mukaspc
Copy link

mukaspc commented Jan 29, 2020

Hi!

I have .png files on which I want to resize to square proportions with exact dimensions, width 400px x height 400px. The problem occurs when the width of the input image is greater than its height. The image I receive has actually set dimensions of 400px x 400px but it is adjusted according to the height and the longer sides are cut off.

I would like that when the image has other proportions (larger width than height) it will be fitted to a 400px x 400px file and the graphics will be scaled accordingly.

My configuration:

.pipe(responsive({
    '*.png': [
        {
            width: 400,
            height: 400
        }
    ]
}, 
{   
    quality: 100,
    progressive: true,
    withMetadata: false,
    withoutEnlargement: false,
    skipOnEnlargement: false,
    errorOnEnlargement: false,
    errorOnUnusedConfig: false,
    errorOnUnusedImage: false
}))

Screenshot_12

As you can see the file has a dimension of 400px by 400px but the width of the graphics is larger so the image is cut on the sides. How to set the configuration so that the file size remains and the graphics (if the proportions are different) are adjusted?

Thanks!

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

No branches or pull requests

1 participant