I want to know how to save images from spritely to camera roll
You cant do that. Spritely generates a listing you can copy to paste in a codea program to regenerate the image you have drawn, pixel by pixel.
ive been trying to do this for several hours yesterday i have found a way. I didnt need the images in camera roll i just want it to be saved in the documents so I could use the images without copying and pasting the code for each project here is the program that does it.
-- Spritely Saver --to save an image paste the image code from spritely chose a save location in line 16 -- Use this function to perform your initial setup function setup() print("Spritely Saver v1.0") saveimage = Image() end -- This function gets called once every frame function draw() -- This sets a dark background color background(40, 40, 50) -- This sets the line thickness strokeWidth(5) saveImage('Documents:spritely',saveimage) -- Do your drawing here end function SaveImage:Image() --copy and paste image code from spritely to here.
sorry thats one of the versions that didnt work heres the version that worked:
-- Spritely Saver -- Use this function to perform your initial setup function setup() print("Spritely Saver v1.1") saveimage = Image() end -- This function gets called once every frame function draw() -- This sets a dark background color background(40, 40, 50) -- This sets the line thickness strokeWidth(5) --chose a location and name to save saveImage('Documents:spritely',saveimage) -- Do your drawing here end function Image() --paste image code here from spritely
You know, I really should do a re-write of this app for 1.5.
Not only are there many more options now for saving images, the original is a horror on touch handling.
it seems to work pretty good to me. I am new to programming and am still confused about a few things i wasnt sure how to get the images from spritely to my project
.@Mark - if you were going to update it, here are some suggestions:
- save spritely images to dropbox or global data as png’s.
- be able to create and edit larger images. Even 64x64 points would be handy.
The problem at the moment is the large Codea files required to represent the images. On a 1st Gen iPad these cause frequent crashes.
@reefwing Yes, being able to post to documents and Dropbox would be the biggest target. That plus some of the things I went through great hoops to do at the time could now be done much more cleanly.
The biggest issue with 64x64 with the current code is simply performance, but a simple fix should make it possible.
@tpt98 Actually all you have to do is add this one line of code
to the LoadScreen:loadImages function in the Loadscreen tab of Spritely.
So the end result would be
function LoadScreen:loadImages() -- read existing images based on keys local keys, k, s, i, img self.count = 0 keys = readGlobalData("SpritelyKeys") if keys ~= nil then -- keys are a comma-delimited list for k in string.gmatch(keys,"([^,]+)") do self.count = self.count + 1 s = readGlobalData(k) if string.len(s) < 12 then img = image(16, 16) else createImage = loadstring(readGlobalData(k)) img = createImage() saveImage("Documents:"..k,img) end self.icons[self.count] = SImage(k, img) end end end
And you’ll find all of your images you’ve created loaded into your Documents sprite pack folder with the same names you gave them in Spritely.
I you don’t want to have to do this on a repeat basis?
I recommend you make a copy of Spritely and insert that line of code into the copy of Spritely so it will be there on a more permanent basis.
Otherwise the program will reload from time to time and wipe any changes you make to it.
But to be clear this works as is. To check your documents spritepack in any program you’re coding just use
--[[ readImage() --]]
and tap inside the () to pull up your sprite pack. You can then scroll through and delete what you don’t want.
One more thing for those having trouble getting their images to show up in projects that have 3D?
CODING ORDER MATTERS.
In other words if you have image related variables to declare? Do so in the setup BEFORE you declare your 3D matrix. And in order to get your image to show up? Code it in after BOTH
otherwise they won’t show up