Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Colonel_Panic

Pages: [1] 2 3 4
1
Programs / Re: Custom Image Format ***with compression***
« on: December 30, 2021, 04:24:46 am »
mcneil...

i tried it out. I thought it wasnt doing anything, then I went to
"hit anmy key to quit" and tapping hte spacebar put it thru its paces

the page you sent me to, sent me to an updated page...
so i got the latest one w/the update.

that page had a note something like "I only tested this in windoze, anyone tests it in LINUX let me know"

so, I'm running Linux Mint (tara) and it looks like it worked fine
I just noticed you "re-scaled" the images bigger and saved them bigger. most cool!

(I'm particularly happy about the PNG)

2
Programs / Re: Custom Image Format ***with compression***
« on: December 29, 2021, 11:03:22 pm »
hey STEVE, thanks ! (I checked out the commands in your sample code)

pretty cool, I inserted that code snippet into my "make" program and plopped an END statement after a single PRINT to a test file "foo.bar"

the compressed file size was almost exactly HALF of my ".imap3" format

I went and looked at MY algoriithm...
I am using 2 bytes to represent the 2 hex characters of each color
if i replaced each 2 hex chars color with a SINGLE BYTE that has the CHR$() value of 0 thru 255...

it would represent 0-255 and be half the size... which makes me wonder what the algorithm of "string compression" is, although i really dont CARE given its a lot faster.

EDITORS NOTE:
now that Steve McNeil has pointed out that I do not have to:
1) invent an image format
2) invent a viable compression algorithm

now I can "play ghetto GIMP" with a LOT less work and coding, and just come up with some kind of "structure" for my "filters"

3
Programs / Re: Custom Image Format ***with compression***
« on: December 29, 2021, 10:18:29 pm »
well, even if its all completely useless...

imapMAKE
imapMAKealpha

are both programs that simply create a 640x480 32 bit color image and save it to the file format. MAKE just makes a number of random colored lines and circles. the "alpha" does the same thing? but, it makes a big font "QB64" instead.

either program, you run first... they each create a file "BetaImage.imap"

==================================

at this point, you can "prove" the image file was created, and that you can read it in and display it, by running

imapOPEN

after you are done being (not) astonished, you then run...

imapPOST

this is the "compression" program, and it produces two other files...

"BetaImage.imap2"
"BetaImage.imap3"

and these are the 2 "compressed" formats. imap3 is slightly smaller than imap2.
naturally, you have to finish off your tour by running:

imapOPEN3

which will open and display ANY of the 3 formats.

4
Programs / Re: Custom Image Format ***with compression***
« on: December 29, 2021, 10:11:10 pm »
is "desired screen handle" the... image& handle? as in...

 img&=_newimage(640,480,32)

5
Programs / Custom Image Format ***with compression***
« on: December 29, 2021, 09:55:43 pm »
Here's my NOTES I kept fooling around... I am gonna post the couple of sample programs now, I dont know HOW long I will be here (and have internet) before I leave again.

By next time I'm here and I can post again... I should have this "genericized" into a couple of SUBs

anyways, heres my notes I kept...
==================================================
NOTESx

Why?

   Several reasons. First and foremost, I have a recent interest in images and working with them in most of my projects. I have the classic quandary; I can make neat stuff on the screen, creatively reading in and displaying whole and parts of images... but I cant SAVE this cool and novel image.

   Yes, I know, I am aware there are routines developed to save in "one format". And that its a STANDARD format.

   The 'problem' is that I want to TINKER. I thought I was going to read about the "structure" of several popular image file formats, pick one, and start reading it in and writing it out as/when i felt like it.

   This logic, while techincally sound, had one fatal flaw: I'm not on the "same wavelength" with the file format. ANY file format, there are hard ones, and impossible ones... there doesnt seem to be a single "easy" format for me, the programmer.

What can I do about this?

   Well... I simply make up my own image format. I spaghetti-coded a couple of untitled hot mess proof-of-concept programs. I decided I needed a custom image I would recognize... I decided 640x480 was fine for a test.

   A certain number of random lines and random circles, in random colors. HEY, a recognizeable 32 bit "image" on the screen.

640x480 yields exactly 307,200 pixels
they are RIGHT there on my screen, I need each pixels COLOR.
I simply make a big array of the image dimensions, its type ~& for not losing the blue component the manual said I think.
I fill up the array by sampling the pixels with POINT(x,y)
now I have an array filled with color values i can work with.

For now, I just need to utilitize this as best i can.

the original format I called .imap (image map?)
the first 2 lines are read in, how wide and how tall, respectively.
after that? follows (640 x 480) = 307200 lines, each line representing a color
since the Y loop is inside the overall x loop... it gets done by vertical stripes
this could be reversed though I dont see how it matters

each color is represented by 2 hex characters, so 6 hex characters on each line represent the 3 color components of that pixel.

since I used a black background, I decided to use a "0" instead of " 0 0 0" for ZERO color, this made some savings. though file was still huge for its image size.

it WORKS though. the MAKE program makes a sample 640x480 image of random lines and citrcles, and saves it in .imap format

the OPEN program, proves the system works by reading it in, and displaying it. YES, its very slow and more slow given its relatively small 640x480 test size. BUT, I have no "hardware acceleration", I have no "commercial compression", nothing.

so, if it just WORKS at all, I'm happy. If it works just fast enough I can actually sort of use it? great!

next, I need some kind of compression. I dont want ANY loss of any kind, so any strategy canonly be "loss-less". Well, there are a LOT of "0" entries in the file, since it was a black background I painted on.

My basic compresion strategy is as follows:

I sweep through the file. Any time the NEXT LINE is the same as the PRESENT LINE? I keep track of it, and keep reading forward, line by line, until I hit the spot its finally a different color line.

there is NO REASON to have that many identical lines, I decided to make a "postprocessor" character "+", followed by the number of identical lines to follow.
The first 345 lines of my sample image? were zero color. After running POST, the post-processed .imap2 file contains none of the skipped (identical) lines.

My final sweep through, put out to .imap3 file, looks for " 0 0 0" entries and replaces them with the "preprocessor" character "@".

its a big savings, and its completely "lossless" of a format.
All I need now is a .imap3 OPEN demo, and I am golden for a start.

====================================

what can I do with this?

well, I can open any image file, and scale and display it any way I want to.
mirror images, text added, whatever.

now, if i WANT to? I can easily experiment with making some kind of "GIMP filter"
type of deal. This gets me STARTED, allows me to make a sample interface, do whatever I want (crop, go B+W, whatever) and save it out.

Later ON, if i can get more comfortable with any real file structures, I can convert to them. I want to know how to work with stuff, this is the best way for me to learn I figure.

I figure no matter WHAT format I end up maybe getting into? I will STILL need an easy internal representation of what each pixel is doing, this format IS that representation. The fact I can save and load and edit it easily myself is just a side benefit.

SIZES @ image size 640x480:
.imap  =  2.5MB     ;raw file, zero compression
.imap2 =  20.2 kB  ;compression by duplication skip-tracking
.imap3 =  17.9 kB  ;every instance " 0 0 0" replaced with "@"


NOTE: this is 100% loss-less compression. not one pixel, not one color, has been molested from the original.
NOTE: if i draw less or more random lines and circles? the sizes of the compressed files inches up and down with it. Reason why being, a few less lines and circles, means bigger and longer "zero gaps" of black background, thatget replaced bya single entry at a time. The more single color back ground showing, the smaller the compression gets.
NOTE: I chose " 0 0 0" (black) to switch to "@" on final compression pass, simply because it was the background color and a lot of it.
in the future, i will probably add a line in the file up front, indicating what color is to be replaced by the @.

EG, if you know your background is for instance WHITE, then, obviously you would want to replace THAT color with the "@" shortener symbol.

=========================================================================

As a sample image, I switched over from "some lines and circles" to "giant text font".
In this case? the "compression" numbers are actually pretty great !

no matter WHAT the image is? its ALWAYS 2.5MB for the .imap file, it has no choice. If i write out the colors to every pixel? Thats simply "the size" and thats all there is to it.

20k and 17k are "very respectable" I feel, as rolled-at-home compression alogrithms, given that it is 100 percent "no loss"

6
Programs / Re: Zelda - The Legend of GX
« on: December 29, 2021, 08:41:54 pm »
siskel and ebert? give this one two thumbs up!

7
QB64 Discussion / Re: Cut and Paste
« on: December 29, 2021, 08:39:40 pm »
I notice the occasional "cut and paste" fiasco on my system
(linux mint tara)

I have 2 QB64 windows open? I figure I could cut and paste between the two?
never... I have to remember to open up the "copy" program in the word processor so it copies over.

I just figured it was just me and my mint setup.

8
Programs / Re: Text-to-speech in QB64
« on: December 29, 2021, 08:36:59 pm »
I just think this is one of the coolest things ever
BRAVO

I wish I could figure out how it worked... and get some long "ooooooooo..."
recordings to see if i can make them work as a "choir" for my audio software if i mess with the signal chain enough.

10
QB64 Discussion / Re: adding in library when building the C program??
« on: December 26, 2021, 07:40:36 pm »
Hm.
apparently, after looking at lists of window managers,
I'm looking for something really basic...

