View Full Version : Saving Bitmaps in Flash
Kirk Christopher
10-13-2006, 01:36 PM
I have a client who is requesting a flash project where the user can create a custom layout with pictures and text. Then they need to be able to save what they created to their hard drive. It needs to be distibuted on CD, so no server code can be useed. Here's the hard part: the graphics have to be print quality (at least 300 dpi.) I have been reseaching this for days and have not come up with a viable solution for this.
I am thinking that I would have to have the user build the layout on the stage and have a much larger version being build off stage, but I don't know how I would take that information and get it to bitmap format and onto the Hard Drive.
I am looking for any suggestions. I know I am going to need to use something beyond flash, since flash can not save directly to a hard drive. Should I even be trying this in flash or is there a better way? Anyone?
I am using flash MX 2004 on a PC.
flashpipe
10-13-2006, 01:46 PM
You may want to look into using SWFStudio or Zinc. Since it's going to be on a CD. Either of these would work for handling bitmaps (since flash won't do that natively) and I'm currently working on a project that uses SWFStudio (which I love due to the support & stability) and ImageMagick to work with bitmaps, saving files, etc.
Not sure if this would be a solution that would handle 300 dpi images, but you could ask over on northcode.com and they would be able to let you know. Also not sure how it would deal with sizing/scaling the images so the user could create them and then "building" a larger image to be saved to the hard drive...
At least this might get you started!
Hope that helps!!
jsebrech
10-13-2006, 01:46 PM
Zinc or the other projector alternatives will get the files onto disk. To actually draw it you can either draw the large version off-screen, or you can draw on a scaled (zoomed out) movieclip and save it to disk unscaled. Mind you, this is in flash 8, where you have the bitmap API's.
Kirk Christopher
10-13-2006, 02:52 PM
OK I am going to upgrade to flash 8. Since I am new to this can you tell me more about how to use this new bitmap api. Also how do I use either Zinc or SWFstudio in conjuction with bitmap api to get the file to the hard drive unscaled.
I have been testing this with Zinc and as far as I can tell saving graphics with Zinc is done through screen capture at screen resolution.
This would help me out greatly.
jsebrech
10-13-2006, 03:56 PM
The bitmap API's allow you to read the individual pixels of a movieclip using getPixel. If you google around you'll find more than enough documentation. Once you know the pixel values you can use the zinc api's (or windows api's in the worst-case scenario) to output an image file to disk containing those pixel values.
Kirk Christopher
10-13-2006, 04:06 PM
I have been searching for the documentation and am coming up to speed. So if I create a rather large movie clip and scale it down to stage size, I will use the bitmap class to get all of the pixels (which will be the full set of pixels of my large movieclip.)
Then I will use zinc (I downloaded a trial yesterday and have been testing it) to output the pixels to a bitmap file.
Can you point me to the right classes to use in zinc to grab the pixel data from the swf and to save the pixel data as an image?
jsebrech
10-14-2006, 11:44 PM
As I understand with zinc you won't have an swf, but an exe, so you don't need to interface with any swf. To write the bitmap to file the way I see it if zinc does not provide any native functionality to do that you'll have to brush up on the windows API, and use it to create a bitmap in memory and then write that to file, all using windows API functions.
Kirk Christopher
10-15-2006, 04:35 PM
I am new to using a shell to create an executable, but I would think you would still need some code within the flash to take the pixel imformation that is gathered with the bitmap api and tranlate it to the final bitmap file that I need to save. I just don't know enough about how flash gathers this data to know how to get it to the file.
Can anyone help me with the lines of code I need to make this work.
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.