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 - BMP2Tile 0.5 preview

Reply to topic
Author Message
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 12820
  • Location: London
Reply with quote
BMP2Tile 0.5 preview
Post Posted: Thu Jun 27, 2019 8:31 pm
Hi,

I've been spending some time on a rewrite of BMP2Tile in C# at https://github.com/maxim-zhao/bmp2tile/tree/c-sharp . This is mostly for my own sanity.

Changes include:
- Now has a true commandline app plus a GUI that uses it to do the work
- Compatible with existing compressor DLLs
- Commandline mode uses the same switches but they now operate sequentially. This is useful but may catch you out if you specify settings after the destination filename they affect.

All feedback is welcome.
bmp2tile0.5.zip (32.93 KB)

  View user's profile Send private message Visit poster's website
  • Joined: 08 Sep 2018
  • Posts: 147
Reply with quote
Post Posted: Thu Jun 27, 2019 9:32 pm
Well the GUI version feels like I'm not fighting with it as much as I use to with the old one! I like the warnings instead of instant crashes when I plug in a file with odd dimensions. Seems to also love Windows 10 (though windows 10 doesnt love it (thinks its a virus)).
Quick question that may be a bit out there, feel free to ignore it.
Do you ever plan on adding meta tile features into it?
  View user's profile Send private message
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 12820
  • Location: London
Reply with quote
Post Posted: Thu Jun 27, 2019 11:08 pm
No plans for meta tiles, I think you need a real tile layout editor for that because you need to add "layers" of other metadata to the metatiles - and it's also your level design too. I have an unfinished project to make a level editor for Micro Machines which has the beginnings of that - a hierarchy of tiles, metatiles and then level layout. You can't do that by starting with a level image.
  View user's profile Send private message Visit poster's website
  • Joined: 05 Sep 2013
  • Posts: 2465
Reply with quote
Post Posted: Fri Jun 28, 2019 7:30 am
no luck on wine - it crashes the moment I open an image. I don't know if it's something you can fix, in case here's the full error printed to console:

$ wine BMP2TileGUI.exe
0042:fixme:gdiplus:GdipBitmapLockBits cannot read bitmap from 30402 to 30803
System.NotImplementedException: The requested feature is not implemented [GDI+ status: NotImplemented]
  at System.Drawing.GDIPlus.CheckStatus (System.Drawing.Status status) [0x00190] in <3110e6dfe53a465e917aa087708d1bb4>:0
  at System.Drawing.Bitmap.LockBits (System.Drawing.Rectangle rect, System.Drawing.Imaging.ImageLockMode flags, System.Drawing.Imaging.PixelFormat format, System.Drawing.Imaging.BitmapData bitmapData) [0x00011] in <3110e6dfe53a465e917aa087708d1bb4>:0
  at System.Drawing.Bitmap.LockBits (System.Drawing.Rectangle rect, System.Drawing.Imaging.ImageLockMode flags, System.Drawing.Imaging.PixelFormat format) [0x00006] in <3110e6dfe53a465e917aa087708d1bb4>:0
  at (wrapper remoting-invoke-with-check) System.Drawing.Bitmap:LockBits (System.Drawing.Rectangle,System.Drawing.Imaging.ImageLockMode,System.Drawing.Imaging.PixelFormat)
  at BMP2Tile.Converter.GetTiles () [0x00040] in <f62fa9cc04064de485e9bd4848eaf8ea>:0
  at BMP2Tile.Converter.GetTilesAsText () [0x00000] in <f62fa9cc04064de485e9bd4848eaf8ea>:0
  at BMP2TileGUI.Form1.ConvertForDisplay () [0x000d2] in <be226bd4e6244fa096e55e1a52e8b87a>:0
  at BMP2TileGUI.Form1.LoadImage (System.String filename) [0x00024] in <be226bd4e6244fa096e55e1a52e8b87a>:0
  at BMP2TileGUI.Form1.btnBrowse_Click (System.Object sender, System.EventArgs e) [0x00032] in <be226bd4e6244fa096e55e1a52e8b87a>:0
  at System.Windows.Forms.Control.OnClick (System.EventArgs e) [0x00019] in <dfcf5e19b3744f6abc3507fe9dffa1dd>:0
  at System.Windows.Forms.Button.OnClick (System.EventArgs e) [0x0001e] in <dfcf5e19b3744f6abc3507fe9dffa1dd>:0
  at System.Windows.Forms.ButtonBase.OnMouseUp (System.Windows.Forms.MouseEventArgs mevent) [0x00069] in <dfcf5e19b3744f6abc3507fe9dffa1dd>:0
  at System.Windows.Forms.Button.OnMouseUp (System.Windows.Forms.MouseEventArgs mevent) [0x00000] in <dfcf5e19b3744f6abc3507fe9dffa1dd>:0
  at System.Windows.Forms.Control.WmLButtonUp (System.Windows.Forms.Message& m) [0x00078] in <dfcf5e19b3744f6abc3507fe9dffa1dd>:0
  at System.Windows.Forms.Control.WndProc (System.Windows.Forms.Message& m) [0x001b4] in <dfcf5e19b3744f6abc3507fe9dffa1dd>:0
  at System.Windows.Forms.ButtonBase.WndProc (System.Windows.Forms.Message& m) [0x00037] in <dfcf5e19b3744f6abc3507fe9dffa1dd>:0
  at System.Windows.Forms.Button.WndProc (System.Windows.Forms.Message& m) [0x00000] in <dfcf5e19b3744f6abc3507fe9dffa1dd>:0
  at System.Windows.Forms.Control+ControlWindowTarget.OnMessage (System.Windows.Forms.Message& m) [0x00000] in <dfcf5e19b3744f6abc3507fe9dffa1dd>:0
  at System.Windows.Forms.Control+ControlNativeWindow.WndProc (System.Windows.Forms.Message& m) [0x0000b] in <dfcf5e19b3744f6abc3507fe9dffa1dd>:0
  at System.Windows.Forms.NativeWindow.WndProc (System.IntPtr hWnd, System.Windows.Forms.Msg msg, System.IntPtr wParam, System.IntPtr lParam) [0x00085] in <dfcf5e19b3744f6abc3507fe9dffa1dd>:0
  View user's profile Send private message Visit poster's website
  • Joined: 05 Sep 2013
  • Posts: 2465
Reply with quote
Post Posted: Fri Jun 28, 2019 7:32 am
@IllusionOfMana: as for meta-tiles, you can create a plugin that exports meta-tilemaps from Tiled tilesets PNGs, for instance, and couple that with a Tiled map exporter to have meta-tile support.
  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 12820
  • Location: London
Reply with quote
Post Posted: Fri Jun 28, 2019 8:07 am
Well, Wine support is not often a goal for me but nice to have. It seems they have not implemented some part of GDI+ - my guess is they didn't implement the part where it can automatically extend a 4bpp image to 8bpp. I can work around that by making my own conversion.
  View user's profile Send private message Visit poster's website
  • Joined: 05 Sep 2013
  • Posts: 2465
Reply with quote
Post Posted: Fri Jun 28, 2019 8:30 am
I don't think it's that, it crashes with a 8bpp color and with a 24bpp color image too :|
  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 12820
  • Location: London
Reply with quote
Post Posted: Fri Jun 28, 2019 9:03 am
Hmm, well the exception is saying it can't convert from PixelFormat4bppIndexed = 0x30402 to PixelFormat8bppIndexed = 0x30803. I've written my own converter so I shouldn't be asking GDI+ to do that any more - can you try the attached version?

Also, now auto-building at https://ci.appveyor.com/project/maxim-zhao/bmp2tile/build/artifacts
bmp2tile0.5.zip (33.2 KB)

  View user's profile Send private message Visit poster's website
  • Joined: 05 Sep 2013
  • Posts: 2465
Reply with quote
Post Posted: Fri Jun 28, 2019 9:41 am
Works perfectly with a 16 colors PNG!

Still crashes with paletted images with more colors (in the palette, even unused):

