Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Creating a new image file extension

Author
Message
Non Sequitur M
17
Years of Service
User Offline
Joined: 28th Oct 2008
Location: Where am I!? Where are YOU?
Posted: 5th May 2011 19:12 Edited at: 5th May 2011 19:13
Okay. To start off, this does belong in the DBP discussion section, because this file type is completely encoded in DBP using IanM's Matrix1 plug-in.

So, yesterday, I set about creating a file extension for images. I've found a way to itemize pixel data efficiently. So far, the image can store a 1024x768 image at a bit depth of 32, while only using ~1.5Mb of space. PNG, on the other hand, saves the same image at only ~1.25Mb of space. The only thing is, they use Huffman encoding, and currently my file isn't encoded, just itemized! If I can efficiently use Huffman or arithmetic encoding, I can drop the file size by a whopping 60%(I base this on the fact that an unmodified file at the same size would take up 3Mb of space, yet theirs only takes up 1.25Mb, which is roughly 42% as big). That would bring my file size to a meager ~665Kb! The only problem is, I can only slightly comprehend either encoding method. If anyone here understands either encoding method, I would appreciate the help. Before you ask, I do know how to read and count binary, and understand bit math.

Thanks in advance, Amo.

If life were like a box of chocolates, I'd know what I would get... The one that got dropped on the floor and put back in the box.

Iye nehvur yoose spehl chehk, ahn mie tippyng izz fiyne.
Neuro Fuzzy
19
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 5th May 2011 19:38 Edited at: 5th May 2011 19:39
I've never done any compression myself, I've always just called external functions.

There's an open source thing hrere:
http://catcode.com/pngencoder/

(.java files are just .txt files, like .dbp or .cpp files)

[edit]
also, I was laughing at your avatar image, but I only just saw your "location".

Awesome xD


Tell me if there's a broken link to images in a thread I post, and I'll fix 'em.
Non Sequitur M
17
Years of Service
User Offline
Joined: 28th Oct 2008
Location: Where am I!? Where are YOU?
Posted: 5th May 2011 21:55
Thanks for the suggestion Fuzzy. There's only one problem. There is no actual image being encoded. It's the bytes of the data being encoded.

To explain:
An image file is basically a set of blueprints for building an image. The only way you see a picture is because the image software recognizes the file extension, pulls up it's set of instructions on how to use said blueprint, then puts all the pixels in the right order. I'm sure you knew that, but just want to get it out there for anyone who doesn't.

Okay, that out of the way, now to directly answer your post. The thing about my image file is, I'm totally rearranging the data. In a normal image file the data is stored as [red byte|green byte|blue byte|alpha value|repeat|repeat|etc...], mine uses a different method I call Itemized Bytes and Arithmetic encoding™, or .iba(I pronounce it ee-bah for short).

The thing is, I need a little rundown on arithmetic encoding. Sort of understand it, but I don't know how to encode a byte sized number, like 178 per se, into a smaller format. 178 would be written as 10110010 in binary. That correlates to (16*11)+2=178. How do you get smaller that that!? Lol.

Also, on the avatar/location comment. Thank you. I just wish I could change my name to match. I like how your avatar and name go together.

If life were like a box of chocolates, I'd know what I would get... The one that got dropped on the floor and put back in the box.

Iye nehvur yoose spehl chehk, ahn mie tippyng izz fiyne.
Neuro Fuzzy
19
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 5th May 2011 22:09
wait, so you don't know how to code your .iba algorithm?

also, if png images use huffman encoding, and the source code I linked you to compresses an image to a png file, then wouldn't the source code contain an example of huffman encoding?

There aren't many ways to compress a single byte. Most things deal with simplifying data sets containing many many bytes.

I don't think I can help you much tho, sry.


Tell me if there's a broken link to images in a thread I post, and I'll fix 'em.
Non Sequitur M
17
Years of Service
User Offline
Joined: 28th Oct 2008
Location: Where am I!? Where are YOU?
Posted: 5th May 2011 22:46
Quote: "wait, so you don't know how to code your .iba algorithm?"

I know how to make an algorithm to sort the data out, but not to deflate the data. With just the sorting algorithm, I can cut file size by up to 50%, but I need to deflate it with arithmetic encoding, like Huffman's dealey-o.

Quote: "also, if png images use huffman encoding, and the source code I linked you to compresses an image to a png file, then wouldn't the source code contain an example of huffman encoding?"

Ahh! I get it. Ok. I thought you were telling me to encode it using the program.
Quote: "There's an open source thing hrere:"

Ok, now I understand you think I should look at how the program itself is encoding! Got it! My bad. Thanks, I'll take a look.

If life were like a box of chocolates, I'd know what I would get... The one that got dropped on the floor and put back in the box.

Iye nehvur yoose spehl chehk, ahn mie tippyng izz fiyne.
Neuro Fuzzy
19
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 6th May 2011 01:26
ohh xD

Also, if that doesn't work out, you could just call the zlib dll.


Tell me if there's a broken link to images in a thread I post, and I'll fix 'em.
Non Sequitur M
17
Years of Service
User Offline
Joined: 28th Oct 2008
Location: Where am I!? Where are YOU?
Posted: 6th May 2011 17:45
I'm not using the open source as reference, just cause it's in a language I don't know, but he had a link to a full breakdown of different encoding methods. Thanks man. Seriously helpful.

If life were like a box of chocolates, I'd know what I would get... The one that got dropped on the floor and put back in the box.

Iye nehvur yoose spehl chehk, ahn mie tippyng izz fiyne.

Login to post a reply

Server time is: 2026-07-11 19:06:10
Your offset time is: 2026-07-11 19:06:10