Archive for November, 2006
The other day there was a thread on a mailing list related to getting large amounts of text in to a Shockwave movie and keeping the bandwidth small. Since you can’t use the UnZip Xtra in Shockwave someone mentioned the idea of having data that represents text placed inside an image, and then convert the image to the text in the dcr.
For some reason I suddenly thought of when I was a kid trying to write top secret notes that only my buddy would be able to read if he knew “the code,” so I figured I’d play with this for a few minutes after eating a bit too much turkey the other day.
In terms of a basic image, each pixel of the image consists of red, green, and blue (when working in the RGB color model). Since each pixel has three colors (and each color ranges from 0 to 255) I decided to use a very simple method where each pixel will represent three letters of the text. Using a 100 x 100 pixel image I can get 30,000 characters of text. A typical png of that size is around 6k, so the png is very small compared to the amount of data you can extract.
When converting from text to image I embed the total number of characters in the first pixel (see code for method used), and then use the remaining pixels to store the characters (three characters/pixel). Each character is turned in to a number using the charToNum
function, and that set of three characters is then turned in to the pixel using setPixel
.
When going from image to text I basically do the opposite. I read the first pixel (using getPixel
) to see how many characters I have to deal with, and then start reading all the rest of the pixels and using numToChar
to translate the red, green, and blue colors in to characters. The reason I put the total number of characters in that first pixel was so that I wouldn’t have to read all 10,000 pixels every time (only as many as needed to save time).
This was a very simple way to do this and you could add a lot of features that would enable more interesting encryption methods, as well as other ways to encode the data that would lead to far more compression.
Click to view example (pop up window)
Director Source Code (zip file)
Note: I have not added any error checking to the source code, so many thing could cause an error (as well as the shockwave sample).
November 27th, 2006
While at MAX 2006 in Vegas I got to meet up with Chris Griffith. We chatted about Director and managed to visit a few parties in the evening. Chris left a bit early, but Jason and I spent awhile at the MySpace.com party that was took place Tuesday evening. Pretty nice event, although I’m not sure if I remember all of it. When they say ‘open bar’ and Grey Goose is flowing…always trouble.
Chris wrote up a nice summary of the event over on Director Online. On Wednesday evening Adobe threw a party at the Palms (sight of the new Playboy Club). I figured I might as well get a picture of me with the Club in the background…since what happens in Vegas stays in Vegas…at least that is what I hear.
November 26th, 2006
I rarely need to deal with video feeds in Director but with my new iMac I have one of those little built-in iSight cameras. While out web browsing the other day I noticed a discussion about being able to put a live video of yourself within a web page that only you can see (the video feed is from your own camera).
This is done via a Quicktime movie that uses live input from your iSight camera on a Quartz Composer compositions track (a new track type for QuickTime). There is an article on O’Reilly that shows you exactly how to create one of these QuickTime movies. The movie that you create will automatically turn on your iSight camera and place that video stream within the movie.
I created one of those movies (I used the full 640×480 for export size – the current resolution of the camera), dragged it in to my Director cast, and put the member on the stage. I hit play and there I was waving to the camera within Director. Live video inside Director via a QuickTime movie with no Xtras (ok..you do need the QuickTime Xtra, but that come with Director)!
Quartz Composer also allows for various filter effects to be used on the QuickTime movie (see last link in O’Reilly article).
Very slick! I’m sure this could be really useful for kiosks and science museum displays, and just lounging around the house 🙂
Download the Quartz Composer file (zip).
Download the sample QuickTime movie (zip).
Update (Aug 23, 2010): I have not been able to use this under OSX 10.6, so not sure if it is still possible.
November 20th, 2006
As a developer you’ll end up needing an older version of a plugin every now and then just so you can be sure something will work for those of us that don’t live on the cutting edge (despite common sense I often install lots of things that have beta in the title…like Soundbooth, Lightroom, etc.).
Adobe has several versions of both the Shockwave and Flash plugins available on their site:
Shockwave Plugin (back to version 7).
Flash Plugin (back to version 2).
November 16th, 2006
Apple has a “Pro” section on their site where they give tips and techniques for using software, as well as profiles of people that have used Macs to create art, science, and literature. The most current profile features Brian Eno.
Macromedia Director was listed as one of the key items in the toolbox of software used for the project, along with Photoshop, Illustrator, and Logic Pro.
I’m sure I could create 77 million images, but I don’t think any of them would get classified as art. I’ll stick with the science side of things.
November 13th, 2006