How to handle multiple atlas files - ios

I have a bunch of images in a folder name myImages.atlas. These images when put together will take up more than 2048x2048. Based on the Apple documentation I would have expected XCode to automatically break this up into multiple files.
After an image has reached its maximum size, a new image is created.
But when I try to compile it fails with the error:
sprikekit texture atlas generator error cannot fit input texture into a maximum supported dimensions of 2048 x 2048
Does anyone know if it's possible for XCode to handle this sceanrio and if yes what might I be doing wrong?

Related

Optimize size of DZI rendered

I am currently testing magickSlicer for converting large jpeg files to DZI. It works nice.
However, i am facing a problem with the size of rendered DZI. For exemple, for an orginal jpeg file weighting 10Mo, the rendred DZI folder weight 26.2Mo with default option (-w 256 -h 256).
If I change options width and height to 512x512 the DZI folder weight 18.3Mo. It is yet too big because I have to deal with a huge repository of large files.
I wish to know how can I manage options of conversion for getting a DZI folder weighting less or equals to the weight of original files.
Best regards.
You might be able to change the image quality (to make the JPEG files smaller) by playing with the --options command line argument:
https://github.com/VoidVolker/MagickSlicer#--p---options-imagemagick-options-string-
You'll have to look at the ImageMagick command line options to find the right value:
http://imagemagick.org/script/command-line-processing.php#option
That said, because DZI contains a pyramid of tiles, you are making more pixels than you started with. To be precise, you're ending up with 1.333 times as many pixels. All other things (like image quality settings) being equal, for your 10MB file you should end up with a 13MB set of tiles.

What is the correct procedure to create images/sprite for iPhone/iPad apps/games?

I am new in developing games with Xcode for iPhone/iPad. Thus I need some help with the correct procedure to create images/sprites for the game.
By now I have created my sprites with Illustrator and I exported them as PDF files. In Xcode I created this single scale asset and put the PDF in it.
If I understand the documentation correctly, Xcode automatically generates image files at #1x, #2x and #3x from the PDF. Does it generate PNG files?
Then I create a SKSpriteNode and set the size like this: abc.size = CGSize(width: 123, height: 123). Instead of 123, I fill in the width and height corresponding to the frame/image size I set up in Illustrator. Is this correct? I think so, because this is #1x version?!
But if I need the same image for iPhone and iPad in different sizes, i can't simply resize it, because the #1x image version isn't a vector anymore and bounded to the frame size I chose in Illustrator? What to do then? Do I have to resize my image in Illustrator and export it in a different size?
What is the correct procedure? Do I have to draw a sketch with pencil at the very beginning on a paper and the measure it with ruler? Then I would go to illustrator and set the frame width height at that what I measured manually?
So many questions. I am very confused with this images sizes, resolutions and #1x, #2x and #3x version. I am not sure why I should use vector files, if I still can't resize the images in the developing process as I would like to, because they are still bound to the frame size I chose in Illustrator.
Is there no possibility to set ratios between all my images and then just use the vector PDF file? How should I setup my Illustrator?
I hope somebody can bring some light into the dark. Thank you.
Your pdf should be sized in points #1x (not pixels). The points should be the same physical size on the phone and the ipad, but if you want them smaller on the phone you need a second set of images; the asset catalog lets you swap out images based on iphone/ipad. Xcode renders your pdf to png's #1x, #2x and #3x and your app will pick the correct png based on the resolution of the device. You are correct that these are no longer vector assets and that scaling them up could leave you with blurry/pixelated images. You have a couple of choices:
1) include a scaled up version of your image at its maximum scale in app and use this version only when you need to scale up (otherwise its a waste of memory and processing if you are always rendering a much smaller image). This is probably the easiest solution.
2) leave your assets as vectors and load them as vectors, You still can render them to images for performance at a constant scale or range of scales, but you can always re-render them at any scale if needed. Most likely you want to use an SVG library for this.
3) You can directly import your assets as code using a program such as paint code. There used to be similar plugins for illustrator but I haven't seen one for Swift 3/Illustrator CC. This is obviously faster than #2 since there is no need to decode the vector file. If your file has a lot of overdraw you may still want to rasterize to images for performance.
Here's what I've found from my experience:
1) Xcode does not generate #2x and #3x from .png files. It can't really - you need to manually supply #1x, #2x, and #3x sizes.
2) Whatever size you use for the CGSize(...), that should be your #1x image, then generate #2x, and #3x from that. I started by designing the size of a level in the scene editor, then made a generic SKSpriteNode shape just to get the size I wanted, then I started making the image from the size I found that looks good.
3) Xcode supports vector based graphics (svg, pdf), but you can't use them as part of a texture atlas, which makes them much less useful in my opinion.

images.xcassets size is too large

