Skip to content

crop behavior request #86

@ccckblaze

Description

@ccckblaze

i'd like the old flavor of crgen, the image crop which just based on the px, not resize the original image

so i did a patch for current version

const transformSplash = (definition) => {
const image = imageObj.splash;
const { width } = definition;
const { height } = definition;
const outputFilePath = path.join(platformPath, definition.name);
const outDir = path.dirname(outputFilePath);
return fs.ensureDir(outDir).then(() => image
.extract({left: parseInt((image.meta.width - width) / 2), top: parseInt((image.meta.height - height) / 2) , width, height})
.toFile(outputFilePath));
};``

.extract({left: parseInt((image.meta.width - width) / 2), top: parseInt((image.meta.height - height) / 2) , width, height})

instead of

.crop(sharp.strategy.entropy)

can you give a build-in command line switch for this

like
irgen --extract
or something else

please ^ ^

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions