Embedding images into a script

Find out why the . goes before the /

Moderator: Paul Tuersley

Post Reply
User avatar
jaist
Posts: 15
Joined: October 3rd, 2008, 9:57 am
Location: Milan, Italy
Contact:

Hi all!
I'd like to embed images in my .jsxbin, but i'm at loss when i think about extracting bytes from my file in javascript.
I saw nab's implementation with hexes, creating temp images and reading from there, but while effective it's quite ankward.
Do any of you know a simpler approach? I'd like to deploy only one file instead of three. Thanks!
Max
Max Pareschi Director | VFX supervisor | CG Artist & Designer | Bonsaininja Studio
nab
Posts: 203
Joined: November 29th, 2005, 3:00 am
Location: Royan
Contact:

Not sure it is simpler, but here is another road I've explored.

Assuming we are dealing with little iconic image, typically of size less 50x50 px, you can sample every image pixel and create for each pixel a 1px group (with backgroundColor set to the current pixel color).

In this demo, the icon image is the first selected layer, and layer sampling is done using sampleImage() expression.

LayerToUIImage.jsx.zip


Image
Post Reply