EasyG0ing1 / MacIcns

MacIcns is a small program that will take any 1024 x 1024 png file and convert it into a proper MacOS .icns file.
Apache License 2.0
16 stars 4 forks source link

Logo

MacICNS is a Java program that will convert any valid 1024 x 1024 image file into a proper MacOS .icns file.


Program is now compiled with GraalVM into a NATIVE executable just like Swift - No JavaVM


Valid image types are:

Using the program

It's fairly simple, grab the latest version from Releases at the right and download the program and install it.

You can use it in either of two ways. If you launch the program without passing in a path to your png file, it will launch the GUI where you can select the file then convert it.

OR, if you prefer, you can use it from Terminal by passing in the path of your png file and it will kick out a properly created icns file.

You must have iconutil available in your PATH or it won't work. You can check to see if it is in your path by opening Terminal and just type iconutil and hit enter. If it comes back with anything other than command not found, then you're in business.

iconutil comes with MacOS so this should not be a problem.

Command Line Usage

By default, the program will run in GUI mode, but if you prefer to run it from terminal, there are a couple of ways you can pass the path of your image file into the program:

open /Applications/MacIcns.app --args /Users/username/Pictures/MyIcon.png

OR

/Applications/MacIcns.app/Contents/MacOS/MacIcns /Users/username/Pictures/MyIcon.png

The program uses the filename of your image file but replaces the extension with .icns. If the .icns file already exists, the program will overwrite the file if it is being run from within Terminal. In the GUI, you will have the option of overwriting the file.

Java libraries are compiled into the app package so no need to install Java.

GUI Mode

If the program quits without showing that the file was created successfully (green text under the program logo), run it from within terminal using this command:

/Applications/MacIcns.app/Contents/MacOS/MacIcns

Then, try to process your image again but this time when it exits, it should kick out an error message that will help you understand why it wasn't able to process the file.

How it works

The program takes your 1024 x 1024 image file and it creates a folder where it then converts your image into the different sizes that are needed for the final .icns file. Then it calls iconutil to do the conversion. It will use the original name of your file but it will have .icns as the extension name and it will drop it into the same folder that your selected image file resides in.

Updates

That's it!

If you have any issues, open an issue or if you would like to enhance the program, then open a pull request.

Thank you,

Mike