Images to/from strings

I know sprite pack support is coming at some point in the future, but I wanted to suggest to also add a possibility to load images from strings, and maybe also save them to strings. The reason for this is that even with custom sprite pack support, we probably still won’t have project sharing and this would make it easier for people to copy&paste entire projects around. Also it would make it easier to get images into projects even when you don’t have iExplorer around.

If the sprite pack picker is allowed to import picture from the Photo app, it would be easier. One take a picture from the net, save it to Photo app, then import it to Codea through the sprite pack picker.

that would be ok to get images into codea for me alone, but how would that help with sharing?

Once you got the image into Codea, you could encode it as string. Then you could save/load it as encoded string through Codea storage APIs. Just like what Spritely done.

Yes, that was my idea. But an encoding should be compact. I have created one that does RLE and is a lot more compact than what spritely spits out, but base64 encoded png would be even more compact. Keep in mind that we’re working on a somewhat resource limited platform here. I think having both, getting images from the Photo app and also being able to en- and decode images from and to strings would be a reasonable way to go.

I implemented/ported base64 decoding PNG partly, but the strings are still long and tough to handle in Codea.

I have make a program in JAVA for translate a image to code for lua.

Yeah - we’ve gone this route before. Even encoded, images as source code data in
strings are nutty big. It’s fun as a stunt, but not really very usable except perhaps for very small icons.

It’s been suggested it would be nice to have PNG and GIF decoding (as well as zlib) as built-in libraries; but frankly, without sockets or files and a way to transfer them, you’d still be stuck with giant strings.

I’m hoping that Spritepacks, when implemented, deal with both the issue of using graphics, and the issues of sharing them. Apple has made it pretty clear they’re uncomfortable with sharing code - perhaps sharing spritepacks (or, ideally, being able to download them on-the-fly) won’t tweak them so badly.