I am using xcode 6.0.1 and after setting all App Icons and Default Images my app size is jumped by 13 MB.
My App support iOS 5.1.1 and Later. Using Vector image don't support iOS 5.1.1 and iOS 6.x, I am not sure what i can do to reduce the build size.
Check list that might help you
->The first step is to look at your .app bundle and see what files inside it are taking up the most space.Before trying any optimizations, you should measure. This will tell you what to focus on improving.
->Use 8-bit Images Where Possible
Using an 8-bit PNG format where applicable can decrease your image size by a factor of 4 in comparison with 32-bit images. 8-bit images support a maximum of 256 different colors, so they should only be used images which use a small set of colors.
->Use High Compression for 32 bit Images Where Possible
Using Adobe Photoshop’s “Save For Web” feature can reduce the size of JPEG and PNG images considerably. By default, .png images will be compressed with pngcrush by Xcode automatically when the app is built.
->Check Your App, Usually apps contain extra files, like headers or a readme, that are never used.Be sure that you aren’t including any resources that aren’t used in your current project.
->Make sure dead code (code which is defined but never called) is stripped. Check that build setting DEAD_CODE_STRIPPING=YES.(Under your target build settings, then under "Linking" there is an option for "Dead Code Stripping". It defaults to yes for projects created with Xcode.
)
->What type of sounds files are you using? .caf files are incredibly large. As a general rule, you should compress audio using AAC or MP3, and experiment with a reduced bitrate. Quite often a 44.1khz sample is overkill and a lower-bitrate clip won't have a perceptible drop in quality.
->If you do not need to support iOS devices running all iOS versions.Specifying architecture/s to which the binary is TARGETED. This eliminates other architectures and reduces some size.
->Strip the binary of debugging and internal symbols (build settings STRIP_LINKED_PRODUCT=YES, STRIP_STYLE=all, DEPLOYMENT_POSTPROCESSING = YES).
->"Slender" tool will let you know the unused graphics in your app.
http://itunes.apple.com/us/app/slender/id493656257?mt=12
P.S. Before you make changes refer below source once.
Source:https://developer.apple.com/library/mac/documentation/DeveloperTools/Reference/XcodeBuildSettingRef/1-Build_Setting_Reference/build_setting_ref.html
and https://developer.apple.com/library/ios/qa/qa1795/_index.html#//apple_ref/doc/uid/DTS40014195-CH1-MEASURE
I observed that when we drag and drop images in Assets folder, the system creates copy of them if you specified the image set to be Device Specific. E.g: If you specified an image "A" for iPhone and same image for iPad (individually), the system will maintain two copies of "A" rather pointing to one same image. In this way the size keeps on increasing because of duplicate images. Check for that also.
images.xcassets size is depends on the image size.Try to reduce the image size if you want to reduce the app size.You can un Zip the ipa file and check which component have larger size.Try to use png images instead of jpeg if used.

Tilemap gets messed up when converted to hd

I have a floorplan that I need to turn into a tilemap. I'm using the program HD2x to convert my tilemap into an -hd tilemap. I tried it in different ways:
1)I converted the floorplan into a -hd .png with HD2x, and then put this into Tiled, and the saved it and converted the final .tmx file into -hd. I then put the -hd tmx and -hd png file into x-code.
2)I put the regular floorplan into tmx, and then converted this into -hd and converted the floorplan.png into -hd, then put these into x-code.
These aren't working.. either the tilemap is half the size it should be, or it's a QUARTER of the size it should be and the floorplan looks messed up.
Please help.
Original Comment
You might be using the program wrong. It doesn't make sense that a tool would take an SD image and make it HD. Most likely it is meant to take an HD image and cut its resolution in half for the SD version.
Answer
It seems like you are creating images that are half the size of the original, but you are expecting it to do the opposite. In general you wouldn't want to go from SD to HD by simply increasing the image's resolution because the quality would drop. Taking an image and simply doubling its size will not look good.
But quality aside it wouldn't make sense for someone to create an application that increases your resolution for you by simply doubling its size. If that specific application you are using has that as an option, you are likely not setting the right option. From the sounds of it the application is creating images half the size of the images you are feeding it. That is likely the reason why you are getting half or a quarter of the expected size.

What's the best way to use big textures (2048*1536) in Unity3d with NGUI on ios?

I'm using Unity3d (4.3.1) and NGUI for creating an 2d iOS (iPad) app. Also I need to use a lot of full screen images (about 100 images with size 2048x1536), for Gallery for example.
Now I'm using them with GUI type, override for iPhone with max size 2048 and compression quality: normal. And I'm using a UITexture with Unlit/Transparent shader to show them.
However, after about 40 images in the project XCode returns the terminated due to memory error. So the question is, what type of images do I need, and with which preferences to make them work?
I'm using iPad 3 as a test device with XCode 5.1.1. I'll be thankful for any help!
Also I need to use a lot of full screen images (about 100 images with size 2048x1536), for Gallery for example.
I think your 2048x2048 size images use a very huge memory area. Basically, 2048 image use 16MB memory. So, this case need to use about a 1600MB memory! Normal application don't over about 200 MB.
So, I think you need to be reduce using a memory:
Remember that this texture is going to be expand 2048x2048 by unity.( http://www.opengl.org/wiki/NPOT_Texture ) So, if you are going to reduce file size to 1500x1000, your application still use 2048x2048 image. But if you can reduce file size to 1024x1024, do it. 1024 image just use 4 MB memory.
If you can use texture compression. Use it. PVRTC 4 bit ( https://docs.unity3d.com/Documentation/Manual/ReducingFilesize.html ) compression is make file size 1/8 than true color. Also memory size is going to reduce.(maybe reduced to half)
If your application don't display all images, load image dynamically. Use thumb nail.
Good luck:D
If you want to make a gallery-like app to render photos maybe you can try a different approach:
create two large editable textures and fill texels with image data (it must be editable otherwise you will no have access to write directly image data into them).
if you still have memory issues or if you want to use lower memory you can use several smaller textures as tiles. You can render then image parts to each smaller texture. Remember to configurate correctly the texture borders or so not use border texels to avoid wrapping problems.
Best way is to use a smaller texture. In an ipad you will need a magnifying glass to really appreciate the difference between 1024x1024 and larger textures. Remember an ipad screen is smaller (7"~10") than a computer one and with filtering enabled is really hard to tell the difference.
If you still need manager such a large texture for some other reason (zooming or similar) I recommend you one of the following approaches:
split the texture into layers with alpha channel (transparency): usually backgrounds can be rendered with lower resolutions.
split also the texture into blocks: usually most textures have repeating patterns.
use compression.
Always avoid use such large textures if possible.

Resources