Page 1 of 3

[Mod] Image Loader [0.1.0] [imageloader]

PostPosted: Wed Jul 31, 2013 04:26
by kaeza

Image Loader Mod



This mod allows loading image files from Lua, allowing other mods to manipulate the images.

It also has a chat command to place such images into the world, reducing the colors to a given "palette" of nodes.

Links:
Download as .ZIP
Download as .tar.gz
Browse Code on Github

License:
The main interface is released under the WTFPL.
The BMP loader is a component of the Allegro library, and was ported from C by me. It is released under the Giftware License.
The test image is a conversion to BMP of the default MESE Pickaxe. License is CC-BY-SA.

Usage:
Place your images in the `<moddir>/images' directory, then use the `/loadimage <filename>' command to load it at your current position.

This mod currently only supports the following image formats:
  • Windows or OS/2 Bitmaps (.bmp). Note: only 24bit, uncompressed files are supported.
  • Portable Network Graphics (.png). Supposedly it should support every kind of PNG type that exists (truecolor, grayscale, interlaced, etc), as long as it is well-formed.

API Documentation will come later; for now, look at the source.

Screenshots:
Image
Image
Image

PostPosted: Wed Jul 31, 2013 05:22
by Chinchow
This is really cool

PostPosted: Wed Jul 31, 2013 05:49
by webdesigner97
Wow!

PostPosted: Wed Jul 31, 2013 09:06
by kaeza
Image

PostPosted: Sat Aug 03, 2013 09:04
by PenguinDad
The idea is amazing but at the moment I don't use it because it has no PNG support.

PostPosted: Mon Sep 30, 2013 17:28
by mauvebic
Tip for those using gimp converting to bmp - when you export, check the 'Do not write color space information' box under Compatibility Options, otherwise loadimage will return an unknown file type error.

Bug spotted with the .zip version
Code: Select all
minetest.place_schematic(pos, schem, "0")
should be
Code: Select all
minetest.place_schematic(pos, schem) or minetest.place_schematic(pos, schem,0)


not bad for reproducing maps :)
Image

a 3d version of this mod would be cool too, take the brightness of colors to determine height :-)

PostPosted: Fri Oct 25, 2013 11:43
by davidforsure!!!
i change fix the (pos shem) but it didn't work i want this mod so bad man pppppllllssss +infinite

PostPosted: Fri Oct 25, 2013 16:29
by Mito551
mauvebic, what is this map?

PostPosted: Sat Oct 26, 2013 02:07
by Josh

PostPosted: Sat Oct 26, 2013 02:49
by general3214

You're doing it wrong. This is correct way to do it: TROLOLOLOLOL

PostPosted: Fri Dec 20, 2013 08:23
by wcwyes
I get
Code: Select all
ServerError: LuaError: error C:\Minetest\bin\...\mods\imageloader\imageloader.lua:118:attempt to call field 'place_scematic'(a nil value)
in 0.4.7 and it just crashes the game in 0.4.8

PostPosted: Fri Dec 20, 2013 08:55
by RealBadAngel
wcwyes wrote:I get
Code: Select all
ServerError: LuaError: error C:\Minetest\bin\...\mods\imageloader\imageloader.lua:118:attempt to call field 'place_scematic'(a nil value)
in 0.4.7 and it just crashes the game in 0.4.8



https://github.com/kaeza/minetest-imageloader/blob/master/imageloader.lua#L118
You have "scematic" in your error log. Have you edited the mod?

PostPosted: Fri Dec 20, 2013 08:57
by rubenwardy
wcwyes wrote:I get
Code: Select all
ServerError: LuaError: error C:\Minetest\bin\...\mods\imageloader\imageloader.lua:118:attempt to call field 'place_scematic'(a nil value)
in 0.4.7 and it just crashes the game in 0.4.8


Are there any messages?

When it crashes, there may be messages in the console that does not go to debug.txt (If it crashes Minetest, rather than going to the error screen).

Try updating, as it looks like there is a typo in your version.

PostPosted: Mon Jan 06, 2014 03:08
by ch98
Can someone give me a simple explanation on how to use this to get r,g,b of a pixel on a bmp image? All i need is a function where i specify the x, y and the image file and it gives back rgb, and function to get the dimentions of the file. I don't know too much about these things so can you explain as much as possible?

PostPosted: Mon Jan 06, 2014 03:27
by kaeza
ch98 wrote:Can someone give me a simple explanation on how to use this to get r,g,b of a pixel on a bmp image? All i need is a function where i specify the x, y and the image file and it gives back rgb, and function to get the dimentions of the file. I don't know too much about these things so can you explain as much as possible?

There are actually several bitmap file formats (not sure how much those are still used at the moment). This mod only supports some formats (Windows and OS/2 BMP files, and only of 24 bits color depth). The loader_bmp.lua file is quite straightforward; you should take a look at it and rip it apart for your needs (give due credit ;) ).

