Resources(Icon and Splash Screen)


#1

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


#2

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

Also post your ionic info output please.


#3

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


#4

Why do you need different icon files?


#5

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?


#6

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.


#7

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


#8

Upload a valid PNG file in the specified size.


#9

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

----It is not working.


#10

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


#11

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:

Splash:


#12

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


#13

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


#14

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.


#15

ohh…hw can I change dimensions???


#16

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


#17

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).


#18

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.


#19

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.


#20

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}