Forums

Sega Master System / Mark III / Game Gear
SG-1000 / SC-3000 / SF-7000 / OMV
Home - Forums - Games - Scans - Maps - Cheats - Credits
Music - Videos - Development - Hacks - Translations - Homebrew

View topic - PNG2Tile

Reply to topic
Author Message
  • Joined: 09 Apr 2013
  • Posts: 106
  • Location: Sydney Australia
Reply with quote
PNG2Tile
Post Posted: Tue Jan 26, 2016 12:15 pm
Hi,

I'm a big fan of Maxim's Bmp2Tile app. But I do all my dev work on a mac. So I end up running a windows VM just to use bmp2tile. Doh!

So... I decided to write a clone.

Introducing PNG2Tile ;-)

https://github.com/yuv422/png2tile

It is a command line app written in C++ It should be feature compatible with BMP2Tile. (I've still got 8x16 support to complete and chunky tiles)

I've added a feature to export the tilemap as an image. This was always a feature that I thought bmp2tile was lacking.
I've also added the ability to export the tilemap in Tiled TMX format. :-) As I use Tiled for my map layouts.

Anyway I hope you find this useful.

Any feedback is greatly appreciated. I can also make binaries if anyone is interested.

Regards,
Eric
  View user's profile Send private message
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 14682
  • Location: London
Reply with quote
Post Posted: Tue Jan 26, 2016 1:58 pm
That's all good, since BMP2Tile is a bit of a product of my lack of coding ability at the time. I'm not sure what writing the tilemap image means - isn't that the input image?

The main feature for me now (apart from the obvious conversion and duplicate removal) is the compression plugin support, which is going to be hard to do on a Mac - so I had ideas about replacing it with some Python scripts for the compression (which can of course happen as a separate step anyway, but it's nice to do it all in one).
  View user's profile Send private message Visit poster's website
  • Joined: 09 Apr 2013
  • Posts: 106
  • Location: Sydney Australia
Reply with quote
Post Posted: Wed Jan 27, 2016 10:52 am
Maxim wrote
I'm not sure what writing the tilemap image means - isn't that the input image?


Sorry I meant to say tileset. Take the input image and remove the dups then output the resulting tileset as another image. I can then feed this back into a mapeditor to build the actual game level.

I'm also planning to compile in the compression plugin code. That was part of the reason why I wrote it in C++. :)
  View user's profile Send private message
  • Joined: 01 Jan 2014
  • Posts: 331
Reply with quote
Post Posted: Mon Feb 08, 2016 2:27 am
Compiled for windows. Not sure of version so labeled 1.0. Very nice tool.
PNG2Tile 1.0.zip (138.72 KB)

  View user's profile Send private message
  • Joined: 04 Jul 2010
  • Posts: 539
  • Location: Angers, France
Reply with quote
Post Posted: Fri Mar 11, 2016 8:33 am
Compiled for Mac (10.9.5) as I needed it ;)

only output tiles as asm files ? (no bin ?)
PNG2Tile 1.0.zip (23.94 KB)

  View user's profile Send private message
  • Joined: 09 Apr 2013
  • Posts: 106
  • Location: Sydney Australia
Reply with quote
Post Posted: Fri Mar 11, 2016 10:28 am
ichigobankai wrote
Compiled for Mac (10.9.5) as I needed it ;)

only output tiles as asm files ? (no bin ?)


Hi ichigobankai, Yes only asm at this stage. I might go and add bin support at a later stage. At the moment I'm madly working on my comp entry. ;-)
  View user's profile Send private message
  • Joined: 04 Jul 2010
  • Posts: 539
  • Location: Angers, France
Reply with quote
Post Posted: Fri Mar 11, 2016 10:55 am
Me too ;)

and no problem, i've made a little python script to achieve this : "asm2bin".
  View user's profile Send private message
  • Joined: 22 Mar 2015
  • Posts: 228
Reply with quote
Post Posted: Tue Mar 29, 2016 12:58 am
I'm going to use this, btw could anyone explain me what does this tile in the tile asset I created mean?:

