Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

compression

 [1/16] from: hallvard:ystad:helpinhand at: 12-Sep-2001 20:40


Gregg Irwin skrev (17.44 12.09.2001):
>Hi Hallvard, >I'm not clear on what you need. Do you want something to compress the GIF
<<quoted lines omitted: 3>>
>have anything on hand. Ole Friis has a Huffman example on REBOL forces, >and I just did a very quick RLE, but I don't know of LZW in REBOL.
You're right. What I was looking for was a function to do the LZW compression of the raster data in a GIF image. Huffman is good for JPEGs, and I might just have a look at it. Thanks for the tip. I believe there are some restrictions for use of the LZW algorithm, and I think that's why the PNG format was developed. So it might just be that making an LZW compression function simply isn't legal without purchasing some sort of a licence... I don't know. If I should decide to convert my old java classes into some stammering rebol code, I'll check it out before posting anything to the rebol community. Or does anyone know (for sure) something contrary? ~H

 [2/16] from: hallvard:ystad:helpinhand at: 12-Sep-2001 20:35


Maarten Koopmans skrev (17.20 12.09.2001):
>You can create PNGs in View.
But I need to do it _without_ View!
>Let's say that f is a face defined in VID or View
Let's instead say I have something as simple as a String of 0s and 1s that form a picture, like this: 11111111111111111111 11100000000001111111 11100000000001111111 11100111111001111111 11100111111001111111 11100000000111111111 11100000000111111111 11100111111001111111 11100111111001111111 11100111111001111111 11100111111001111111 11111111111111111111 I'd now like to turn it into an image that may be viewed with a browser, preferably GIF og JPEG, but if PNG is as simple as you say... I accept immediately. Any ideas? ~H

 [3/16] from: greggirwin:starband at: 12-Sep-2001 13:50


Hi Hallvard, << I believe there are some restrictions for use of the LZW algorithm, and I think that's why the PNG format was developed. So it might just be that making an LZW compression function simply isn't legal without purchasing some sort of a licence... I don't know. If I should decide to convert my old java classes into some stammering rebol code, I'll check it out before posting anything to the rebol community. Or does anyone know (for sure) something contrary? >> I don't know if Unisys is still pursuing things actively or not. If you don't need GIF compatibility, I'd just go with PNG. If you just published an implementation of LZW in REBOL "for academic purposes", you shouldn't get in any trouble. The catch would come when you use it in an application. That said, there are a number of commercial GIF tools out there (Alchemy Mindworks has a couple I use), so maybe those guys could give you some advice if necessary. --Gregg

 [4/16] from: greggirwin:starband at: 12-Sep-2001 14:07


Hi Hallvard, << Let's instead say I have something as simple as a String of 0s and 1s that form a picture...<snip>...I'd now like to turn it into an image that may be viewed with a browser >> I haven't worked with PNG format files but it should be very possible to generate the header and format the data into a PNG file directly. Check out www.libpng.org/pub/png for PNG info. Another way might be to create an image! and then poke your data into it. Not sure if that will work though. I'd be interested in how to do the equivalent of a bitblt in REBOL, or to know what is the most efficient way to manipulate images. --Gregg

 [5/16] from: greggirwin:starband at: 12-Sep-2001 16:00


<< I'd be interested in how to do the equivalent of a bitblt in REBOL, or to know what is the most efficient way to manipulate images. >> Hmmm, maybe I just found it. It looks like you can use an image in the draw dialect. Dang, every time I think I've found something that should be hard to do, there's an easy solution.<g> --Gregg

 [6/16] from: doublec:acc at: 13-Sep-2001 9:51


>I don't know if Unisys is still pursuing things actively or not. If you >don't need GIF compatibility, I'd just go with PNG. If you just published an >implementation of LZW in REBOL "for academic purposes", you shouldn't get in >any trouble.
All you need to know about Unisys and LZW are available from Unisys' site: http://www.unisys.com/unisys/lzw/ Yes they still actively pursue the issue. Chris. -- http://www.double.co.nz/dylan

 [7/16] from: ryanc:iesco-dms at: 12-Sep-2001 17:01


Just out the curiousity I had to read the patend. I wonder if it still would apply if you did the process backwards? Strangely, as I read though it, I was somehow reminded of a night I filled a super soaker with tequila. --Ryan High speed data compression and decompression apparatus and method Abstract A data compressor compresses an input stream of data character signals by storing in a string table strings of data character signals encountered in the input stream. The compressor searches the input stream to determine the longest match to a stored string. Each stored string comprises a prefix string and an extension character where the extension character is the last character in the string and the prefix string comprises all but the extension character. Each string has a code signal associated therewith and a string is stored in the string table by, at least implicitly, storing the code signal for the string, the code signal for the string prefix and the extension character. When the longest match between the input data character stream and the stored strings is determined, the code signal for the longest match is transmitted as the compressed code signal for the encountered string of characters and an extension string is stored in the string table. The prefix of the extended string is the longest match and the extension character of the extended string is the next input data character signal following the longest match. Searching through the string table and entering extended strings therein is effected by a limited search hashing procedure. Decompression is effected by a decompressor that receives the compressed code signals and generates a string table similar to that constructed by the compressor to effect lookup of received code signals so as to recover the data character signals comprising a stored string. The decompressor string table is updated by storing a string having a prefix in accordance with a prior received code signal and an extension character in accordance with the first character of the currently recovered string. Gregg Irwin wrote:
> << I'd be interested in how to do the equivalent of a bitblt in REBOL, or to > know what is the most efficient way to manipulate images. >>
<<quoted lines omitted: 6>>
> [rebol-request--rebol--com] with "unsubscribe" in the > subject, without the quotes.
-- Ryan Cole Programmer Analyst www.iesco-dms.com 707-468-5400

 [8/16] from: hallvard:ystad:helpinhand at: 12-Sep-2001 15:18


I'm creating a GIF. Rebol has a built-in native compress function. What kind of compression is it? Has anyone written a LZW compressor / decompressor? I've been looking through the online script archive, but didn't find anything. I've written one previously, in java, but I'd very much like not to have to do it again--- ~H

 [9/16] from: m:koopmans2:chello:nl at: 12-Sep-2001 17:20


You can create PNGs in View. Let's say that f is a face defined in VID or View a: make binary! 1000 save/png a to-image f a now contains the png image. You can print it, save it to file,... HTH, Maarten

 [10/16] from: greggirwin:starband at: 12-Sep-2001 9:44


Hi Hallvard, << I'm creating a GIF. Rebol has a built-in native compress function. What kind of compression is it? Has anyone written a LZW compressor / decompressor? I've been looking through the online script archive, but didn't find anything. I've written one previously, in java, but I'd very much like not to have to do it again--- >> I'm not clear on what you need. Do you want something to compress the GIF file once it's created, or do you need something that will compress a buffer that goes into the GIF file? I'm guessing the latter because, otherwise, you could just use REBOL's compression. In that case I don't have anything on hand. Ole Friis has a Huffman example on REBOL forces, and I just did a very quick RLE, but I don't know of LZW in REBOL. --Gregg

 [11/16] from: carl:cybercraft at: 13-Sep-2001 12:49


A quick suggestion off the top of my head. Work out the format of REBOL bmp files and build a binary image to that format, convert it using to-image and then save it as a png file. -- Carl Read

 [12/16] from: hallvard:ystad:helpinhand at: 13-Sep-2001 8:47


Carl Read skrev (02.49 13.09.2001):
>A quick suggestion off the top of my head. Work out the format of >REBOL bmp files and build a binary image to that format, convert it >using to-image and then save it as a png file.
Good idea. I know there are different BMPs, e.g. I've heard about a "windows BMP format". Are you suggesting there is also a "rebol BMP format"? Or which in fact is the BMP format used by rebol? (I guess I could save/bmp an image! and look at the byte code, but asking here is probably more efficient). ~H

 [13/16] from: greggirwin:starband at: 13-Sep-2001 16:40


Hi Hallvard, << I know there are different BMPs, e.g. I've heard about a "windows BMP format". Are you suggesting there is also a "rebol BMP format"? Or which in fact is the BMP format used by rebol? (I guess I could save/bmp an image! and look at the byte code, but asking here is probably more efficient). >> REBOL reads Windows BMP files and I'm guessing it saves them as well, though I haven't tested it. I once wrote a resource compiler for Windows, and the BMP format isn't too scary or anything, but I don't know if that would be any easier. --Gregg

 [14/16] from: carl:cybercraft at: 14-Sep-2001 21:28


On 13-Sep-01, Hallvard Ystad wrote:
> Carl Read skrev (02.49 13.09.2001): >> A quick suggestion off the top of my head. Work out the format of
<<quoted lines omitted: 3>>
> "windows BMP format". Are you suggesting there is also a "rebol BMP > format"?
Well, not quite, just the format of REBOL bitmaps. (: I've not looked at bmp formats, but I assume they might allow for alpha channels and other stuff. If so, does this have any bearing on what REBOL expects of a bmp? Except I've found a problem with my suggestion above - there's no save/png in Core. (At least not in the free version.) Which I think means you're back to working out a gif, (or png? it's an open format, so info should be widely available), routine of your own. Not such a good idea afterall... I take it bmp files would be too big for what you're doing with them? -- Carl Read

 [15/16] from: hallvard:ystad:helpinhand at: 14-Sep-2001 12:04


Carl Read skrev (11.28 14.09.2001):
>Except I've found a problem with my suggestion above - there's no >save/png in Core. (At least not in the free version.) Which I think >means you're back to working out a gif, (or png? it's an open format, >so info should be widely available), routine of your own. Not such a >good idea afterall...
I'm afraid I've made a mistake here. I said I needed to do this without /View, but that's not true. I need to do it without doing any other GUI stuff, since transforming my 0s and 1s is supposed to happen on a server, which will send an image back to a web browser. Since Unisys still is pursuing the LZW licence thing, I guess saving a PNG is the best alternative. So creating some sort of BMP from the 0s and 1s, sending them to rebol and retrieving them as a PNG (using /View if it takes, but without doing any GUI stuff), seems to be a good solution. I'll look into it next week. Thanks, everybody who shared their opinions and tips! ~H

 [16/16] from: hallvard:ystad:helpinhand at: 26-Sep-2001 21:24


Gregg Irwin skrev (Wednesday 12.09.2001, kl. 21.50):
>If you just published an >implementation of LZW in REBOL "for academic purposes", you shouldn't get >in >any trouble.
Well, then, here you are (this is published for academic purposes only, do you hear!): http://folk.uio.no/hallvary/rebol/converter.r This is one of the very first things I ever made in rebol, and so I feel the code is rather "lumpy", if that makes any sense. Anyone who feels like looking at the code and proposing changes, be my guest! The script takes an OTA bitmap (i.e. the image format used by cellular phones, at least by Nokia phones, for so-called "operator logos") and turns it into a GIF. ~H

Notes
  • Quoted lines have been omitted from some messages.
    View the message alone to see the lines that have been omitted