Comments (5)
You've not provided an example image but the lineArt
property may be more appropriate for your input images.
https://sharp.pixelplumbing.com/api-resize#trim
.trim({ lineArt: true })
from sharp.
My image was a PNG of some document with typed text.
What is the impact on performance of lineArt: true
? Additionally, what happens if there are alternating types of PNGs (document with text VS. photograph)?
from sharp.
What is the impact on performance of
lineArt: true
I would expect minimal, it might be very slightly faster, you'll need to profile using samples of the type of image you're likely to have to process.
what happens if there are alternating types of PNGs
You'll need to determine which setting is most appropriate for the type of image you're likely to have to process.
from sharp.
Thank you for the answer, however, I am still confused about this setting. Could you explain a bit more what the lineArt: true
setting does? Why should I use it and when?
Docs description:
Does the input more closely resemble line art (e.g. vector) rather than being photographic?
Maybe... What does this even really mean?
from sharp.
If the input is best represented as in a vector format such as SVG or uses a lossless compression such as PNG then lineArt
would be more suitable as there is unlikely to be "noise" around the edges between background and non-background areas.
If the input is more photographic and/or uses a lossy format such as JPEG then some smoothing of the noise is required to ensure trim()
is more accurate around the edges.
The underlying libvips operation is vips_find_trim.
from sharp.
Related Issues (20)
- Images arent closed after transforms HOT 1
- Issue setting a color of an element in an SVG HOT 5
- Cannot use custom fonts "Fontconfig error: Cannot load default config file: No such file: (null)" HOT 2
- Remove white pixels to have a transparent background HOT 2
- rotate().extract() resulting in bad extract area for iOS images rotated by metadata HOT 2
- Question: Why does the result of image.raw().extractChannel('red').toBuffer.length != image.width * image.height? HOT 3
- How to change OwnerName by withExifMerge? HOT 3
- Cross-compilation broken on [email protected] and 10.5.0 HOT 7
- Problems creating sharp Lambda layer package with custom libvips HOT 6
- What is the recommended hardware to run highly available production setup HOT 3
- Sharp keeps input file locked HOT 1
- .trim().toBuffer() does not produce info response Object offset properties HOT 2
- Include trimOffsetRight & trimOffsetBottom HOT 2
- Add settings for symmetric .trim() HOT 1
- Enhancement: ensure metadata.background is compatible with color package for single-channel images HOT 3
- Animated Gif from raw buffer HOT 1
- Animated gif from raw buffer? HOT 2
- When loading a picture using a file path, the size of the picture exceeds a certain size, and then deleting the picture will cause a problem of prohibiting deletion. HOT 2
- Using node js sharp package composite function is not giving an animated result HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sharp.