; Tile index $057
.db $00 $FD $FF $FF $00 $5D $FF $FF $00 $FD $FF $FF $00 $79 $FF $FF $00 $E9 $FF $FF $00 $61 $FF $FF $00 $03 $FF $FF $00 $FE $FF $FF


Thats because I want to switch pixels colours using the avaible palette asset I created.
Thanks in advance
  View user's profile Send private message
  • Joined: 04 Jul 2010
  • Posts: 539
  • Location: Angers, France
Reply with quote
Post Posted: Tue Mar 29, 2016 6:44 am
Read this : http://www.smspower.org/maxim/HowToProgram/Tiles ;)
  View user's profile Send private message
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 14682
  • Location: London
Reply with quote
Post Posted: Tue Mar 29, 2016 7:11 am
The tile data defines which palette index is used for each pixel, independently of the palette itself. There's rarely a need to look at the data after the PNG stage.
  View user's profile Send private message Visit poster's website
  • Joined: 22 Mar 2015
  • Posts: 228
Reply with quote
Post Posted: Wed Mar 30, 2016 12:46 am
Thank you, I understand now that every pixel is a group of 4 bits to point out to one of the 16 palette colours available and I succesfully edited every pixel or tile I wanted.
  View user's profile Send private message
  • Joined: 23 Mar 2013
  • Posts: 611
  • Location: Copenhagen, Denmark
Reply with quote
libpng error: sequential row overflow
Post Posted: Tue Apr 12, 2016 7:02 pm
Hi,

I was experimenting with how png2tile outputs palette, but I get the libpng error stated in the subject line above. I try to process the attached image using this command "png2tile gargoyle.png -pal sms -savepalette MadeWithPng2Tile.pal" ??
Gargoyle.zip (417 B)

  View user's profile Send private message Visit poster's website
  • Joined: 09 Apr 2013
  • Posts: 106
  • Location: Sydney Australia
Reply with quote
Post Posted: Sun May 01, 2016 11:40 am
hang-on wrote
Hi,

I was experimenting with how png2tile outputs palette, but I get the libpng error stated in the subject line above. I try to process the attached image using this command "png2tile gargoyle.png -pal sms -savepalette MadeWithPng2Tile.pal" ??


Hi hang-on,

Thanks for reporting this. I've finally gotten around to looking at it. I've just committed a fix. I wasn't handing the pixel expansion setting correctly for PNGs with a BPP < 8.

It should be fixed now. :)

Eric
  View user's profile Send private message
  • Joined: 09 Jul 2021
  • Posts: 24
Reply with quote
How to use it?
Post Posted: Sun Oct 24, 2021 4:58 pm
This is what happens when dragging a png file of a background I drew with the sms limitations in mind on the icon of this program.
What am I doing wrong?
All I want to do is to convert it. Am I asking for too much?!
png2tile.png (8.14 KB)
png2tile.png

  View user's profile Send private message
  • Joined: 05 Sep 2013
  • Posts: 3757
  • Location: Stockholm, Sweden
Reply with quote
Post Posted: Mon Oct 25, 2021 3:09 pm
first launch the program. if it runs fine, you can load the image to convert.
  View user's profile Send private message Visit poster's website
  • Joined: 09 Jul 2021
  • Posts: 24
Reply with quote
It does not run fine.
Post Posted: Mon Oct 25, 2021 4:06 pm
sverx wrote
first launch the program. if it runs fine, you can load the image to convert.


It didn't run fine when I opened it normally.
When I first extracted it from the archive and ran it, it kept saying that it needs some .dll files.
After I downloaded the needed .dll files, it showed the message on the screenshot.
  View user's profile Send private message
  • Joined: 09 Apr 2013
  • Posts: 106
  • Location: Sydney Australia
Reply with quote
Post Posted: Tue Oct 26, 2021 4:05 am
NoveltyMan wrote
sverx wrote
first launch the program. if it runs fine, you can load the image to convert.


It didn't run fine when I opened it normally.
When I first extracted it from the archive and ran it, it kept saying that it needs some .dll files.
After I downloaded the needed .dll files, it showed the message on the screenshot.


You will need to use this app from the command line. I don't think it would support drag and drop.

This reminds me that I should create a windows CI pipeline for this project on Appveyor. I might also see if I can get rid of the additional DLL dependencies and create a new release. :)
  View user's profile Send private message
  • Joined: 09 Jul 2021
  • Posts: 24
Reply with quote
impossible to use
Post Posted: Tue Oct 26, 2021 2:28 pm
efry wrote
NoveltyMan wrote
sverx wrote
first launch the program. if it runs fine, you can load the image to convert.


It didn't run fine when I opened it normally.
When I first extracted it from the archive and ran it, it kept saying that it needs some .dll files.
After I downloaded the needed .dll files, it showed the message on the screenshot.


You will need to use this app from the command line. I don't think it would support drag and drop.

This reminds me that I should create a windows CI pipeline for this project on Appveyor. I might also see if I can get rid of the additional DLL dependencies and create a new release. :)


I hope you will, because right now, this program is literally unusable.
Even when opening it normally to type in the command shows that annoying message.
  View user's profile Send private message
  • Joined: 09 Apr 2013
  • Posts: 106
  • Location: Sydney Australia
Reply with quote
PNG2Tile now with less dependencies
Post Posted: Fri Oct 29, 2021 10:16 am
Ok I've refactored the code and replaced libpng with LodePNG. So it shouldn't require any external DLLs now.

Could you give this version a go and see if it works?
png2tile_20211029.zip (55.64 KB)

  View user's profile Send private message
  • Joined: 09 Jul 2021
  • Posts: 24
Reply with quote
it doesn't work
Post Posted: Fri Oct 29, 2021 3:37 pm
efry wrote
Ok I've refactored the code and replaced libpng with LodePNG. So it shouldn't require any external DLLs now.

Could you give this version a go and see if it works?


No, it still doesn't.
I tried opening it normally.
  View user's profile Send private message
  • Joined: 09 Apr 2013
  • Posts: 106
  • Location: Sydney Australia
Reply with quote
Post Posted: Fri Oct 29, 2021 11:14 pm
NoveltyMan wrote
efry wrote
Ok I've refactored the code and replaced libpng with LodePNG. So it shouldn't require any external DLLs now.

Could you give this version a go and see if it works?


No, it still doesn't.
I tried opening it normally.


Sigh. That's no good. I tested it on a Windows 10 Home x64 machine and it worked ok. What version of Windows are you using?

I'm a Mac user so I'm not really familiar with potential issues with current Windows systems.

I used Appveyor to build this. Here's the build log.


https://ci.appveyor.com/project/yuv422/png2tile
  View user's profile Send private message
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 14682
  • Location: London
Reply with quote
Post Posted: Sat Oct 30, 2021 7:23 am
MSVC builds need C runtimes installed, which should be the case on any modern Windows version. Dependency Walker is probably the next step to diagnose what’s up, but that can be hard to do remotely.
  View user's profile Send private message Visit poster's website
  • Joined: 09 Aug 2021
  • Posts: 106
Reply with quote
Post Posted: Sat Oct 30, 2021 9:06 am
Maxim wrote
MSVC builds need C runtimes installed

simply build statically
  View user's profile Send private message
  • Joined: 09 Jul 2021
  • Posts: 24
Reply with quote
Post Posted: Sat Oct 30, 2021 4:28 pm
efry wrote
NoveltyMan wrote
efry wrote
Ok I've refactored the code and replaced libpng with LodePNG. So it shouldn't require any external DLLs now.

Could you give this version a go and see if it works?


No, it still doesn't.
I tried opening it normally.


Sigh. That's no good. I tested it on a Windows 10 Home x64 machine and it worked ok. What version of Windows are you using?

I'm a Mac user so I'm not really familiar with potential issues with current Windows systems.

