Convert Minecraft 1.8 skins to Minetest in PHP

Post Reply
User avatar
MangleFox70
Member
Posts: 62
Joined: Mon Feb 01, 2016 14:50
GitHub: Cat5TV
IRC: MangleFox70
In-game: MangleFox70
Contact:

Convert Minecraft 1.8 skins to Minetest in PHP

by MangleFox70 » Post

Hey all! Here's a little something my producer posted on his blog. I thought I'd copy it here in case it helps some of you out.

---

As we build up #ThePixelShadow on Category5 TV, and introduce a creative Minetest server specifically for playing Minetest (the free Minecraft alternative), it became apparent that our users/viewers would like to be able to have their own custom skins.

Image
RobbieF

We’re making it easy with a nice little interface to upload your own skins, but part of the process requires making a skin which is compatible with sdzen’s/PilzAdam’s player_textures mod … basically, these skins are Minecraft 1.6/1.7 skins… 64×32. Great Minecraft skin creator sites such as minecraftskins.com now generate Minecraft 1.8 skin files, which are 64×64.

The difference is essentially that the skins now support overlays (eg., removable headphones or glasses) and your left and right arms and legs can have different textures. Not the case with 1.6/1.7/Minetest… so we must convert the skin file to make it compatible.

Since we’re building a web interface to do this all automatically for you and place your player skin on our server automatically, I’m building the program in PHP. Since there are a lot of tutorials out there that simply instruct you to change your canvas size to 64×32 (which is wrong – you will lose your overlays!) I thought I would share my method with you in case it comes in handy.

And hey, it’s a fun exercise in PHP/GD anyways :)

Code: Select all

<?php
  // Convert Minecraft 1.8+ skin to 1.7-/Minetest skin.
  // From Robbie Ferguson // www.baldnerd.com
  // Requires PHP, GD
  // By default outputs png to browser window AND saves a file for future use. Edit below to change behaviour.
  // v1.1

  $input = './uploads/player_RobbieF.png'; // your 1.8 skin file
  $output = 'newskin.png'; // your new 1.7/Minetest skin file

  // Create image instances
  $src = imagecreatefrompng($input);
  $dest = imagecreatetruecolor(64, 32);

  // Make it transparent
  imagesavealpha($dest, true);
  $trans_colour = imagecolorallocatealpha($dest, 0, 0, 0, 127);
  imagefill($dest, 0, 0, $trans_colour);

  // Learn the dimensions of the input image
  $size = getimagesize($input);

  if ($size[0] == 64 && $size[1] == 64) { // it has Minecraft 1.8 skin dimensions - convert!
    
    // Copy - Syntax is Dest X,Y, Source X,Y, Width,Height

    // Head
    imagecopy($dest, $src, 0,0, 0,0, 32,16);
    // Head overlay
    imagecopy($dest, $src, 0,0, 32,0, 32,16);

    // Right leg, Body, Right Arm
    // The Leg and Arm become both left and right in 1.7-
    // We'll simply discard the left arm and leg since it's not used.
    // If you have an overlay on your left arm/leg but not right arm/leg, you might want to edit your skin since that will be discarded.
    imagecopy($dest, $src, 0,16, 0,16, 64,16);

    // Leg, Body and Arm overlay
    imagecopy($dest, $src, 0,16, 0,32, 64,16);

  } else { // already compatible. Just copy it.
    imagecopy($dest, $src, 0,0, 0,0, 64,32);
  }

  // Output to browser
  header('Content-Type: image/png');
  imagepng($dest);

  // Save to a file
  imagepng($dest,$output,0); // 0-9. 0=faster, 9=smaller.

  // Free up memory
  imagedestroy($dest);
  imagedestroy($src);
  
?>
If you find a good use for it in your project, please comment below. If you really love what I do, please consider supporting my Patreon profile, or throw a little something in the tip jar.

Hope to see you on #ThePixelShadow Minetest server soon, custom skin and all!

From http://www.baldnerd.com/convert-minecra ... in-in-php/

Don't Know How To Use PHP? No problem! Use our hosted conversion tool to convert your v1.8 skin, or post your skin in this thread and we'll convert it for you.
Last edited by MangleFox70 on Sat Feb 06, 2016 06:37, edited 1 time in total.
#ThePixelShadow on YouTube
A Weekly Minetest Webcast hosted by MangleFox70
Have a mod you'd like featured? Want to participate in our show? Join servers.minetest.tv Port 30000 for creative or 30001 for survival.
Upload your own skin via our web site: Minetest.TV

dkelley810
New member
Posts: 4
Joined: Tue Jan 12, 2016 14:21
GitHub: dkelley810
IRC: Dennis_Kelley
In-game: dkelley810

Re: Convert Minecraft 1.8 skins to Minetest in PHP

by dkelley810 » Post

Image

Please Convert this Skin for me! Love the server! Keep it up!
Last edited by dkelley810 on Thu Feb 04, 2016 17:10, edited 2 times in total.

User avatar
MangleFox70
Member
Posts: 62
Joined: Mon Feb 01, 2016 14:50
GitHub: Cat5TV
IRC: MangleFox70
In-game: MangleFox70
Contact:

Re: Convert Minecraft 1.8 skins to Minetest in PHP

by MangleFox70 » Post

Hey dkelley810! Here's your generated skin:
Image

And your preview:
Image Image
#ThePixelShadow on YouTube
A Weekly Minetest Webcast hosted by MangleFox70
Have a mod you'd like featured? Want to participate in our show? Join servers.minetest.tv Port 30000 for creative or 30001 for survival.
Upload your own skin via our web site: Minetest.TV

User avatar
benrob0329
Member
Posts: 1341
Joined: Thu Aug 06, 2015 22:39
GitHub: Benrob0329
IRC: benrob0329
In-game: benrob03
Location: Michigan
Contact:

Re: Convert Minecraft 1.8 skins to Minetest in PHP

by benrob0329 » Post

Yuuussss! Now I can use a skin editor other than GIMP!!

TG-MyinaWD
Member
Posts: 356
Joined: Thu May 08, 2014 21:22
GitHub: Maddie-Myina
IRC: Maddie-Myina
In-game: .
Location: Far Eden

Re: Convert Minecraft 1.8 skins to Minetest in PHP

by TG-MyinaWD » Post

PHP you say :)
I <3 php.
I am going look into adding this to my site. even my minetest site. I'm a web reseller so I can ofter people to really use this.

But we need however a MySQL/i setup if those wanted have easy callback();.
I'm a Transgender no shame about it.
I prefer to be considered as a "Girl/Lady/Miss/Madam/Female" for now on.

User avatar
MangleFox70
Member
Posts: 62
Joined: Mon Feb 01, 2016 14:50
GitHub: Cat5TV
IRC: MangleFox70
In-game: MangleFox70
Contact:

Re: Convert Minecraft 1.8 skins to Minetest in PHP

by MangleFox70 » Post

Sure - you can set this up however you like, including backing it up with a MySQL database. It's only the graphic converter.

We use this on our web site, and it auto-syncs with our gaming servers so players can add their own skins.
#ThePixelShadow on YouTube
A Weekly Minetest Webcast hosted by MangleFox70
Have a mod you'd like featured? Want to participate in our show? Join servers.minetest.tv Port 30000 for creative or 30001 for survival.
Upload your own skin via our web site: Minetest.TV

User avatar
GreenXenith
Member
Posts: 1356
Joined: Wed Oct 28, 2015 01:26
GitHub: GreenXenith
Location: UTC-8:00
Contact:

Re: Convert Minecraft 1.8 skins to Minetest in PHP

by GreenXenith » Post

YouTube | Mods | Patreon | Minetest Discord @greenxenith

You should not be able to read this message.

User avatar
MangleFox70
Member
Posts: 62
Joined: Mon Feb 01, 2016 14:50
GitHub: Cat5TV
IRC: MangleFox70
In-game: MangleFox70
Contact:

Re: Convert Minecraft 1.8 skins to Minetest in PHP

by MangleFox70 » Post

Hey GreenDimond,
You can convert the skin yourself since we launched the online Skin Converter on our web site. Jump over to https://minetest.tv and you'll find the Skin Converter there.

Side note: it also automatically syncs it to our game servers... so if you also play on our server, your skin will automatically be on your player after using the Skin Converter.
#ThePixelShadow on YouTube
A Weekly Minetest Webcast hosted by MangleFox70
Have a mod you'd like featured? Want to participate in our show? Join servers.minetest.tv Port 30000 for creative or 30001 for survival.
Upload your own skin via our web site: Minetest.TV

