Page 1 of 1

image library functions in lua api

PostPosted: Mon Mar 07, 2016 01:42
by bobomb
There are several mods which are forced to include various lua image libraries to varying degrees of success, such as my mod, realterrain, and it would make a world of difference if the image functions built-in to minetest core could be partly accessed by the modding API. in particular it would be nice to be able to read the value of a pixel or range of pixels from 8 and 16 bit grey and rgb files of all standard formats (tiff, png, bmp), preferably without loading the entire image into memory. It might also be nice to be able to change pixel values and write an image to file for certain mods, but for realterrain, imageloader, and other mods, pixel-access to standard image formats would change our world.

Re: image library functions in lua api

PostPosted: Mon Mar 07, 2016 21:21
by kaeza
Loading images for manipulating or reading pixel data is a task that is probably out of scope for the engine. There are maybe 2 or 3 mods that need it (not counting forks), and the possibilities are kinda limited, so adding support to the engine is overkill.

Re: image library functions in lua api

PostPosted: Sun Mar 13, 2016 20:52
by celeron55
Converting pixels to voxels is a valid use case that comes up now and then.

If somebody contributes a well-made small implementation of reading image files to the Lua API, I think it could be included. Anything that goes beyond the bare minimum will probably have hard time being accepted because Minetest isn't Gimp.

Re: image library functions in lua api

PostPosted: Tue Mar 15, 2016 05:33
by bobomb

Re: image library functions in lua api

PostPosted: Tue Mar 15, 2016 22:16
by bobomb
more discussion and initial strategy discussed here:
https://github.com/minetest/minetest/issues/3869