imgA: merge ws/imgA-ops (ops/ImageOps)
This commit is contained in:
commit
25cf9fa396
5 files changed
+1624
No files matched your search
@@ -125,3 +125,32 @@ do
|
||||
Gif.encode(photo)
|
||||
end)
|
||||
end
|
||||
|
||||
-- ------------------------------------------------------------------------------------------------ ops/ImageOps
|
||||
do
|
||||
local Ops = require("@formats/ops/ImageOps")
|
||||
local img = assert(Png.decode(Bytes.reader(buffer.fromstring(PB[1].data))))
|
||||
local n = img.width * img.height * 4
|
||||
bench("imageops resize 1/2 bilinear", 2, n, function()
|
||||
Ops.resize(img, img.width // 2, img.height // 2, "bilinear")
|
||||
end)
|
||||
bench("imageops resize 1/2 lanczos", 2, n, function()
|
||||
Ops.resize(img, img.width // 2, img.height // 2, "lanczos")
|
||||
end)
|
||||
bench("imageops resize x1.5 bilinear", 1, n, function()
|
||||
Ops.resize(img, img.width * 3 // 2, img.height * 3 // 2, "bilinear")
|
||||
end)
|
||||
bench("imageops rotate 30 (expand)", 1, n, function()
|
||||
Ops.rotate(img, 30)
|
||||
end)
|
||||
bench("imageops rotate90", 3, n, function()
|
||||
Ops.rotate90(img, 1)
|
||||
end)
|
||||
bench("imageops convert rgba8 -> gray8", 3, n, function()
|
||||
Ops.convert(img, "gray8")
|
||||
end)
|
||||
local other = assert(Ops.flip(img, "h"))
|
||||
bench("imageops composite over", 3, n, function()
|
||||
Ops.composite(img, other)
|
||||
end)
|
||||
end
|
||||
Reference in new issue
Block a user