User avatar
TheReaperKing
Member
Posts: 531
Joined: Sun Nov 22, 2015 21:36
Contact:

Re: Convert Minecraft 1.8 skins to Minetest in PHP

by TheReaperKing » Post

My kids at school are very interested in making their own skins but since your converter only converts one per player name that is a problem. Is there some way they can convert whatever skins they make? I can certainly try giving PHP a whirl with the code you provided but what is the GD you mention? Thanks so much! Take care.
-Mike
PS This is also Create With Platinum Arts Sandbox from youtube :)
Become A Real Life Superhero - http://SuperheroHill.com
Project Lead of the Doom 3 Mod Last Man Standing - http://Doom3Coop.com
Project Lead of Platinum Arts Sandbox Free 3D Game Maker - http://SandboxGameMaker.com
Youtube Channel - https://www.youtube.com/user/PlatinumArtsKids

User avatar
MangleFox70
Member
Posts: 62
Joined: Mon Feb 01, 2016 14:50
GitHub: Cat5TV
IRC: MangleFox70
In-game: MangleFox70
Contact:

Re: Convert Minecraft 1.8 skins to Minetest in PHP

by MangleFox70 » Post

TheReaperKing our system is built to be a way for users to add their own skin to our server. Once added, they have to request overwrite access each time they want to replace it... otherwise players would have their skins griefed. Once a skin is converted on our site, it is synced to our game servers (The Pixel Shadow), and there is an API to allow other Minetest servers to also sync the skins, should another admin want that.

What you're looking for sounds more like just a straight converter without that sync feature. I could add it to the site, or enhance ours to allow a skin to be converted without a username and downloadable.

Would that help?
#ThePixelShadow on YouTube
A Weekly Minetest Webcast hosted by MangleFox70
Have a mod you'd like featured? Want to participate in our show? Join servers.minetest.tv Port 30000 for creative or 30001 for survival.
Upload your own skin via our web site: Minetest.TV

sofar
Developer
Posts: 2146
Joined: Fri Jan 16, 2015 07:31
GitHub: sofar
IRC: sofar
In-game: sofar

Re: Convert Minecraft 1.8 skins to Minetest in PHP

by sofar » Post

MangleFox70 wrote: What you're looking for sounds more like just a straight converter without that sync feature. I could add it to the site, or enhance ours to allow a skin to be converted without a username and downloadable.
Maybe we can collaborate and make a standalone converter just like these 2:

viewtopic.php?f=12&t=13709

and, more appropriately:

viewtopic.php?f=4&t=14283

which is a console wrapper around lots of imagemagick stuff.

That way, people can convert skins themselves without requiring upload. It should be trivial to even add things like URL support, displaying the result and/or even generating a preview.

TG-MyinaWD
Member
Posts: 356
Joined: Thu May 08, 2014 21:22
GitHub: Maddie-Myina
IRC: Maddie-Myina
In-game: .
Location: Far Eden

Re: Convert Minecraft 1.8 skins to Minetest in PHP

by TG-MyinaWD » Post

Can you PM me the code for the uploading part? since I am trying port this over at my website minetestskins.ml
I'm a Transgender no shame about it.
I prefer to be considered as a "Girl/Lady/Miss/Madam/Female" for now on.

User avatar
TheReaperKing
Member
Posts: 531
Joined: Sun Nov 22, 2015 21:36
Contact:

Re: Convert Minecraft 1.8 skins to Minetest in PHP

by TheReaperKing » Post

What you're looking for sounds more like just a straight converter without that sync feature. I could add it to the site, or enhance ours to allow a skin to be converted without a username and downloadable.
That'd be a massive help!! Thank you! And sorry for the delay responding, I didn't see that this was updated. My kiddos will be freaking out :)
Become A Real Life Superhero - http://SuperheroHill.com
Project Lead of the Doom 3 Mod Last Man Standing - http://Doom3Coop.com
Project Lead of Platinum Arts Sandbox Free 3D Game Maker - http://SandboxGameMaker.com
Youtube Channel - https://www.youtube.com/user/PlatinumArtsKids

User avatar
MangleFox70
Member
Posts: 62
Joined: Mon Feb 01, 2016 14:50
GitHub: Cat5TV
IRC: MangleFox70
In-game: MangleFox70
Contact:

Re: Convert Minecraft 1.8 skins to Minetest in PHP

