typst
typst copied to clipboard
Ability to crop an image
Description
I suggest that the image()
function should have a crop
(or another name) argument that would crop the image. It could work a bit like the pad()
function, for example
#image(
"figure.jpg",
crop: 5pt,
)
would crop the image by 5pt from each side.
Or maybe it could be a separate function, like so
#crop(
x: 5pt,
top: 2pt,
image("figure.jpg"),
)
Use Case
The ability to crop an image, or anything else, is useful on it's own, but when I'm writing a math paper and have a figure generated from python, the figures tend to have a white background spanning unnecessarily far. Im sure there will be other use cases tho
This can already be achieved by wrapping the image in a block with negative inset and clip: true
This can already be achieved by wrapping the image in a block with negative inset and clip: true
Is it possible to crop an image into a circle?
Yes, you can add a radius
to the box used during clipping:
box(pic, radius: 50%, clip: true)
Is it possible to crop/clip an image with an arbitrary shape? (Our university's style guide is very particular about slopes…)
That's not currently possible. You'd have to do that in another software separately.