|
|
Emperor
Maniac (V) Mad Scientist with Finglongers
From: Cell 53, East Wing Insane since: Jul 2001
|
posted 11-05-2002 14:58
OK lets start again............
___________________
Emps
FAQs: Emperor
|
Emperor
Maniac (V) Mad Scientist with Finglongers
From: Cell 53, East Wing Insane since: Jul 2001
|
posted 11-05-2002 15:02
OK butcher asked about converting ASCII into a graphic and quite a lot of ideas where put forward and some links to info on the file format where given:
http://www.dcs.ed.ac.uk/home/mxr/gfx/2d-hi.html
http://www.ozoneasylum.com/Archives/Archive-000002/HTML/20021015-1-005457.html
Although not posted in the previous thread I found out that netpbm had an ASCII to PBM module:
http://netpbm.sourceforge.net/doc/asciitopgm.html
However this only creates a grayscale image.
So thoughts?
Try and keep things on topic thanks
___________________
Emps
FAQs: Emperor
|
Slime
Lunatic (VI) Mad Scientist
From: Massachusetts, USA Insane since: Mar 2000
|
posted 11-05-2002 15:14
I was looking into the gif file format. So far I've figured this much out:
first 6 bytes:
GIF89a
2 bytes: image width (little endian)
2 bytes: image height (little endian)
3 bytes: mystery, but has something to do with pallette size. (0x80: n=2; 0x91: n=4; 0xA2: n=8; ...?)
n*3 bytes: pallete rgb values. (n is one of 2,4,8,16,32,64,128,256.)
5 bytes: (2C 00 00 00 00)
2 bytes: image width (little endian)
2 bytes: image height (little endian)
after that comes the image data, and that's supposedly compressed with "LZW compression," which I'm having a really hard time figuring out. =) I've found a couple good explanations online, but it's still conceptually very difficult.
I'm sure someone will find a more reasonable solution before I figure it out, anyway.
|
butcher
Paranoid (IV) Inmate
From: New Jersey, USA Insane since: Oct 2000
|
posted 11-05-2002 16:08
I know I posted the original question, but I think this has gone way over my current skill level. I would really like to be able to see this through, but I definitely won't be able to without some major help!!
Thanks guys.
And thanks for restarting the thread Emps.
-Butcher-
|
Petskull
Maniac (V) Mad Scientist
From: 127 Halcyon Road, Marenia, Atlantis Insane since: Aug 2000
|
posted 11-05-2002 18:00
dude!
you're at that point!!
... you can walk away- or you can give it a shot... worst case- you'll have to delete a script off of your computer...
try it... come up with the specific questions and we'll help you find the answers...
That's how threads get good!
Code - CGI - links - DHTML - Javascript - Perl - programming - Magic - http://www.twistedport.com
ICQ: 67751342
|
InI
Paranoid (IV) Mad Scientist
From: Somewhere over the rainbow Insane since: Mar 2001
|
posted 11-05-2002 18:19
The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.
|
Emperor
Maniac (V) Mad Scientist with Finglongers
From: Cell 53, East Wing Insane since: Jul 2001
|
posted 11-06-2002 00:11
InI: My understanding is that the plan is for Bugs' painter to export and ascii string to PHP which processes it into an image pixel by pixel. Although I might not have a full grasp of the project
The netpbm module does something similar but I presume to keep things simple it only works in greyscale (from M to - or something). I presume 256 colours isn't too much of extra hassle but once you get to millions of colours it could be tricky or is it? Or, as I suggested to Butcher, could you do 256 colours then icnrease the number of colours used? Or is that not required?
___________________
Emps
FAQs: Emperor
|
Bugimus
Maniac (V) Mad Scientist
From: New California Insane since: Mar 2000
|
posted 11-06-2002 02:01
Yes, I figured passing the image data via an ascii string would be the best way. In fact, I'm not sure of another way.
The number of colors could really be whatever a gif can handle per pixel.
I was totally hoping this would be a 10 liner PHP... I think we have all the pieces to the puzzle except the actual code to take some data from the paint page and get it into the gif format. That's the real unknown at this point.
If you've got it, let's see it And then we're well on our way. Thanks for everyone's help so far.
|
stinx
Bipolar (III) Inmate
From: London, UK Insane since: Apr 2002
|
posted 11-07-2002 12:49
If the image size isn't an issue, you can skip the LZW compression. IIRC, Gif format will cope with non-compressed data in that section, as all the data section refers to is indices in the palette.
If you think of the palette as a definition of a pixel, rather than a definition of a colour, LZW basically increases the palette to incorporate patterns of pixels, rather than just single pixels. It then reuses those patterns as they reoccur to describe larger chunks of data with just one reference to the now extended palette. Since this palette extension is done in program memory, the original palette in the file remains at a fixed size, and the file size shrinks as there are less references into the palette per pixel. (Bear in mind this is an explanation from someone who couldn't get it to work )
By ignoring the compression algorithm, you end up with one reference into the palette per pixel in your image, but it is still valid gif data. This uncompressed form is the way to get around patent issues and still use the gif spec.
If you're using small icons, then I can't see the file size being too much of a problem (16*16 pixels = 256 entries in your gif data section), but you could always get the compression working later once somebody can explain it properly!
|
InI
Paranoid (IV) Mad Scientist
From: Somewhere over the rainbow Insane since: Mar 2001
|
posted 11-07-2002 13:11
The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.
|
InI
Paranoid (IV) Mad Scientist
From: Somewhere over the rainbow Insane since: Mar 2001
|
posted 11-07-2002 13:34
The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.
|
stinx
Bipolar (III) Inmate
From: London, UK Insane since: Apr 2002
|
posted 11-07-2002 19:02
Yeah, I know InI. I wasn't saying that's the way it should be done. I have a use for something similar and it will be done using gd. I found out how harsh it is to do this stuff from scratch a long time ago
Besides, I think what I said about uncompressed gifs might be complete bs that I picked up from somewhere else. I can't find anything that supports or explains how to do it, and I certainly can't get it to work.
You should know not to trust everything I say as being useful. We can't all be perfect :P
|
InI
Paranoid (IV) Mad Scientist
From: Somewhere over the rainbow Insane since: Mar 2001
|
posted 11-07-2002 19:30
The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.
|
Emperor
Maniac (V) Mad Scientist with Finglongers
From: Cell 53, East Wing Insane since: Jul 2001
|
posted 11-07-2002 19:37
InI: Yep that makes sense - we don't have GD yet (we are using netpbm) but I assume there must be a similar function.
[edit: I'm not so sure - surely there must be but nothing jumps out at me:
http://netpbm.sourceforge.net/doc/
anyone spot anything useful?]
Bugs: Would it be possible to see an example of this ASCII string or can you make it spit out what we want it to?
___________________
Emps
FAQs: Emperor
|
Bugimus
Maniac (V) Mad Scientist
From: New California Insane since: Mar 2000
|
posted 11-07-2002 22:26
I should be able to make the ascii string anything we need to support the backend processing. I'm quite flexible on that.
|
InI
Paranoid (IV) Mad Scientist
From: Somewhere over the rainbow Insane since: Mar 2001
|
posted 11-07-2002 22:35
The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.
|
InI
Paranoid (IV) Mad Scientist
From: Somewhere over the rainbow Insane since: Mar 2001
|
posted 11-07-2002 22:49
The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.
|
Bugimus
Maniac (V) Mad Scientist
From: New California Insane since: Mar 2000
|
posted 11-07-2002 23:48
InI, you used ImageMagick in that test program? If so, then it seems like we can use that to create the jpg and use the netpbm conversion routine to create the icon file.
So Emps and butcher, is it easy to get ImageMagick installed? If so, I think we have our solution... unless I"m missing something. Thanks so much for the help, InI.
|
butcher
Paranoid (IV) Inmate
From: New Jersey, USA Insane since: Oct 2000
|
posted 11-08-2002 04:07
I don't know if Image Magick is on the GN server or not (Emps ?) but if it is (or can be) and InI can do the deed with image magick to convert the ascii into a jpeg, I could certainly do the rest with php and netPBM.
-Butcher-
[This message has been edited by butcher (edited 11-08-2002).]
|
Emperor
Maniac (V) Mad Scientist with Finglongers
From: Cell 53, East Wing Insane since: Jul 2001
|
posted 11-08-2002 04:23
Sorry it isn't available and will only be available when (not if ) we get a new server unless someone has any good ideas?
[edit: removed my silly comment on butcher's typo as he has corrected it and I don't want to looks ily or confuse anyone ]
___________________
Emps
FAQs: Emperor
|
Bugimus
Maniac (V) Mad Scientist
From: New California Insane since: Mar 2000
|
posted 11-08-2002 04:50
Well, I don't think we're totally deed yet. Couldn't we use PHP to parse the ascii data and then build a PPM image from scratch? The docs said it was a fairly straight forward format and did not require any compression.
[edit] Too late! I already saw it and took a shot [/edit]
[This message has been edited by Bugimus (edited 11-08-2002).]
|
InI
Paranoid (IV) Mad Scientist
From: Somewhere over the rainbow Insane since: Mar 2001
|
posted 11-08-2002 08:07
The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.
|
InI
Paranoid (IV) Mad Scientist
From: Somewhere over the rainbow Insane since: Mar 2001
|
posted 11-08-2002 13:19
The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.
|
Emperor
Maniac (V) Mad Scientist with Finglongers
From: Cell 53, East Wing Insane since: Jul 2001
|
posted 11-08-2002 14:10
InI: Thanks for the offers
I think the best bet might be to go with Bugs' solution I'm just not sure of the details so I can't be much help but if I get time I'll have a nose around.
___________________
Emps
FAQs: Emperor
|
genis
Paranoid (IV) Inmate
From: Dallas, TX Insane since: Aug 2002
|
posted 11-09-2002 11:29
okay, people.... this thread is a little hard to follow, but what I'm seeing is...
that you want an EASY way to pass the binary that makes up a gif to somewhere, then recreate it as a gif again on the other side?? Yes?
Well that's easy... take the ascii readable binary and make it hex, then pass it, then recreate it as binary again... with the right header of course (although not always necessary).
so here's the functions I use to do that in php. code:
function hexgen($filename) {
$file = fopen($filename, "rb"); #open file
$source = fread($file, filesize($filename)); #read it
fclose($file); #close it
$pic = bin2hex($source); #hex it
return $pic; #return it
}
/* decode hex encoded image file into ascii readable binary. */
function hex2img($binpic) {
$data = pack("H".strlen($binpic),$binpic);
echo $data; # display image
}
You can add a Header("Content-type: image/gif"); to that last one if you like, I usually keep it out because the browsers don't care, they just look at the front bits.
It's considered good form however, but ... feh.
I don't use these but for maybe calling default images on sites.
I usually dump all my images in large blobs into a database and call them from there without the processing power it takes for hex/bin conversion.
It does come in handy though.
|
InI
Paranoid (IV) Mad Scientist
From: Somewhere over the rainbow Insane since: Mar 2001
|
posted 11-09-2002 11:35
The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.
|
genis
Paranoid (IV) Inmate
From: Dallas, TX Insane since: Aug 2002
|
posted 11-09-2002 11:40
Oh sorry then.
I don't understand your "b)", though.
Something about storying large binaries in a database is wrong?
How is it different from storing them on the hard drive as files and calling them from there?
Could you point me to where you acquired this logic?
|
InI
Paranoid (IV) Mad Scientist
From: Somewhere over the rainbow Insane since: Mar 2001
|
posted 11-09-2002 11:42
The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.
|
InI
Paranoid (IV) Mad Scientist
From: Somewhere over the rainbow Insane since: Mar 2001
|
posted 11-09-2002 11:48
The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.
|
genis
Paranoid (IV) Inmate
From: Dallas, TX Insane since: Aug 2002
|
posted 11-09-2002 12:17
well i only use them when they're directly correlated to other data already needing to be pulled from the database.
Like pictures that go with items to buy.
All one query, and the pics of course have their own table corresponding to the item data through an index, like an item number.
I'd like to be convinced but have you hurt server resources by doing this?
Although, I agree, Oracle is slow.
|
InI
Paranoid (IV) Mad Scientist
From: Somewhere over the rainbow Insane since: Mar 2001
|
posted 11-09-2002 15:59
The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.
|
stinx
Bipolar (III) Inmate
From: London, UK Insane since: Apr 2002
|
posted 11-12-2002 16:19
So it's maybe not all that useful, but....
I was bitten enough to finally figure out the gif format and wrote the php code to create a gif from scratch.
It's looks ugly, needs some optimisation and could do with a few more changeable parameters, but I was trying to make it clear, and there are comments riddled throughout so you should be able to follow it.
If it might be of any use, email me and I'll send a copy - it's too long to post here anyway, and I have nowhere appropriate to upload it.
[This message has been edited by stinx (edited 11-12-2002).]
|