by MangleFox70 » Post

Okay, how soon do you need it? At the moment we're preparing our new Xtreme PVP Survival server and that's eating a lot of development time, but we can try to squeeze this in as a web site update.
#ThePixelShadow on YouTube
A Weekly Minetest Webcast hosted by MangleFox70
Have a mod you'd like featured? Want to participate in our show? Join servers.minetest.tv Port 30000 for creative or 30001 for survival.
Upload your own skin via our web site: Minetest.TV

User avatar
TheReaperKing
Member
Posts: 531
Joined: Sun Nov 22, 2015 21:36
Contact:

Re: Convert Minecraft 1.8 skins to Minetest in PHP

by TheReaperKing » Post

We are finishing up the school year in about a month, it is a year round school but in June I'm trying to host a game design camp so if before then that'd be great. That's so nice of you to even think about! Also I was just wondering if there were any specific reasons you liked skindex over minecraftskins.net I'm not really biased to any certain one but trying to learn the pros and cons for the kiddos.

We are working on a game for the little girl who lost her little brother and so I hope you don't mind but I might just log into the server with a few random names so we can convert the princess skins. The reason my "Mike" skin is a football player is that was a skin for a boy with pneumonia.

I really appreciate your hard work making the skin converter in general. I think getting the kids into all that stuff is awesome and they are so excited about making skins! Take care :)
-Mike

EDIT - That server sounds awesome by the way!
Become A Real Life Superhero - http://SuperheroHill.com
Project Lead of the Doom 3 Mod Last Man Standing - http://Doom3Coop.com
Project Lead of Platinum Arts Sandbox Free 3D Game Maker - http://SandboxGameMaker.com
Youtube Channel - https://www.youtube.com/user/PlatinumArtsKids

User avatar
MangleFox70
Member
Posts: 62
Joined: Mon Feb 01, 2016 14:50
GitHub: Cat5TV
IRC: MangleFox70
In-game: MangleFox70
Contact:

Re: Convert Minecraft 1.8 skins to Minetest in PHP

by MangleFox70 » Post

Hey Mike,
We simply chose Skindex because it works well overall. The editor is generally easy to use, and there are a lot of users submitting skins regularly, so it has a continual cycle of new skins available for download. We're not partial to any one service... just offering that as one option and not over-complicating things for our users.

Sounds like a wonderful service you're offering to the kids. Have you had a look at our web site yet, minetest.tv? Our servers may be quite appropriate for your use since we run moderated kid-safe servers, and the kids' skins sync directly to their player account, so when they sign in the next day, they'll have their player skin all set up (and you didn't have to do any work to import it - ha!)

June is far off. We'll definitely have this update ready by then... likely in a week or two we'll have it. No worries there.

All the best and let us know if there's anything else we can do to help.

-RobbieF
#ThePixelShadow on YouTube
A Weekly Minetest Webcast hosted by MangleFox70
Have a mod you'd like featured? Want to participate in our show? Join servers.minetest.tv Port 30000 for creative or 30001 for survival.
Upload your own skin via our web site: Minetest.TV

User avatar
TheReaperKing
Member
Posts: 531
Joined: Sun Nov 22, 2015 21:36
Contact:

Re: Convert Minecraft 1.8 skins to Minetest in PHP

by TheReaperKing » Post

I have absolutely looked at your site and I plan to check it out more :) I feel like we have very similar goals in mind, which are to help kids create and specifically using minetest. I have started my own EDU version which I use in school at http://SandboxGameMaker.com It isn't much more than a subgame but I'm still learning the engine and I have lots of plans in store. The main goal is that I would like the kids to be able to gain the foundational skills of each Game Design job such as Coding, Modeling, Animation, Level Design, 2D Art (Textures and Skinning) and hopefully even sounds and music. I think Minetest is such a perfect candidate for that.

Regarding your server, I have actually thought about having them check it out but I wouldn't be able to when they are school. All it would take is for one person to say something inappropriate and a parent find out and everything gets shut down. Now outside of school is a separate story and also I could have them sign a waiver at the summer camp. I think it'd be pretty cool to see if we could all work together to survive in the PVP world. I have already had them try to survive in kind of a hardcore survival world but there was no pvp, just hunger that if they ran out of food they wouldn't die but be reduced to a crawl. It was pretty neat especially when they'd find food in the wild and get crazy excited. They learned a lot too about being nomads and starting agriculture, but anyway :)

I was also thinking if interested, you and your daughter would be more than welcome to help with the game I'm making for the little girl who lost her brother in the car accident. Even if it is simply ideas. Especially I have trouble knowing what an 8 year old girl would like, insight would be huge. I will be doing a forum topic on it that I can link.

Thanks again for being so willing to help us! My kiddos love making skins so they will go crazy when the converter is ready. Perhaps I could even have them write you some thank you letters :)

Take care and thank you again!
-Mike
Become A Real Life Superhero - http://SuperheroHill.com
Project Lead of the Doom 3 Mod Last Man Standing - http://Doom3Coop.com
Project Lead of Platinum Arts Sandbox Free 3D Game Maker - http://SandboxGameMaker.com
Youtube Channel - https://www.youtube.com/user/PlatinumArtsKids

snowflake
Member
Posts: 215
Joined: Mon Nov 16, 2015 16:50

Re: Convert Minecraft 1.8 skins to Minetest in PHP

by snowflake » Post

Image






Plz can u convert this skin to minetest >
Attachments
jpia37.png
jpia37.png (1.62 KiB) Viewed 2629 times

User avatar
MangleFox70
Member
Posts: 62
Joined: Mon Feb 01, 2016 14:50
GitHub: Cat5TV
IRC: MangleFox70
In-game: MangleFox70
Contact:

Re: Convert Minecraft 1.8 skins to Minetest in PHP

by MangleFox70 » Post

snowflake, you can do this at https://minetest.tv/skin-convert.php as previously stated.

Mike, we do like thank you letters :) Also, have the kids been watching The Pixel Shadow? They might enjoy it and it may inspire some of them (as it's every kid's dream to be a YouTube star these days, it seems.)
#ThePixelShadow on YouTube
A Weekly Minetest Webcast hosted by MangleFox70
Have a mod you'd like featured? Want to participate in our show? Join servers.minetest.tv Port 30000 for creative or 30001 for survival.
Upload your own skin via our web site: Minetest.TV

User avatar
TheReaperKing
Member
Posts: 531
Joined: Sun Nov 22, 2015 21:36
Contact:

Re: Convert Minecraft 1.8 skins to Minetest in PHP

by TheReaperKing » Post

I definitely want to get them watching it but unfortunately we don't have a lot of classtime and our school year is almost over (we end May 6th) so we've been working hard to make a rainbow castle for the girl who lost her brother. I definitely plan to have them check it out during the summer camp I'm running and they are super interested in streaming and in using minetest to make movies so I need to look into that as well. One thing that I want to start is a program where they help me build computers and sell them to low income families with kids and after a certain amount of time helping they earn their own computer. Maybe I can even figure out a way to actually pay them for helping. But this way too so they'll have a comp a home so maybe they can even join in some of those group eps of the pixelshadow and such and do their own videos, maybe even for me and my projects :)

I personally have watched a few eps of the Pixel Shadow and I think it is a great example of how even a child can do so much in Minetest. I want to get the kiddos doing that parkour map too :)

I hope you have a great night and thank you for all of your help and info.
-Mike
Become A Real Life Superhero - http://SuperheroHill.com
Project Lead of the Doom 3 Mod Last Man Standing - http://Doom3Coop.com
Project Lead of Platinum Arts Sandbox Free 3D Game Maker - http://SandboxGameMaker.com
Youtube Channel - https://www.youtube.com/user/PlatinumArtsKids

ProKGaming17
New member
Posts: 1
Joined: Wed Jun 29, 2016 16:40
In-game: kennycat

Re: Convert Minecraft 1.8 skins to Minetest in PHP

by ProKGaming17 » Post

How Do You Put Images On Here?

snowflake
Member
Posts: 215
Joined: Mon Nov 16, 2015 16:50

Re: Convert Minecraft 1.8 skins to Minetest in PHP

by snowflake » Post

Mangle idk how to do it but can u plz convert it ...

ph8jPf9M
Member
Posts: 77
Joined: Sat Jul 16, 2016 10:29
GitHub: 22i

Re: Convert Minecraft 1.8 skins to Minetest in PHP

by ph8jPf9M » Post

Your hosted skin converter doesnt seem to display anything at the momment its empty white page fix as soon as possible.

Fixed tnx

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests