Skip to content

ns resources generate icons: iOS 1024x1024 garbled #5410

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
BlueHunter99 opened this issue Oct 6, 2020 · 10 comments · Fixed by #5420
Closed

ns resources generate icons: iOS 1024x1024 garbled #5410

BlueHunter99 opened this issue Oct 6, 2020 · 10 comments · Fixed by #5420

Comments

@BlueHunter99
Copy link

Environment
Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project):

  • CLI: 7.0.10
  • @nativescript/core: 7.0.9
  • iOS Runtime: 7.0.1

Describe the bug
ns resources generate icons works perfectly for all of the icons except for the 1024x1024 one. This results in a weird 'garbled' image, which is then used on the app store.

To Reproduce

  1. Create new project from sample (in my case Angular + Hello World)
  2. Use ns resources generate icons on an icon of your choosing.

Expected behavior
The CLI should generate (scale) the icon properly.

Additional context
I've attached the icon.png which I use while running the command as well as the resulting image.

original icon

generated icon

@crowmagnumb
Copy link
Contributor

This just bit me too. I had to pull my app back from review after I discovered this. As a workaround I guess I will just copy my icon over by hand before building but would nice to get this fixed.

@NathanWalker
Copy link
Contributor

I had no idea this command even existed!
Golden standard has been this for long time:
http://images.nativescript.rocks/

@crowmagnumb
Copy link
Contributor

Well, that may be fine for one-offs, but I recreate the icons for development, beta, and production versions so that they show up on my phone differently and I can tell them apart. The dev version is the usual version, when I am deploying a beta test version to TestFlight for example, I recreate the icons for that, and finally when I publish to the store I recreate the production version of the icons. This is all done in my build script which includes this command.

@crowmagnumb
Copy link
Contributor

crowmagnumb commented Oct 16, 2020

This is caused by line 160 of assets-generation-services.ts but is the fault of the dependency jimp. The rgba(false) function garbles the image.

// This code disables the alpha chanel, as some images for the Apple App Store must not have transparency.
if (assetItem.rgba === false) {
	image = image.rgba(false);    <=== issue here
}

assetItem.rgba is only set to false for 1024 size icon. So, will investigate a fix on jimp, but in the meantime, does anyone know if this line of code is necessary? Why only for the 1024 sized icon?

@NathanaelA

This comment was marked as abuse.

@crowmagnumb
Copy link
Contributor

Weird that it is only that one though. But OK. :) Anyway, I couldn't figure out the jimp issue on my own so I submitted an issue that you can find here jimp-dev/jimp#954

@crowmagnumb
Copy link
Contributor

For anyone that this may help I'm running the following command after ns resources generate icons <src> and that is convert <src> -background white -alpha remove -alpha off AppResources/iOS/Assets.xcassets/AppIcon.appiconset/icon-1024.png where convert is an ImageMagick utility. My icon is 1024, so if yours is not you will have to resize it by adding -resize 1024x1024 to above command.

@NathanaelA

This comment was marked as abuse.

@crowmagnumb
Copy link
Contributor

Oooooh, that did the trick! Nice job! I'l do a pull request since i have the change, though I'ld be stealing your thunder.

@NathanaelA

This comment was marked as abuse.

@NathanaelA NathanaelA linked a pull request Oct 16, 2020 that will close this issue
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants