[Mod] Image Loader [0.1.0] [imageloader]

User avatar
kaeza
Moderator
Posts: 2162
Joined: Thu Oct 18, 2012 05:00
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza
Location: Montevideo, Uruguay
Contact:

[Mod] Image Loader [0.1.0] [imageloader]

by kaeza » Post

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
Last edited by kaeza on Wed Jul 31, 2013 04:32, edited 1 time in total.
Your signature is not the place for a blog post. Please keep it as concise as possible. Thank you!

Check out my stuff! | Donations greatly appreciated! PayPal

User avatar
Chinchow
Member
Posts: 684
Joined: Tue Sep 18, 2012 21:37

by Chinchow » Post

This is really cool
Sometimes, it's harder to think up a mod than it is to create it.
Mods: Orichalcum Stonebricks Extra Chests

User avatar
webdesigner97
Member
Posts: 1327
Joined: Mon Jul 30, 2012 19:16
GitHub: webD97
IRC: webdesigner97
In-game: webdesigner97
Location: Cologne, Germany
Contact:

by webdesigner97 » Post

Wow!

User avatar
kaeza
Moderator
Posts: 2162
Joined: Thu Oct 18, 2012 05:00
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza
Location: Montevideo, Uruguay
Contact:

by kaeza » Post

Image
Your signature is not the place for a blog post. Please keep it as concise as possible. Thank you!

Check out my stuff! | Donations greatly appreciated! PayPal

PenguinDad
Member
Posts: 122
Joined: Wed Apr 10, 2013 16:46

by PenguinDad » Post

The idea is amazing but at the moment I don't use it because it has no PNG support.

mauvebic
Member
Posts: 1550
Joined: Fri Jan 27, 2012 11:32

by mauvebic » Post

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 :-)
Last edited by mauvebic on Mon Sep 30, 2013 18:13, edited 1 time in total.

User avatar
davidforsure!!!
Member
Posts: 72
Joined: Fri Oct 25, 2013 09:02

by davidforsure!!! » Post

i change fix the (pos shem) but it didn't work i want this mod so bad man pppppllllssss +infinite

User avatar
Mito551
Member
Posts: 1271
Joined: Sat Jun 16, 2012 15:03

by Mito551 » Post

mauvebic, what is this map?

User avatar
Josh
Member
Posts: 1146
Joined: Fri Jun 29, 2012 23:11
Location: Victoria, Australia

by Josh » Post


User avatar
general3214
Member
Posts: 122
Joined: Fri Oct 04, 2013 03:15

by general3214 » Post

You're doing it wrong. This is correct way to do it: TROLOLOLOLOL
Avatar made by Annahstas

User avatar
wcwyes
Member
Posts: 145
Joined: Wed Jul 31, 2013 22:42

by wcwyes » Post

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

User avatar
RealBadAngel
Member
Posts: 557
Joined: Wed Jul 18, 2012 16:30

by RealBadAngel » Post

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-image ... r.lua#L118
You have "scematic" in your error log. Have you edited the mod?

User avatar
rubenwardy
Moderator
Posts: 6244
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy
Location: United Kingdom
Contact:

by rubenwardy » Post

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.
Last edited by rubenwardy on Fri Dec 20, 2013 08:58, edited 1 time in total.

ch98
Member
Posts: 463
Joined: Wed Jan 02, 2013 06:14

by ch98 » Post

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?
I have stopped playing minetest, and may not come back to it again. I would like to thank everyone that made the amazing time I had playing it. This account is not in use anymore, and the email has been linked to a unused account. If any administrator reading this has time, feel free to delete my account. Thank you very much for the great experience.

User avatar
kaeza
Moderator
Posts: 2162
Joined: Thu Oct 18, 2012 05:00
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza
Location: Montevideo, Uruguay
Contact:

by kaeza » Post

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.
Last edited by kaeza on Mon Jan 06, 2014 03:28, edited 1 time in total.
Your signature is not the place for a blog post. Please keep it as concise as possible. Thank you!

Check out my stuff! | Donations greatly appreciated! PayPal

ch98
Member
Posts: 463
Joined: Wed Jan 02, 2013 06:14

by ch98 » Post

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.
Last edited by ch98 on Fri Jan 24, 2014 01:36, edited 1 time in total.
I have stopped playing minetest, and may not come back to it again. I would like to thank everyone that made the amazing time I had playing it. This account is not in use anymore, and the email has been linked to a unused account. If any administrator reading this has time, feel free to delete my account. Thank you very much for the great experience.

User avatar
AMMOnym
Member
Posts: 682
Joined: Tue Sep 10, 2013 14:18
IRC: AMMOnym
In-game: AMMOnym
Location: Slovakia

Re:

by AMMOnym » Post

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

User avatar
AMMOnym
Member
Posts: 682
Joined: Tue Sep 10, 2013 14:18
IRC: AMMOnym
In-game: AMMOnym
Location: Slovakia

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

by AMMOnym » Post

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

User avatar
Krock
Developer
Posts: 4555
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker
Location: Switzerland
Contact:

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

by Krock » Post

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?
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>

User avatar
kaeza
Moderator
Posts: 2162
Joined: Thu Oct 18, 2012 05:00
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza
Location: Montevideo, Uruguay
Contact:

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

by kaeza » Post

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.
Your signature is not the place for a blog post. Please keep it as concise as possible. Thank you!

Check out my stuff! | Donations greatly appreciated! PayPal

User avatar
kaeza
Moderator
Posts: 2162
Joined: Thu Oct 18, 2012 05:00
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza
Location: Montevideo, Uruguay
Contact:

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

by kaeza » Post

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.
Your signature is not the place for a blog post. Please keep it as concise as possible. Thank you!

Check out my stuff! | Donations greatly appreciated! PayPal

User avatar
AMMOnym
Member
Posts: 682
Joined: Tue Sep 10, 2013 14:18
IRC: AMMOnym
In-game: AMMOnym
Location: Slovakia

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

by AMMOnym » Post

I hope this helps
Attachments
IL.zip
(2.7 MiB) Downloaded 120 times

User avatar
kaeza
Moderator
Posts: 2162
Joined: Thu Oct 18, 2012 05:00
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza
Location: Montevideo, Uruguay
Contact:

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

by kaeza » Post

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 :)
Your signature is not the place for a blog post. Please keep it as concise as possible. Thank you!

Check out my stuff! | Donations greatly appreciated! PayPal

User avatar
AMMOnym
Member
Posts: 682
Joined: Tue Sep 10, 2013 14:18
IRC: AMMOnym
In-game: AMMOnym
Location: Slovakia

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

by AMMOnym » Post

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

User avatar
Krock
Developer
Posts: 4555
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker
Location: Switzerland
Contact:

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

by Krock » Post

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
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>

Post Reply

Who is online

Users browsing this forum: No registered users and 8 guests