I have a bunch of CCB files that consist of CCSprite and 4-5 layers - no animations.
I need a way to convert these CCBs to flat PNG images.
Creating Smart Sprite Sheets is not good, as it saves each layer as different sprite on the sheet and I need those merged. How would I do this?
I'm not sure why you would want to do this....but if you really want a png file of a ccb file, why don't you take a screenshot of your file's layout in spritebuilder/cocosbuilder and save it as a png?
I have to agree with everyone that this sounds like a strange request. But, if you really need to save the result of loading CCB into PNG image you can try to use CCRenderTexture.
Related
ok so i want to save images in sdl.
i only know how to save stuff in .txt files.
theoreticlly i could take all the bits of the surface and save them in the .txt file and later load all those bits into a surface manually.
but i don't want to do that because a surface in sdl has to go threw some certain processes witch i don't really know what they do.
like every surface has to go through the SDL_DisplayFormat(SDL_Surface *) function.
and if i load functions threw .txt i won't be able to do that.
and there is probablly a simple function to do this so i want to take the easy way.
so where can i get a function that saves a surface to a png file(preferred SDL function)
Use that one to save the Screen as Bitmap.
SDL_SaveBMP(main_global_stuff.sdl.surface, screenshot_filename);
I just looked quickly; with SDL_Image you're able to load png-files. Take a look here for more solutions and librarys.
SDL_Image
I have just started using sprite sheets in Cocos2D in an attempted to better utilize the texture memory and the artist generating my assets has a script that he used for some previous games in Unity3D. The tool takes a number of images, removes the transparent and white space and stuffs them into atlases. It returns the "position" and "uvs" for each sprite in a text file. One thing the tool does that we can't seem to disable is that it transposes some of the sprites to fit them better.
I want to load the animations from a plist file in Cocos2D. Is there any way to transpose them back to normal while loading the frames into the Texture cache? If not how would I transpose the individual frames after I've loaded them into a CCAnimation?
If none of this works I'll just cut and paste all of the transposed sprites into more atlases and deal with using a little extra texture memory.
I can only recommend to use one of the texture tools available for cocos2d. There's Zwoptex, and I personally would recommend TexturePacker. You'll get a lot more options out of it and don't have to worry about any of these issues.
You can use Sprite Master. You can export your spritesheet in png,tiff format and also it supports Cocos2D spritesheet .plist format. You can export to Corona, LibGDX, Sparrow game engines and additionally it exports CSS for web developers.
With this solution, It doesn't matter what game engine you are using.
I'll first tell you the problem and then I'll tell you my solution.
Problem: I have a blank white PNG image approximately 900x900 pixels. I want to copy circles 30x30 pixels in size, which are essentially circles with a different colour. There are 8 different circles, and placed on the image depending on data values which I've created elsewhere.
Solution: I've used ImageMagicK, it's suppose to be good for general purpose image editing etc. I created a blank image
Image.outimage("900x900","white");
I upload all other small 30x30 pixel images with 'read' function.
I upload the data and extract vales.
I place the small 'circle' images on the blank one using the composite command.
outimage.composite("some file.png",pixelx,pixely,InCompositeOp);
This all works fine and the images come up the way I want them too.
However its painfully SLOW. It takes 20 seconds to do one image, and I have 1000 of them. Surely there must be a better way to do this. I've seen other researchers simulate images way more complex and way faster. It's quite possible I took the wrong approach. Maybe I sould be 'drawing' circles instead of 'pasting' them or something. I'm quite baffled. Any input is appreciated.
I suspect that you just need some library that is capable of drawing circles on bitmap and saving that bitmap as png.
For example my Graphin library: http://code.google.com/p/graphin/
Or some such. With Graphin you can also draw one PNG on surface of another as in your case.
You did not give any information about the platform you are using (only "C++"), so if you are looking for a platform independent solution, the CImg library might be worth a try.
http://cimg.sourceforge.net/
By the way, did you try drawing the circles using the ImageMagick C++ API Magick++ instead of "composing" them? I cannot believe that it is that slow.
I'd like to alter images programmatically. Specifically for the iPhone, but, general answers could help. For example, how could I, programmatically, add filters effects, such as those available in Photoshop.
Clearly it is possible as exemplified by apps such as Fat Booth. What is the starting point for this? Load an image as NSData and learn how PNGs are encoded and go to work with the algorithm? Possible? Easier solutions?
Thanks for the help!
Chapter 21 of iPhone SDK Development has an example of how to display and manipulate a photo that is pretty easy to follow. More complex effects require more complex code, but it's something to start with.
First obtain image in raw format (raw like in raw bytes for every pixel [rgb][rgb]) then manipulate the pixels and convert back from raw format to image.
Here you can find information how to convert uiimage to and from raw pixels data, for example:
Raw to UIImage: Creating UIImage from raw RGBA data
UIimage to Raw: Can I edit the pixels of the UIImage's property CGImage
If you need geometric transformations you can use mapping of coordinates or opengl and use your image as a texture on some mesh, manipulate the mesh (geometrically) and render the scene back to an image.
You don't need to know how the images are encoded into PNGs or JPGs it can be done for you by the system. You just need to know what you want to achieve and then build your own algorithm.
Have fun!
I am using artoolkit to create an augmented reality based project.I can load vrml 3d objects in the video feed using openvrml.
Now I wanted to load a bitmap or any other image file like jpg,png etc file on the marker in the video feed.How do I go about achieving this?
The usual approach is using an overlay.
Just make a VRML 'model' consisting of a single quad with a texture corresponding to your image file. Your existing VRML machinery should take care of the rest.