Texture Packer and Automator

Texture Packer has a command line tool, which means that you can run it as a shell script in Automator. This means that you can get sprites from the Automator and automatically build spritesheets using them.

Why would I want to do this? Why can’t i just use Texture Packer with all its lovely GUI?

Because well for me, I process the sprites first using Automator, before I pack them into spritesheets. Also this is a quick way to not set all the different Texture Packer settings each time (yes, I know you can use Save Defaults for settings).

But double-clicking on my Automator app, and then select my sprites, and wait for it (it’s actually pretty quick) to automagically spit out spritesheets is still faster (and it only requires like 2 to 3 clicks), and it even supports multipack (in case the sprites doesn’t fit in just one spritesheet)

This is my (partial) Automator workflow:

Screen Shot 2014-05-08 at 11.31.15 AM
Screen Shot 2014-05-08 at 11.31.45 AM

A big shout out and thank you to Andreas Lowe for replying to all questions on Twitter, and helping me whip out that Shell Script.

This Automator app requires the Pro version of Texture Packer as well.

That’s it!

 

Sorry for not posting anything since creating this new blog in January, that’s because I temporarily moved back home (hello, Manila).

Advertisements

MacHeist : Play games win free Mac software

From the website:

So, what exactly is MacHeist? It begins with the missions…. MacHeist’s missions are an opportunity for our members to live out some of their time travel fantasies, including family secrets, hidden rooms, and a storyline packed with Steampunk intrigue, while earning free Mac software.

They are pretty serious about giving away free software.

There has so far been 4 NanoMissions and 3 Missions, and I’m done with 5 of them, and gotten some pretty cool loot. And they’re not crap software, some of them are actually pretty useful, like NetShade (it makes your presence on the web anonymous by routing your connection through a proxy server). And they give away games too, like Fractal (made by the guys behind Auditorium) and Hector : Badge of Carnage.

It’s only for a limited time, so hop over to their site, register as an Agent, download the Missions, solve the puzzles and win free stuff.

I love puzzles and I love free stuff.

MacHeist : Play games win free Mac software

Mini Tutorial: How to batch convert image files to PVR (for iPhone app development)?

According to Unity3D’S manual, when developing for iOS

Use iOS native PVRT compression formats. They will not only decrease the size of your textures (resulting in faster load times and smaller memory footprint), but also can dramatically increase your rendering performance! Compressed texture requires only a fraction of memory bandwidth compared to full blown 32bit RGBA textures.

You can use Unity’s built in PVRTC compression, but according to @ToxicBlob

Not all PVRTC are created equal

http://www.toxicblob.com/files/Not_all_PVRTC_are_created_equal.php

Well, the Unity manual also suggested using PVRTexTool to create your PVRs. They have a GUI tool and a command line tool. (Please read ToxicBlob’s blog on how to install the tool).

Since, my artists gives me a lot of texture files, there’s no way that I’d do the conversion one by one using the GUI tool, so Mac’s Automator to the rescue! I love Mac’s Automator, it’s now my new best friend.

So I made an Automator Workflow:

The shell script:

for f
do
/Applications/PVRTexTool/PVRTexToolCL/MacOS_x86/PVRTexTool -fPVRTC4 -pvrtchighquality -yflip 1 -square -i”$f” -o”$f”
done

EDIT: I edited the previous script, adding “-o$”f”” so that the output file will be in the same folder as your input file.

Just add all your textures in the Get Specified Finder Items part and click Run!

And that’s it!

How to batch create SD images from HD in 1,2,3 steps :)

With iPhone 4 and all, now we need two sets of art assets, one for SD and one for HD (for retina display). So my artist gives me the assets in HD, and I:

  1. Make a copy of the assets.
  2. Use A Better Finder Rename 8 to rename the copied assets’ file names (append the suffix @2x or -hd).
  3. Select all the original assets, right click, and open it in Preview. Once in Preview make sure all the assets are selected and then click Tools > Adjust Size (oh, the sizes of the assets should be uniform), and then you change then width and height to SD. And then Save All. (Source: http://www.usingmac.com/2008/6/10/batch-resize-images)
  4. And then, what step 4? We are done 🙂

EDIT:

Or, if you happen to be using Cocos2D, you can use TexturePacker, to create a SD spritesheet from a HD spritesheet, with only 1 click!

Open your TexturePacker file with HD images (texture and data file name should end with @2x or -hd), and then click on AutoSD,

and when you publish, you will automatically have an SD version.

There we go, only one step 🙂

How to optimize your PNG images?

There are a lot of free and online softwares for optimizing PNG images, here is a short list of them:

  • PunyPNG (talked about in this blog post) :

photo: Heckyeah my PunyPNG now allows the max of 500 KB and uploads up to 75 files :) The default is 150 KB and 15 files, but if you donate you get the increase. PunyPNG, for me is one of the most efficient PNG compressors out there, first of all it’s online, so you can access it anywhere, and second, it’s really is pretty good at compressing compared to other compressors out there. See comparison chart on their website: http://punypng.com/about/comparison PunyPNG website: http://punypng.com/

The default is 150 KB and 15 files, but if you donate you get the increase of 500 KB and uploads up to 75 files 🙂

PunyPNG, for me is one of the most efficient PNG compressors out there, first of all it’s online, so you can access it anywhere, and second, it’s really is pretty good at compressing compared to other compressors out there.

See comparison chart on their website: http://punypng.com/about/comparison

PunyPNG website: http://punypng.com/

  • Smush.it™

Smush.it is by Yahoo! and it is also available online.

From the website:

Smush.it uses optimization techniques specific to image format to remove unnecessary bytes from image files. It is a “lossless” tool, which means it optimizes the images without changing their look or visual quality. After Smush.it runs on a web page it reports how many bytes would be saved by optimizing the page’s images and provides a downloadable zip file with the minimized image files.

Smush.it website: http://www.smushit.com/ysmush.it/

  • ImageOptim

ImageOptim is free and open source! And its for Mac users.

From the website:

ImageOptim optimizes images — so they take up less disk space and load faster — by finding best compression parameters and by removing unnecessary comments and color profiles. It handles PNG, JPEG and GIF animations.

ImageOptim website: http://imageoptim.pornel.net/

  • PNGShrink PNG file compressor for Mac

Website: http://www.macupdate.com/app/mac/33222/pngshrink

  • Ping! PNG file compressor for Mac

Website: http://www.macupdate.com/app/mac/23055/ping!

Other sources:

I don’t really know which one is the best, so what I do is I drop everything in ImageOptim first and then, I upload those that are less than 500KB to PunyPNG to see if it can compress a bit more. And then dump those that are more than 500KB to Smush.it, Smush.it doesn’t have a file size limit you see (at least it doesn’t say it does, but it couldn’t upload my 2MB PNG file). And until all those tell me that are are no more savings, that prolly means that I have compressed my PNGs until they can no longer be compressed.