crop_image(3)
π crop_image(3) β the Arcan Lua API bestie era β¨
okay so real talk, this one lives in the Arcan Lua API manual and it's called crop_image, and honestly? it's giving "niche but iconic" π
β¨ NAME β¨
crop_image β crop your image down to the exact dimensions you want, no cap π
π¦ SYNOPSIS π¦
nil
crop_image( width, height )
πΈ DESCRIPTION πΈ
okay so picture this: sometimes the default scale- and resize-function behavior is just... not it. π Especially when you're resizing text β any under- or oversampling will rapidly tank the quality, and we simply cannot have that, bestie.
So here's what this function does, fr fr:
- it acts as a resize down to 1:1 scale for values larger than the initial size
- it changes effective texture coordinates for values larger than the initial size
and here's the side effect you gotta know about π: it will revert other texture sampling manipulations like mirroring, and it will reset any pending resize transformation chains. so yeah, it's a bit of a clean-slate queen. π
π«Ά NOTES π«Ά
- lowkey there's another way to get the same effect β create a
null_surface, link the image to this surface, and enable shallow clipping. but ngl, that results in a more complex structure to render and more code to properly set up, so like... why would you π
π EXAMPLE π
function crop_image0()
local img = load_image("test.png");
local props = image_surface_properties(img);
crop_image(img, 0.5 * props.width, 0.5 * props.height);
show_image(img);
end
π§ EXAMPLE π§
function crop_image1()
local img = render_text([[onts/default.ttf,18 local props = image_surface_properties(img);
crop_image(img, 0.5 * props.width, 0.5 * props.height);
show_image(img);
end
π SEE ALSO π
imageπ
and that's the whole vibe, bestie π this little icon comes to you from the image corner of the Arcan Lua API, dated October 2026, and yes the footer still says crop_image(3) because tradition is tradition πβ¨
π¦ where this page comes from
- nixos 26.05: arcan 0.7.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms