Skip to content

Commit ca7df97

Browse files
committed
Add uhdr example
1 parent 813a92b commit ca7df97

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

example/images/uhdr.jpg

1.14 MB
Loading

example/uhdr.lua

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
local vips = require "vips"
2+
3+
local image = vips.Image.new_from_file("images/uhdr.jpg", { access = "sequential" })
4+
local gainmap = image:get_gainmap()
5+
print("image:", image)
6+
7+
if gainmap then
8+
print("gainmap:", gainmap)
9+
--[[ Due to reference sharing in the operation cache copying the image
10+
as below is needed when it is not necessarily unique
11+
image = image:copy()
12+
]]
13+
-- set the "gainmap" metadata for the original image
14+
image:set_type(vips.gvalue.image_type, "gainmap", gainmap)
15+
else
16+
print("No gainmap found. You need libvips >= 8.18 with uhdr support")
17+
end

0 commit comments

Comments
 (0)