Deflate compression - zlib?
-
Hi all. I am trying to use deflate compression in a ruby plugin and not sure how to get it to work. From what I understand the best thing would be to use zlib. Along with that from what I understand zlib should be available as part of ruby development in sketchup. Also tryed 'requiring' zlib compiled version in plugin directory, but that doesn't work either.
Anyway know how I can accomplish this?
The ultimate thing I need to do is generate a PNG image file, being able to 'paint' each pixel. Already studied PNG documentation for what I need. That's simple enough. The compression seems to be the tough thing.
Thanks!
-
@dahovey said:
Along with that from what I understand zlib should be available as part of ruby development in sketchup. Also tryed 'requiring' zlib compiled version in plugin directory, but that doesn't work either.
Nope.. Google ships Sketchup with ONLY the interpreter DLL.
You'll need to have a full Ruby install on your machine. And then push the Lib folder paths into the $LOAD_PATH array after starting Sketchup. See my !load_paths.rb script http://forums.sketchucation.com/viewtopic.php?f=180&t=29412
The challenge is that your plugin would require all users to do the same. Daunting.. as some do not even know how to create a new folder.
-
I have a Java '.jar' based alternative that is 'cross-platform' as long as Java is installed on the PC/MAC and access rights to the containing folder.
It zips/unzips BUT needs supporting Ruby scripts to work...
It's the basis of my SKM-tools that extract/make SKM files [which are in fact ZIP files]
So PM me if you are interested... -
@dahovey said:
The ultimate thing I need to do is generate a PNG image file, being able to 'paint' each pixel. Already studied PNG documentation for what I need. That's simple enough. The compression seems to be the tough thing.
Ditto - I was looking at it to read PNG data - easy up til the compression bit...
-
@thomthom said:
@dahovey said:
The ultimate thing I need to do is generate a PNG image file, being able to 'paint' each pixel. Already studied PNG documentation for what I need. That's simple enough. The compression seems to be the tough thing.
Ditto - I was looking at it to read PNG data - easy up til the compression bit...
A cross-platform Java .jar can read and write PNG file [or most other image formatf] pixel by pixel - that's how my ImageTrimmer and related tools work... My 'thumbnail' tools take the larger image and the JAR saves a PNG with the reduced size... ImageTrimmer reads the image's PNG pixels and if they are transparent it makes them white if they abut an 'edge' they become black, any other pixels become white - the bufferedimage is written to a new PNG; for the purposes of this tool a DAT file is also written containing 0/1 for white/black pixels this is read directly into SUp to make edges that are them 'simplified'...
It's easy to see a converse operation where the RB writes a DAT file of pixel values and the JAR reads that and makes a PNG using those... I know it's clunky but until Ruby gets some decent image manipulation tools built in it works...
If you'd like ideas on this please PM me...
Advertisement