I dont even want stackable/tileable window management, I dont think.

All i want, is ONE window, "desktop size"... and I can put what I want
with graphics commands ON that one screen.


11
QB64 Discussion / Re: adding in library when building the C program??
« on: December 26, 2021, 06:53:03 pm »
Heres the short text excerpt I was talking about...

QUOTE
  This command creates new ".config" file, which contains the defaults for proper
   Busybox build process. Again, nothing extraordinary here.
   
      sed -i "s/.*CONFIG_STATIC.*/CONFIG_STATIC=y/" .config
   
   The command above is very important, because we inform the build process to build
   a static version of Busybox, meaning that the Busybox executable file will not
   be dependent on any external library. We cannot skip this step, otherwise our OS will
   fail with "kernel panic" when we try to boot.
   
      make busybox
   
   The command above compiles Busybox. Nothing interesting here. The build should be
   significantly faster compared to the kernel build.

12
QB64 Discussion / adding in library when building the C program??
« on: December 26, 2021, 06:45:08 pm »
I am (maybe) learning how to ask what i actually "want".

look at the following short text? Doesnt matter WHAT it is, whats important, is the part where they explain "this is so we BUILD the executable, and it contains everything, because we want it to run without any external libraries..." (paraphrasing)

Because the 'building' is just compiling a C program, its linux

I want the... "graphics stack" (??) compiled "into" a regular C program??

I want to have the QB64 "graphics commands" available for use when I execute, can i put the stuff in there at compile time? so I dont have to depend on some "window manager application"?

because right now, I need a certain "amount" (size...) of linux to be able to run graphics executables on it.... cant i just "bind" the damned graphics commands" into a (bigger) c-compilation?

I know I am not asking the exact right questions, but, maybe now you guys will have some perhaps better idea what I am asking for.

13
QB64 Discussion / Our own version of Linux
« on: December 26, 2021, 05:57:13 pm »
I am always wondering about "how Linux works".

Descriptions of files and folders is ONE thing, finding a few things ina  few folders is another thing... I find myself asking questions like "what is the minimum LInux I need?" to install QB64, and then to EXECUTE and DEPLOY my executables.

I get no answers, because i know i didnt know how to phrase the question.

SO, I found "Minimal Linux Live" and its a true "minimalist" linux.

Okay, so now BETTER question...
whats the minimum to get the "graphics stack" running, and I am seeing i think i must choose a "window manager". (I want a BASIC one, nothing fancy)

distro-hopping, I have several LINUX distros that i "like" and by that i mean, I like the fact I can just cut and paste executables/folders from a USB onto the desktop, set the "run as exe" flag... and BANG! I am off and running.

I need to identify, what is SIMILAR about these LINUX, so I can figure out "which" window manager I "like". Because? QB64 executables LIKE the same Linux distros.

curiously? this ONE distro, not only does everything install and run perfect? It has a neat trick... its the ONLY linux i have FOUIND yet... that I can specify a 32-bit newimage and screen it, and if its bigger than desktop width and desktop height? SLIDERS automatically appear on that window.

its the ONLY linux distro, on my short list, that does that...

=========================================

I realize I cant just copy and paste "GhettoWindowManager" and magically expect my environment to appear instantly, as if i am copying over a NOTEPAD program.

But, this is a great tool for LEARNING whats going on.

the resulting absolute minimum linux shell it makes? weird. There ARE no users, reminds me of DOS.

===================================

I figure a first demo would be simply booting the given image, but having removed the "hello" stuff and replaced it with my own "hello QB64" message, proving i can control "something" and move from there.

apparently, I could (probably) already "run" a qb64 "program" I placed in the file structure at scripting time, but it would be CONSOLE ONLY.

I need "graphics stack" and whatever basic windowing manager my GUI likes to run in.

if i can slowly add JUST whats needed for QB64 IDE + runtime... i could end up with a "lean and mean" system. (plus, I figure there's no WAY this won't teach me SOMETHING about whats going on in Linux.)

14
QB64 Discussion / Re: Download files
« on: December 26, 2021, 03:07:17 pm »
I am watching this with heightened interest... one of my "end game"
strategies, is to download "stuff" and have 2 or more applications "exchange bytes"

15
Programs / Re: CLOCK.BAS
« on: December 25, 2021, 04:28:04 pm »
@Colonel_Panic My clock says it Christmas what are you doing here ;-))

Its Christmas, I can do ANYTHING I WANT to do, right?

---I dont really "drink" drink...
---and I use my laptop the way most people use their PHONES, so...
---I dont want to go date some tinder roastie anyways

what more fun could i be having? I cant picture it.

Pages: [1] 2 3 4