Posted: Sun Nov 11, 2007 3:02 pm Post subject: pic creator
This is just a quick program i made when i was bored.
Pic Creator
WARNING: This Program is still in the Beta stage and errors may occur.
This program allows you to convert a .bmp or .jpg file to a turing readable .t file using the View.WhatDotColor (x, y) function. This is useful if you are creating a game (eg. mario) that uses moving pictures and you want to be able to compile it to an .exe file and send it to everyone but you don't want to have all of those picture files following allong. Why not just use this program and convert your pictures to a format turing recognizes and compile them with your program. All of your pictures are now in one .exe file. No need for a .zip folder!
To use this program just copy your pic to the same dir as this program and enter the file name (don't forget the extension) into the program. It automatically will do the rest. and export it as a .t file.
NOTE: Colour loss may occur. Only use small images.
Posted: Sun Nov 11, 2007 4:33 pm Post subject: RE:pic creator
Wow that's pretty cool. Did you try using turing RGB.GetColour and RGB.SetColor functions? I think you get a better variety with that.
agnivohneb
Posted: Sun Nov 11, 2007 5:37 pm Post subject: RE:pic creator
Thanks I will try that and post a update
agnivohneb
Posted: Sun Nov 11, 2007 6:28 pm Post subject: RE:pic creator
Just tried and there is no difference.
Nick
Posted: Sun Nov 11, 2007 6:30 pm Post subject: Re: pic creator
agnivohneb @ Sun Nov 11, 2007 3:02 pm wrote:
NOTE: Colour loss may occur.
wouldnt RGB prevent this?
StealthArcher
Posted: Mon Nov 12, 2007 7:23 pm Post subject: Re: pic creator
The functions you refer to only read turings default colors.
SNIPERDUDE
Posted: Mon Nov 12, 2007 8:32 pm Post subject: Re: pic creator
lol, I made a programme like this about a year ago. I kinda cheated though: I stored all of the RGB info in a text file (using a VB programme I made to get the RGB data, the turing whatdotcolour isn't that good), then made a corresponding turing program that converted the text file info into the pic.
It works though...
agnivohneb
Posted: Tue Nov 13, 2007 6:24 pm Post subject: Re: pic creator
momop @ Sun Nov 11, 2007 6:30 pm wrote:
agnivohneb @ Sun Nov 11, 2007 3:02 pm wrote:
NOTE: Colour loss may occur.
wouldnt RGB prevent this?
I did try but it stays the same colours and it was to confusing to get working. I just gave up and used turings default colours.
Sponsor Sponsor
agnivohneb
Posted: Tue Nov 13, 2007 6:36 pm Post subject: Re: pic creator
Sorry to post 2 messages so quickly but I have uploaded the source and a new license (by-nc-sa). Please respect the license. Have a look at it and upload any changes. Beta projects should not have just one person working on them.
Posted: Tue Nov 13, 2007 10:53 pm Post subject: Re: pic creator
You will get more help from me when yoiu change it to a gpl license.(Not meant to sound threatening or insulting, but it's hard to do with just text...)
Anyhow, after seeing this, I decided to try and make my own, however, instead of creating another turing file, it creates a binary with your photo in it, all made with View.WhatDotColor, and it has 24bit bitmap quality. I'm serious, I can take any bitmap, turn it into a .tbm with this using whatdotcolor, and turn it back out with drawdot, and it has 24 bit quality.
Now all i have to do is figure out a way to make it take less space than the original bitmap(though it does tkae less space than the .t files this makes).
Any ideas on how to do so? It's still in mega rough format, so dont mind the obvious blights like global vars, and commenting lack.
Turing:
setscreen("nobuttonbar") setscreen("graphics:400;200") var choice, quality :string:="1" var n :int var d :int:=1 var redam, blueam, greenam :real var yopic :int
proc colorred
for x :1.. 254
redam := x / 254 RGB.SetColor(x, redam, 0, 0) endfor end colorred
proc colorgreen
for x :1.. 254
greenam := x / 254 RGB.SetColor(x, 0, greenam, 0) endfor end colorgreen
proc colorblue
for x :1.. 254
blueam := x / 254 RGB.SetColor(x, 0, 0, blueam) endfor end colorblue
proc mainprogression
put"Please enter the path to the photo to be converted to a transferrable Bitmap." get choice
yopic :=Pic.FileNew(choice) var wide, tall, file, tem, wind :int:=0 var wde, tll, tempo, setup :string
wide :=Pic.Width(yopic)
tall :=Pic.Height(yopic)
wde :=intstr(wide)
tll :=intstr(tall) var photocolors :array1.. wide, 1.. tall, 1.. 3ofint
wind :=Window.Open("position;top;center,graphics;max;max,offscreenonly") Window.SetActive(wind) cls Pic.Draw(yopic, 0, 0, picCopy) RGB.SetColor(0, 0, 0, 0) View.Update open: file, (choice + ".tbm"),write write: file, wde
write: file, tll
colorred
for t :1.. tall
for u :1.. wide
photocolors (u, t, 1):=View.WhatDotColor(u, t) endfor endfor
colorgreen
for t :1.. tall
for u :1.. wide
photocolors (u, t, 2):=View.WhatDotColor(u, t) endfor endfor
colorblue
for t :1.. tall
for u :1.. wide
photocolors (u, t, 3):=View.WhatDotColor(u, t) endfor endfor for r :1.. tall
for p :1.. wide
write: file, photocolors (p, r, 1), photocolors (p, r, 2), photocolors (p, r, 3) endfor endfor close: file
put"Bitmap made transferrable." end mainprogression
proc secondprogression
RGB.SetColor(0, 0, 0, 0) var wide, tall, file, wind, rr, gg, bb :int:=0 var wde, tll, setup :string put"Please enter your transferrable bitmaps file path." get choice
open: file, choice, read read: file, wde
read: file, tll
wide :=strint(wde)
tall :=strint(tll) cls
wind :=Window.Open("position;top;center,graphics;max;max,offscreenonly") Window.SetActive(wind) cls put"Drawing bitmap" View.Update for r :1.. tall
for p :1.. wide
read: file, rr, gg, bb
redam:=rr/254
greenam:=gg/254
blueam:=bb/254 RGB.SetColor(1,redam,greenam,blueam) Draw.Dot(p, r, 1) endfor endfor close: file
View.Update end secondprogression
put"Welcome to the Transferrable Bitmap File(.tbf) Converter." delay(500) put"Would you like to convert a photo?(Bitmap, Jpg, or gif only), or examine a photo?" View.Update loop get choice
if choice ="convert"then
mainprogression
exit elsif choice ="examine"then
secondprogression
exit elsif choice ="no"then
exit else endif endloop
StealthArcher
Posted: Thu Nov 15, 2007 12:53 am Post subject: Re: pic creator
Posted: Thu Nov 15, 2007 5:54 pm Post subject: RE:pic creator
No matter what I seem to do I cannot cut down on size....
I've tried strings(dont ask...)
And boolean as well now(why oh why can they not be 1 bit instead of one byte????)
Reals, welll, im not really having the urge to try.....
Any one have any ideas at all to cut down on filespace usage?
Mazer
Posted: Thu Nov 15, 2007 7:14 pm Post subject: RE:pic creator
Is a tbf image bigger than the respective bitmap image?
StealthArcher
Posted: Thu Nov 15, 2007 7:38 pm Post subject: Re: pic creator
Yes, that's why I'm looking for ways to cut down on filespace.
If a boolean was a bit instead of a byte, I probably would just make it under the bitmaps original size.