Open ccckblaze opened 4 years ago
@sebinbenjamin can you help me out, please
Sure. Please get me a screenshot/image of the expected behavior, to make sure I understand you correctly.
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 ^ ^
.crop(sharp.strategy.entropy)
was changed to image.resize({ width, height, position: 'centre' })
some time ago. Please let me know if your issue is fixed.
my bad... i installed from npm version 0.62, it seems an old deprecated version, now it works perfectly! thanks @sebinbenjamin , when will you tag this version and upload to npm?
the image now crops centre, but there is still a problem, irgen works different from crgen, i want it "crop" not "resized"
base splash
now
hoped
so the image will not lose detail
I'm working on a solution, although you should try to use a proper splash base to start with. Ideally, the splash screen's artwork should roughly fit/cover a square (1200×1200px out of 2732x2732px) at the centre of the image. You can use this template provided by the Ionic team.
Make sure that the logo fits in the orange square at the centre. A minimum content size covering at least half of the orange square makes sure that the output splash does not lose much detail.
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 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 ^ ^