See also BMP file format article on Wikipedia.

PostPosted: Mon Jan 20, 2014 21:36
by ch98
kaeza wrote:There are actually several bitmap file formats (not sure how much those are still used at the moment). This mod only supports some formats (Windows and OS/2 BMP files, and only of 24 bits color depth). The loader_bmp.lua file is quite straightforward; you should take a look at it and rip it apart for your needs (give due credit ;) ).

See also BMP file format article on Wikipedia.

Thanks! I got this far, and started testing but image is way too big and computer is freezing up. I still do want this size. I made the image smaller but still is very big. Is there any way to load smaller part of the image so i wouldn't need supercomputer to run this mod? I do know it is the right format because it froze up. If it wasn't, it would just have put out error messages.

[edit] I try'd fixing the problem i got, but I have not tested yet.

Re:

PostPosted: Sat Dec 06, 2014 14:34
by AMMOnym
mauvebic wrote:Tip for those using gimp converting to bmp - when you export, check the 'Do not write color space information' box under Compatibility Options, otherwise loadimage will return an unknown file type error.

Bug spotted with the .zip version
Code: Select all
minetest.place_schematic(pos, schem, "0")
should be
Code: Select all
minetest.place_schematic(pos, schem) or minetest.place_schematic(pos, schem,0)


not bad for reproducing maps :)
Image

a 3d version of this mod would be cool too, take the brightness of colors to determine height :-)

Hello, Is something like this possible to meke with this wow map too ? Image

Re: [Mod] Image Loader [0.1.0] [imageloader]

PostPosted: Sat Dec 06, 2014 19:09
by AMMOnym
Code: Select all
20:07:22: ERROR[ServerThread]: ERROR: An unhandled exception occurred: basic_string::_S_construct null not valid


This error I get each time I use /loadimage mp.bmp

Re: [Mod] Image Loader [0.1.0] [imageloader]

PostPosted: Sat Dec 06, 2014 19:54
by Krock
AMMOnym wrote:
Code: Select all
20:07:22: ERROR[ServerThread]: ERROR: An unhandled exception occurred: basic_string::_S_construct null not valid


This error I get each time I use /loadimage mp.bmp


kaeza wrote:Currently, this mod only supports 24bit, uncompressed Windows or OS/2 .bmp files. Support for other formats will come later.

Are you sure, it's a 24bit bitmap?

Re: [Mod] Image Loader [0.1.0] [imageloader]

PostPosted: Sat Dec 06, 2014 20:41
by kaeza
AMMOnym wrote:
Code: Select all
20:07:22: ERROR[ServerThread]: ERROR: An unhandled exception occurred: basic_string::_S_construct null not valid


This error I get each time I use /loadimage mp.bmp

Can you provide the stack traceback (should be after the error)? I am able to reproduce the crash, but my copy is crashing without printing the traceback.

Re: [Mod] Image Loader [0.1.0] [imageloader]

PostPosted: Sat Dec 06, 2014 20:43
by kaeza
Krock wrote:Are you sure, it's a 24bit bitmap?

It's an image that comes with the mod as a demo, and it is indeed the right format.

Re: [Mod] Image Loader [0.1.0] [imageloader]

PostPosted: Sat Dec 06, 2014 21:19
by AMMOnym
I hope this helps

Re: [Mod] Image Loader [0.1.0] [imageloader]

PostPosted: Sun Dec 07, 2014 05:56
by kaeza
It seems to have been an issue in the engine itself. It has been fixed here, so you'll have to wait for 0.4.11 or ask somebody to provide a new development build for Windows.

Thank you for reporting anyway :)

Re: [Mod] Image Loader [0.1.0] [imageloader]

PostPosted: Sun Dec 07, 2014 12:09
by AMMOnym
kaeza wrote:It seems to have been an issue in the engine itself. It has been fixed here, so you'll have to wait for 0.4.11 or ask somebody to provide a new development build for Windows.

Thank you for reporting anyway :)

This is bigger problem then you think. I can not use any new build. Each time I dig something is new builds, my game crash itself and if I want to try it again, I can not start the world. It is crashed in "media/item textures" loading. This is the newest build I can use.
Thanks anyways

Re: [Mod] Image Loader [0.1.0] [imageloader]

PostPosted: Sun Dec 07, 2014 12:37
by Krock
AMMOnym wrote:This is bigger problem then you think. I can not use any new build. Each time I dig something is new builds, my game crash itself and if I want to try it again, I can not start the world. It is crashed in "media/item textures" loading. This is the newest build I can use.
Thanks anyways


debug.txt with setting "debug_log_level = 3" in minetest.conf goes there:
viewforum.php?f=6