Resources(Icon and Splash Screen)

I’m getting an error like below when I run the command - ionic cordova resources --icon or --splash:
Uploading source images to prepare for transformations - failed!
HTTP Error 400: POST https://res.ionic.io/api/v1/upload
(“Error”:“unable to read uploaded image”,“Width”:0,“Height”:0,“Type”:“png”,“Vector”:false)

This error is rising only for some images with different dimensions. Even I used better dimensions than mentioned, it is working. But for some dimensions which are not suitable as mentioned…it is not working…Please help me out of this.
Thank You

1 Like

What dimensions are not working?
Why do you have different files with different dimensions?

Also post your ionic info output please.

Yes…Actually we have default icon with 1024 * 1024 right? So I kept another icon.png with dimensions:949 * 596. Then it is working. And when I changed to another icon.png with dimensions:2500 * 2500… Then it is showing the error which I have mentioned. And ionic info is below:

global packages:
@ionic/cli-utils:1.5.0
Cordova CLI :7.0.1
Ionic CLI :3.5.0

local packages:
@ionic/app-scripts : 2.0.2
Cordova Platforms : android 6.2.3 ios 4.4.0
Ionic Framework : ionic-angular 3.5.3

System:
Node : v8.1.3
OS : Windows 8.1
Xcode : not installed
ios-deploy : not installed
npm : 5.3.0

Why do you need different icon files?

I wanted to change the default icon. So I tried with different files. Some of them are only working. Remaining are showing error. So can u please help me what the error is?

My guess from reading the error message: It can’t open/read the image you were trying to use when you got the error. I doesn’t recognize the width and height of the image.

Yes…it is unable to recognize width and height as u guessed. But what might be the reason to accept some file? For splash screen (splash.png) also it is showing same error. Bt it works well for the default splash.png which is of 2732 * 2732 dimensions. I tried that too… Bt same error arising. Let me know the error and solution too…
Thank you

Upload a valid PNG file in the specified size.

—It is working fine. Because it is default image.

----It is not working.

You posted a file called “icon” and one called “splash” - which is it?

Additionally: When I resize the image you posted to the default sizes of both icon.png and splash.png it works with no problems at all.

Icons:
image

Splash:

When I used icon, it is working. Instead of icon I replaced icon.png with splash.png(renamed to icon.png)…then not working and also I tried splash for splash screen(splash.png) and now also it is showing error like I mentioned @Sujan12

And I forgot to mention that I’m trying it for Android

It also works for Android if you put the image in the correct sizes. Just renaming splash to icon won’t work, you also have to change the image dimensions of course.

ohh…hw can I change dimensions???

Open the file in your favorite image editor, change the size, save it.

Thank you sooo much @Sujan12. I’m getting everything(Icon and Splash screen) after changing them to the default dimensions as icon(1024 * 1024) and splash(2732 * 2732).

1 Like

I wasn’t actually aware that the dimensions have to be exactly that, I thought these were minima/maxima. I’m not sure this is properly documented.

Yes…may be it not about dimensions as I experienced just now. Because whenever i’m changin them to the size of 1024 * 1024 or 2732 * 2732, Some of them are only working. Anyways thank you soo much.

I am getting this error too. Looks like the error is in the splash.png file. I can run the command against the icon with:

ionic cordova resources -i

but gets an error with splash command:

ionic cordova resources -s

× Uploading source images to prepare for transformations - failed! HTTP Error 400: POST https://res.ionic.io/api/v1/upload {"Error":"unable to read uploaded image","Width":0,"Height":0,"Type":"png","Vector":false}