I used Appveyor to build this. Here's the build log.


https://ci.appveyor.com/project/yuv422/png2tile


Version: Windows 10 Home
Version: 20H2
Features: Windows Feature Experience Pack 120.2212.3920.0
  View user's profile Send private message
  • Joined: 04 Oct 2019
  • Posts: 74
  • Location: Brazil
Reply with quote
Post Posted: Sun Oct 31, 2021 4:34 pm
efry wrote
Ok I've refactored the code and replaced libpng with LodePNG. So it shouldn't require any external DLLs now.

Could you give this version a go and see if it works?


Worked on my Win10 professional. Exporting tilesets as png is great!
  View user's profile Send private message
  • Joined: 09 Jul 2021
  • Posts: 24
Reply with quote
How?!
Post Posted: Sun Oct 31, 2021 9:18 pm
tsp wrote
efry wrote
Ok I've refactored the code and replaced libpng with LodePNG. So it shouldn't require any external DLLs now.

Could you give this version a go and see if it works?


Worked on my Win10 professional. Exporting tilesets as png is great!


How did you get it to work?!
  View user's profile Send private message
  • Joined: 04 Oct 2019
  • Posts: 74
  • Location: Brazil
Reply with quote
Post Posted: Mon Nov 01, 2021 3:04 am
NoveltyMan wrote
tsp wrote
efry wrote
Ok I've refactored the code and replaced libpng with LodePNG. So it shouldn't require any external DLLs now.

Could you give this version a go and see if it works?


Worked on my Win10 professional. Exporting tilesets as png is great!


How did you get it to work?!


Just ran it from the command prompt.

png2tile file.png -savetileimage tileset.png
  View user's profile Send private message
  • Joined: 09 Jul 2021
  • Posts: 24
Reply with quote
Post Posted: Mon Nov 01, 2021 8:15 am
tsp wrote
NoveltyMan wrote
tsp wrote
efry wrote
Ok I've refactored the code and replaced libpng with LodePNG. So it shouldn't require any external DLLs now.

Could you give this version a go and see if it works?


Worked on my Win10 professional. Exporting tilesets as png is great!


How did you get it to work?!


Just ran it from the command prompt.

png2tile file.png -savetileimage tileset.png


Alright. I'll try.
  View user's profile Send private message
  • Joined: 09 Jul 2021
  • Posts: 24
Reply with quote
Post Posted: Mon Nov 08, 2021 2:27 pm
NoveltyMan wrote
tsp wrote
NoveltyMan wrote
tsp wrote
efry wrote
Ok I've refactored the code and replaced libpng with LodePNG. So it shouldn't require any external DLLs now.

Could you give this version a go and see if it works?


Worked on my Win10 professional. Exporting tilesets as png is great!


How did you get it to work?!


Just ran it from the command prompt.

png2tile file.png -savetileimage tileset.png


Alright. I'll try.


I made a .txt file, put the "png2tile file.png -savetileimage tileset.png" command in it, saved it as a .exe file (I assume that this what you meant by doing it through a command prompt), and when trying to run it, all that happened was a window that says that this application won't run on my computer. (even though I was using a similar program that worked in the exact same way, and it ran fine)
  View user's profile Send private message
  • Joined: 05 Sep 2013
  • Posts: 3757
  • Location: Stockholm, Sweden
Reply with quote
Post Posted: Mon Nov 08, 2021 7:28 pm
the text file should have a .bat extension, not .exe
  View user's profile Send private message Visit poster's website
  • Joined: 09 Jul 2021
  • Posts: 24
Reply with quote
Post Posted: Mon Nov 08, 2021 7:56 pm
NoveltyMan wrote
This is what happens when dragging a png file of a background I drew with the sms limitations in mind on the icon of this program.
What am I doing wrong?
All I want to do is to convert it. Am I asking for too much?!


I still get this even when trying to run in a command prompt saved as a .bat file.
  View user's profile Send private message
Reply to topic



Back to the top of this page

Back to SMS Power!