System.Exception: Image uses colours up to index 63 - this must be no more than 15. There are 16 palette entries used.
  at BMP2Tile.Converter.GetPalette () [0x000ad] in <801e3cdfd68a42a5a90e684aafc7118e>:0
  at BMP2Tile.Converter.GetPaletteAsText (BMP2Tile.Palette+Formats format) [0x00000] in <801e3cdfd68a42a5a90e684aafc7118e>:0
  at BMP2TileGUI.Form1.ConvertForDisplay () [0x00120] in <5fdb8fece57f4ab189d159fe8e75679e>:0
  at BMP2TileGUI.Form1.LoadImage (System.String filename) [0x00024] in <5fdb8fece57f4ab189d159fe8e75679e>:0
  at BMP2TileGUI.Form1.btnBrowse_Click (System.Object sender, System.EventArgs e) [0x00032] in <5fdb8fece57f4ab189d159fe8e75679e>:0
  at System.Windows.Forms.Control.OnClick (System.EventArgs e) [0x00019] in <dfcf5e19b3744f6abc3507fe9dffa1dd>:0
  at System.Windows.Forms.Button.OnClick (System.EventArgs e) [0x0001e] in <dfcf5e19b3744f6abc3507fe9dffa1dd>:0
  at System.Windows.Forms.ButtonBase.OnMouseUp (System.Windows.Forms.MouseEventArgs mevent) [0x00069] in <dfcf5e19b3744f6abc3507fe9dffa1dd>:0
  at System.Windows.Forms.Button.OnMouseUp (System.Windows.Forms.MouseEventArgs mevent) [0x00000] in <dfcf5e19b3744f6abc3507fe9dffa1dd>:0
  at System.Windows.Forms.Control.WmLButtonUp (System.Windows.Forms.Message& m) [0x00078] in <dfcf5e19b3744f6abc3507fe9dffa1dd>:0
  at System.Windows.Forms.Control.WndProc (System.Windows.Forms.Message& m) [0x001b4] in <dfcf5e19b3744f6abc3507fe9dffa1dd>:0
  at System.Windows.Forms.ButtonBase.WndProc (System.Windows.Forms.Message& m) [0x00037] in <dfcf5e19b3744f6abc3507fe9dffa1dd>:0
  at System.Windows.Forms.Button.WndProc (System.Windows.Forms.Message& m) [0x00000] in <dfcf5e19b3744f6abc3507fe9dffa1dd>:0
  at System.Windows.Forms.Control+ControlWindowTarget.OnMessage (System.Windows.Forms.Message& m) [0x00000] in <dfcf5e19b3744f6abc3507fe9dffa1dd>:0
  at System.Windows.Forms.Control+ControlNativeWindow.WndProc (System.Windows.Forms.Message& m) [0x0000b] in <dfcf5e19b3744f6abc3507fe9dffa1dd>:0
  at System.Windows.Forms.NativeWindow.WndProc (System.IntPtr hWnd, System.Windows.Forms.Msg msg, System.IntPtr wParam, System.IntPtr lParam) [0x00085] in <dfcf5e19b3744f6abc3507fe9dffa1dd>:0


and with 24bpp images:
System.NotImplementedException: Unsupported bitmap format Format24bppRgb
  at BMP2Tile.Converter.GetTile (System.Drawing.Point coordinate, System.Drawing.Imaging.BitmapData bitmapData) [0x00168] in <801e3cdfd68a42a5a90e684aafc7118e>:0
  at BMP2Tile.Converter.GetTiles () [0x00083] in <801e3cdfd68a42a5a90e684aafc7118e>:0
  at BMP2Tile.Converter.GetTilesAsText () [0x00000] in <801e3cdfd68a42a5a90e684aafc7118e>:0
  at BMP2TileGUI.Form1.ConvertForDisplay () [0x000d2] in <5fdb8fece57f4ab189d159fe8e75679e>:0
  at BMP2TileGUI.Form1.LoadImage (System.String filename) [0x00024] in <5fdb8fece57f4ab189d159fe8e75679e>:0
  at BMP2TileGUI.Form1.btnBrowse_Click (System.Object sender, System.EventArgs e) [0x00032] in <5fdb8fece57f4ab189d159fe8e75679e>:0
  at System.Windows.Forms.Control.OnClick (System.EventArgs e) [0x00019] in <dfcf5e19b3744f6abc3507fe9dffa1dd>:0
  at System.Windows.Forms.Button.OnClick (System.EventArgs e) [0x0001e] in <dfcf5e19b3744f6abc3507fe9dffa1dd>:0
  at System.Windows.Forms.ButtonBase.OnMouseUp (System.Windows.Forms.MouseEventArgs mevent) [0x00069] in <dfcf5e19b3744f6abc3507fe9dffa1dd>:0
  at System.Windows.Forms.Button.OnMouseUp (System.Windows.Forms.MouseEventArgs mevent) [0x00000] in <dfcf5e19b3744f6abc3507fe9dffa1dd>:0
  at System.Windows.Forms.Control.WmLButtonUp (System.Windows.Forms.Message& m) [0x00078] in <dfcf5e19b3744f6abc3507fe9dffa1dd>:0
  at System.Windows.Forms.Control.WndProc (System.Windows.Forms.Message& m) [0x001b4] in <dfcf5e19b3744f6abc3507fe9dffa1dd>:0
  at System.Windows.Forms.ButtonBase.WndProc (System.Windows.Forms.Message& m) [0x00037] in <dfcf5e19b3744f6abc3507fe9dffa1dd>:0
  at System.Windows.Forms.Button.WndProc (System.Windows.Forms.Message& m) [0x00000] in <dfcf5e19b3744f6abc3507fe9dffa1dd>:0
  at System.Windows.Forms.Control+ControlWindowTarget.OnMessage (System.Windows.Forms.Message& m) [0x00000] in <dfcf5e19b3744f6abc3507fe9dffa1dd>:0
  at System.Windows.Forms.Control+ControlNativeWindow.WndProc (System.Windows.Forms.Message& m) [0x0000b] in <dfcf5e19b3744f6abc3507fe9dffa1dd>:0
  at System.Windows.Forms.NativeWindow.WndProc (System.IntPtr hWnd, System.Windows.Forms.Msg msg, System.IntPtr wParam, System.IntPtr lParam) [0x00085] in <dfcf5e19b3744f6abc3507fe9dffa1dd>:0
  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 12820
  • Location: London
