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()
582
582
return vips_lib .vips_image_hasalpha (self .vimage ) ~= 0
583
583
end
584
584
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
594
596
595
- return self :bandjoin (max_alpha )
597
+ return self :bandjoin (max_alpha )
598
+ end
596
599
end
597
600
598
601
function Image_method :bandsplit ()
You can’t perform that action at this time.
0 commit comments