File tree Expand file tree Collapse file tree 1 file changed +13
-10
lines changed Expand file tree Collapse file tree 1 file changed +13
-10
lines changed Original file line number Diff line number Diff line change @@ -582,17 +582,20 @@ function Image_method:hasalpha()
582582 return vips_lib .vips_image_hasalpha (self .vimage ) ~= 0
583583end
584584
585- function Image_method :addalpha ()
586- local max_alpha
587- if self :interpretation () == " rgb16" or self :interpretation () == " grey16" then
588- max_alpha = 65535
589- elseif self :interpretation () == " scrgb" then
590- max_alpha = 1.0
591- else
592- max_alpha = 255
593- end
585+ -- addalpha was made a VipsOperation in vips 8.16; earlier versions need this polyfill
586+ if not version .at_least (8 , 16 ) then
587+ function Image_method :addalpha ()
588+ local max_alpha
589+ if self :interpretation () == " rgb16" or self :interpretation () == " grey16" then
590+ max_alpha = 65535
591+ elseif self :interpretation () == " scrgb" then
592+ max_alpha = 1.0
593+ else
594+ max_alpha = 255
595+ end
594596
595- return self :bandjoin (max_alpha )
597+ return self :bandjoin (max_alpha )
598+ end
596599end
597600
598601function Image_method :bandsplit ()
You can’t perform that action at this time.
0 commit comments