Electron packager does not load icon - electron

I am trying to set an icon to my electron packager but it does not load.
I tried many ways like...
--icon=assets/icon.ico
--icon=./assets/icon.ico
but get the error: Reserved header is not 0 or image type is not icon for 'assets/icon.ico'
and when I tried this
--icon=/assets/icon.ico
I got an error: WARNING: Could not find icon "/assets/icon.ico", not updating app icon
I tried to put them in double quotes but it does not work
--icon="/assets/icon.ico"
--icon="./assets/icon.ico"
--icon="assets/icon.ico"
I resized the image from 256x256 px to 32x32 px but it did not make a difference. Does the size affect?

In my case, I needed to add the 'dist' folder to the icon path, so:
--icon="dist/assets/icon.ico"

It is worth noting that you need bot a icon.icns (mac os) and an icon.ico file. That was my issue. I only had an icon.icns.

Related

Do I need to give my electron icon padding?

I've set my electron app icon by converting a 2014x1024 png to icns using this: https://github.com/bitboss-ca/png2icns
However, my icon looks every so slightly bigger than all the others in the "taskbar" on macOS (comes up when you cmd-tab).
Do I need to give my icon some sort of padding or something? How can I make it the same dimensions as other icons?
There doesn't seem to be any guidance on this, only on file formats and ideal dimensions (which I've adhered to already).

"Missing required icon file. The bundle does not contain an app icon of size '120x120' pixels

I have uploaded several apps to the Appstore, but this time I am not able to get past this error. I have the right icon of the right size , right naming convention, checked the bundle identifier matching with the iTunes. What the heck am I missing then?
Add icon 120*120 pixels, Simply
you have to add 120x120 resolution icon in png format.
not in jpeg or other format.

Compress Png Files missing from build settings

I am building an app which has quite a few images in, therefore I have crushed them all using ImageOptim to help decrease the size of my .IPA. How ever the size of my app has not changed at all.
I have looked on their website and they say to turn off Compress Png Files in the Build Settings under Packaging. However that option is not there. I have tried manually adding it into my project.pbxproj but it gets listed under the User Defined section and does not turn it off.
I have also tried searching in the Build settings (My main target is selected).
So my question is... how can I add Compress Png Files into my build settings?
It might sound mind blowing, but please read it to the very end.
Try dragging and dropping a dummy png file to your project
navigator, then select like "Add, Copy if Needed" and the option
will appear in the Packaging section. But, I guess, this is not your case.
It looks like you have all your png's contained in an asset catalog rather that just lying around. For that case, I guess, you might want to play around with this:
You need to Just Search in Build Setting png And CopyPNG File - Packaging is Searched And The Section Have Option is Compress Png File is The Default value is Yes You will change value NO it Means your png Files is Compressed Bellow is the Screen Shot
It looks like the path of the file has been removed or relocated
you can remove it from here as well check the picture below:
If you change the format of the file to png, the error shows up all the time for the assets when you try to use it. It's better to find the original png file or save the file as a png file with an image editor.

Use one icon size in Xcode

I generate a lot of apps for clients. Nowadays there are a lot of different icon sizes (57, 72, 114, 144, 120, 152, 180) in addition to the 1024 sized icon that we upload to iTunesConnect.
In practice, though, I just design the large 1024-sized icon, then manually resize the icon to all of those other sizes and put them in an asset catalog.
That seems like pointless busy work. Is it possible to just give Xcode my 1024x1024 icon and let the tools autoresize it to a smaller version?
The macOS Terminal can really help you here.
If you wanted to resize an image named myicon1024x1024.png to an image of the same filetype, but 72x72, open Terminal, use the cd command to change directories to where your myicon1024x1024.png image is, then execute this command:
sips -z 72 72 myicon1024x1024.png --out myicon72x72.png
The "sips" command has a lot of other options, which can be googled or learned from its man page.
You can also make a bash script which could take the input of your file's name, then call sips once for each icon size you want to create. Of course, the output of this bash script ends up being the same as what you would get from makeappicon.com, so you'd still have to move the files into Xcode.
I don't think Xcode will allow this. However you can try using a web based application for resizing your icons simply. Try makeappicon.com. I am sure there are others out there.
It makes me very sad to write it here but I use Unity for it :-) Yes, 3D engine! Just create empty project, switch platform to iOS, set one 1024 icon and let build the project. Then you can drag and drop pre-made AppIcon into you XCode.

App icon displays a black square.

I am having my app icon be displayed as a black square instead of the intended image.
I have placed all of my AppIcons into the folder, Im wondering what could be causing this.
Your image needs to be an opaque PNG. No transparency or anything, as well as being the correct size.
If it already is that, try opening it in Preview and re-saving it as a PNG. That way OS X 'generated' it and it should be compatible. If that helps fix the issue, then your image editing program is saving in the wrong format...see info below.
Apple has this to say on generating PNGs:
For all images and icons, the PNG format is recommended. You should avoid using interlaced PNGs.
The standard bit depth for icons and images is 24 bits—that is, 8 bits each for red, green, and blue—plus an 8-bit alpha channel.
I have had this happen when the app is listed as a .png file, but the system is recognizing it as a .jpg or some other type ... find your icon in "finder" and open it with preview, go to the file menu select "export as" and make sure you choose PNG as the save format. Delete the old version in the application, delete the derived data, clean your project, and rebuild the application.

Resources