Reply with quote
Post Posted: Fri Jun 28, 2019 2:25 pm
Those are intentional exceptions, not crashes (except insofar as they are errors with a stack trace and then the program exits). I did not try to make them look pretty.

In Windows they show up as message boxes with the stack hidden away and then an option to continue. I can go sprinkle in some catches...
  View user's profile Send private message Visit poster's website
  • Joined: 08 Sep 2018
  • Posts: 147
Reply with quote
Post Posted: Fri Jun 28, 2019 3:59 pm
sverx wrote
@IllusionOfMana: as for meta-tiles, you can create a plugin that exports meta-tilemaps from Tiled tilesets PNGs, for instance, and couple that with a Tiled map exporter to have meta-tile support.


Yeah I'm aware of the method(its actually incredibly smart), Psidum's UGT does it but I was more or less hoping for something more customizable I guess.
  View user's profile Send private message
  • Joined: 05 Sep 2013
  • Posts: 2465
Reply with quote
Post Posted: Fri Jun 28, 2019 5:29 pm
@Maxim: on Wine you can't tell if it has crashed or not, it just closes with no message whatsoever.

@IllusionOfMana: what can be more customizable than plug-ins/exporters you code yourself? ;)
  View user's profile Send private message Visit poster's website
  • Joined: 08 Sep 2018
  • Posts: 147
Reply with quote
Post Posted: Fri Jun 28, 2019 6:37 pm
sverx wrote

@IllusionOfMana: what can be more customizable than plug-ins/exporters you code yourself? ;)


You are correct, I'm just being lazy about it. I should start building an SMS compatible map editor plugin! Something that'll output for the SMS and MegaDrive... we'll see... If I do, I'll make a thread about it.
  View user's profile Send private message
  • Joined: 05 Sep 2013
  • Posts: 2465
Reply with quote
Post Posted: Fri Jun 28, 2019 7:55 pm
Even if it greatly depends on what you want to do, Tiled can be enough for your needs. You can create Python exporters easily.
  View user's profile Send private message Visit poster's website
  • Joined: 08 Sep 2018
  • Posts: 147
Reply with quote
Post Posted: Fri Jun 28, 2019 8:02 pm
I use Tiled a lot for my PC work and have even built tools around it to help bridge the gaps between it and the engine Ive composed.
  View user's profile Send private message
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 12820
  • Location: London
Reply with quote
Post Posted: Sat Jun 29, 2019 8:10 am
New version with internal exception handling, hopefully making it clearer what's a "normal" error:

https://ci.appveyor.com/project/maxim-zhao/bmp2tile/builds/25630853/artifacts

Part of the goal of the rewrite was to make it a proper commandline program, as these days I pretty much always use it as part of an assets conversion batch - which I'd expect a Linuxer to prefer anyway :)
  View user's profile Send private message Visit poster's website
  • Joined: 05 Sep 2013
  • Posts: 2465
Reply with quote
Post Posted: Sat Jun 29, 2019 10:31 am
Maxim wrote
Part of the goal of the rewrite was to make it a proper commandline program, as these days I pretty much always use it as part of an assets conversion batch - which I'd expect a Linuxer to prefer anyway :)


I'm not converting the assets as a part of the building process, so I tend to use the GUI, even on Linux.
  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 12820
  • Location: London
Reply with quote
Post Posted: Wed Jul 03, 2019 3:23 pm
Now official:

https://github.com/maxim-zhao/bmp2tile/releases/tag/v0.5
  View user's profile Send private message Visit poster's website
  • Joined: 05 Sep 2013
  • Posts: 2465
Reply with quote
Post Posted: Thu Jul 04, 2019 10:13 am
Maxim wrote
New version with internal exception handling, hopefully making it clearer what's a "normal" error


... and works perfectly as expected :)
  View user's profile Send private message Visit poster's website
Reply to topic



Back to the top of this page

Back to SMS Power!