5
lxmcf
6y

Back at my game engine asset system and thought of a way to store images and recreate them in memory programatically rather than 'unpacking' them... Bu turned a 256kb image into 4MB... How the fuck does this keep happening?!?!

Ugh this shit is going to drive me fucking mental!

Comments
  • 1
    Reminds me of a compression algorithm blooper of mine 😅

    Compression != disk filling
    Silly me!
  • 1
    Well, sounds like it added some metadata to it (e.g. conversion table or just metadata)
  • 0
    @mishaor from what i can tell its taking the image and writing the RGBA values as bytes per pixel so per pixel it's writing 4 bytes of data and with a 1024x1024 spritesheet it is just blowing it out of proportion... Really struggling with how im going to impliment this
  • 1
    @lxmcf if your image is black and white and has too many parts of same color, try some variant of RLE. Should work great on circles.
  • 0
    @mishaor Hmmm, this may actually work, problem is i want to build a CLI tool in c# but the drawing functions aren't available in CLI applications...

    Using gamemaker as the foundation and it's binary functions are slow as fuck in comparrison... Might give that a look though!
  • 2
    @mishaor RLE (with or without patterns) works quite nicely for b/w bitmaps!
  • 1
    I had to do something like this with 1bpp images back when I worked with TI-BASIC on the TI-8x line of calculators for demoscene stuff. I used cycle-based image... I wanna say "rollup", but "compression" is technically correct. It just doesn't quite seem like compression...
    Anyway, it'd take a 50k bit matrix and squish it to like a 2-3k list in the worst circumstances. idk if this applies to you, but see if this'd help at all. The less color depth, the better, of course, but still.
  • 0
    @lxmcf drawing functions not available? How can that be? I created quite some tools for image manipulations running on console, winforms and even web.
  • 0
    @CodeMasterAlex well I was going to use the bitmap functions that are part of System
    Drawing and nothing shows up, says that the reference doesn't exists and just asks to create an online class of Bitmap

    Edit: just had a look and it seems that System.Drawing has no restrictions in .NET core.... Might jump back into that and see what I can port
  • 0
    @lxmcf Add reference from some .dll that has System.Drawing
  • 0
    And if you want to store images in memory with compressing then someimage.Save(new MemoryStream(byte array)) and recreate them from memory Image.FromStream()
Add Comment