ID:2569150
 
Haven't touched byond in years, I'm developing games with Unity and wanted to remake some BYOND classics but with stuff like
2D post processing and shaders etc.. stuff BYOND cant do.

I've extracted the .dmi files from some of my favorite games, but I can't turn them into .pngs

I used to be able to rename a .dmi file to .png and everything worked, but for some reason I can't do this anymore. Is it just me?
I made a crude dmi to png 'exporter', which just caches the .png files in your "../Documents/BYOND/cache" folder.


mob/verb/DMI2PNG()

var/wall = ""
for(var/f in flist(""))

if(findtext("[f]",".dmi"))

var/icon/i = new("[f]")
for(var/ic in icon_states(i,2))
var/icon/ii = new("[f]",icon_state = "[ic]")


usr << browse_rsc(ii, "[f]_[ic].png")
wall += "<img src='[f]_[ic].png' title='[f]_[ic]'>"

usr << browse(wall)


That should still work as long as the DMI is from a project that was created since the 3.5 release of BYOND. DMI files in their current form are just PNG files with extra metadata.

Some programs don't respect the metadata though and will wipe it out, so you need to use something like TweakPNG to keep track of it.
Edit: Just did an experiment and it turns out extracted .dmi files from an extractor wipes out all the metadata and won't let me change the extension to a .png :/
Without the metadata, it's just a flat PNG file. Not sure what you're doing to the file, but there's effectively no difference between a PNG and a DMI outside of that metadata, which is used to store things like states and directions.
Hm I wonder why an extracted .dmi won't convert but a freshly made .dmi from Dream Maker does. The fresh .dmi file even shows the image in my file viewer like its just a normal picture.
I’m pretty sure your file is the legacy DMI format and not PNG.

You can verify if the first few bytes of the file are the PNG signature or legacy DMI signature. (Without a hex editor it probably looks like “.PNG” or “.DMI”) The latter is documented here, though I’m fairly sure you can open it in Dream Maker and re-save in the current format.
In response to Nadrew
Nadrew wrote:
Some programs don't respect the metadata though and will wipe it out, so you need to use something like TweakPNG to keep track of it.

:sweating:
https://github.com/aseprite/aseprite/issues/2582