Sharp: Sharp doesnt generate changed values

Created on 7 Dec 2018  路  2Comments  路  Source: lovell/sharp

Hello,

So i have a script,
svgToImg.from(cardSVG).toPng({
path: './assets/newcard/text.png'
}).then(function(){
sharp('./assets/newcard/underlay.png')
.overlayWith('./assets/newcard/bg.png')
.toFile('./assets/newcard/step.png')
.then(function(){
setTimeout(function () {
sharp('./assets/newcard/step.png')
.overlayWith('./assets/newcard/text.png')
.toFile('./assets/newcard/render.png')
})
})
}, 100)

but when the image passed from svgToImg (text.png) changes, sharp doesn't generate new image with changes, it just passes the old one.

Deleting the old generated image doesn't work, sharp still generates with the first text.png, even if it changes.

Any solutions other than crashing the app after every render?

question

All 2 comments

Hello, if the contents of a file change but the path remains the same then you'll need to disable caching within libvips via sharp.cache(false) - see http://sharp.pixelplumbing.com/en/stable/api-utility/#cache

thank you, fixed the issue.

Was this page helpful?
0 / 5 - 0 ratings