Why and how to generate the ic_launcher.webp icons inside mipmap folder - webp

Android Studio used to generate PNG files for the launcher icons but with the last version, when you create a new project, the default launcher icons inside the mipmap folders are in WEBP format.
I tried to find anything about it but this change is not addressed anywhere. The thing is that if you try to add a new image asset and replace these icons, the generator will create PNG files and you'll have to manually delete the WEBP files.
So, what should one do? Does the Asset Studio have an option for exporting them as WEBP? Is WEBP actually better than PNG (specially for older devices, say API level 21)?

webp is smaller in file size but requires Android 4.3 (API 18)+ for foreground transparency.
At the moment, you still need to manually convert those generated png icons into webp. Android Studio has built-in support for this conversion.
Alternatively, you can use Google's command line tool:
get the encoder: https://developers.google.com/speed/webp/docs/precompiled (see "downloads repository")
convert icons: ./bin/cwebp ./ic_launcher.png -q 100 -o ./ic_launcher.webp

Related

Unable to open images when Imagemagick updated from 6.9.2.8 to 7.0.7.4

I updated the ImageMagick library in my application. Since then my code is not able to generate images.
Is there any special change or option I need to consider while installing? I am replacing convert.exe in my app.

Why XCode changes images in xcassets folder while packing?

I optimized and put compressed images into Images.xcassets
When I build the package and look into the contents of it, I see that all of the images are modified by XCode (build tools etc..) and for example Default-568h#2x.png (218KB) becomes LaunchImage-568h#2x.png(455KB)
This makes it impossible for me to put optimized images.
What am I doing wrong here?
Your issues is most likely premultiplied alpha channel. I ran into this same issue when designing my game engine and it was relatively painless to fix.
Last I knew there is no option to disable premultiplied alpha channels for the Xcode bundle.However, Xcode comes bundled with a textureool which can be used at build time to format your images into another format that does not suffer this same optimization. Since my code focuses on sending texture data to OpenGL i used the powerVR format PVRTC. However, you're free to utilizes whatever format you like.
If you decide to go this route you can add a build target to your project which converts all png files into which ever format you prefer.

XCode (4.6.3) invokes TiffUtil in the Copy Resources Phase

Does anyone know why Xcode (4.6.3) would start TiffUtil in the Copy Resources Phase instead of just copying PNG files to the bundle using CpResource . I'm now ending up with some normal PNG icons and splash screens and a few tiffs. I've checked the images, there doesn't seem to be anything wrong with them.
Thanks,
Daniel Dekkers
I ran into this last week!
The problem was in the build settings.
Combine High Resolution Artwork COMBINE_HIDPI_IMAGES
Combines image files at different resolutions into one multi-page TIFF
file that is HiDPI compliant for Mac OS X 10.7 and later. Only image
files in the same directory and with the same base name and extension
are combined. The file names must conform to the naming convention
used in HiDPI. [COMBINE_HIDPI_IMAGES]
It wants to take your x.png and x#2x.png and turn it into a multi-page TIFF. But since this option isn't valid for iOS, none of your images will work correctly.
So, in the build settings, try and find "Combine High Resolution Artwork" and turn it off. If its not in there, you can also search for the COMBINE_HIDPI_IMAGES flag and turn it off.

How do I generate a texture with texturetool that pvr2atf will accept?

The Adobe docs for the new ATF SDK (http://www.adobe.com/devnet/flashruntimes/articles/atf-users-guide.html) state that the pvr2atf file is specifically designed to let you convert textures created with texturetool into ATF textures. I have a PNG texture (with transparency), and when I create an ATF with it directly, I get some odd artifacts around the edges of the non-transparent pixels. When I create a PVRTC texture with texturetool from the same source image, the preview generated by texture tool looks great. So, I was hoping I'd then be able to convert that into a clean ATF that I could then use on iOS in a Starling app.
However, when I use the texture created by this command:
texturetool -e PVRTC -o atlas0.pvrtc -p atlas0-preview.png -f PVR atlas0.png
pvr2atf complains:
Illegal pvrtc texture type.
(Hint 1: In PVRTexTool CL type needs to be OGLPVRTC4)
(Hint 2: In PVRTexTool UI select the 'OpenGL ES2.0' tab in the 'Encode Texture:' dialog and select 'PVRTC 4BPP')
Conversion failed!
I've tried a few different options to the texturetool, but have not managed to generate a single texture that pvr2atf doesn't have a problem with. Has anybody managed to do this? These tools are very new, and there's not a lot of info out there, aside from what Adobe has written (and in some cases their docs directly contradict the result of the tools, such as in the case of when transparency is supported).
I am downloading PVRTexTool now to see if I have better luck there, but I need this eventually to be automatible so needing a GUI tool would be a major bummer.
For starters download the Imagination PowerVR SDK from here
Dont use texturetool, it isnt updated as much as this tool which is from the developers of PowerVR:
In here you will get a GUI version of the texture packing tool called PVRTexTool, thats much easier to use. In here you can open your PNG and then manipulate it including the format the texture is set to. Click the box at the top with the 3 yellow arrows pointing down to see compression formats
It would appear you need to use PVRTCII 4bpp which defines a compressed texture 4 bits per pixel for OpenGLES 2.0. This also allows you to see all the other formats and have a play around if that format doesn't work.

iPad: PNG Crush error

I am trying port my iPad project to latest iPad 2. I installed iOS 4.3 SDK with Xcode 4.0. When i try to build my project, i'm getting the following error. I don't know why am i getting this error. Could someone help me to resolve this build error?
While reading /Users/username/Desktop/iPAD/MyProject/trunk/Resourses/images/top_bar.png pngcrush caught libpng error:
Not a PNG file..
Could not find file: /Users/username/Library/Developer/Xcode/DerivedData/Project-fmhveawksgdtnraclfizuhrekmzi/Build/Products/Debug-iphoneos/MyApp-Upgraded.app/top_bar.png
I had the same problem, but it wasn't because of a corrupted png : it was because two PNG files had the same filename in different directories of my source tree. What was peculiar was that the errors (I had 4 files which had "twins") were not identical from one build to another. On one run I had errors on all files, on the other only on some of them.
Did you check whether the file Users/kavapanga/Desktop/iPAD/ALN II 3 latest 2/trunk/Resourses/images/CS_logo_for_top_bar.png exists? Also check if it is infact a PNG file. Right click on the file and do a Get Info to check if the file has any other extension and is marked as hide extension. If you are not sure of the format of the file, opening the file and save it as a PNG file again should work ,most of the time.
I had the same problem.
How to fix : Open up image with Preview -> File > Export > Format change to PNG and you are done !!
There is no issues with image or Xcode. The issue, which creating that image from photoshop, is whether that image is interlaced or not interlaced. While saving your image in photoshop you will get one option for that.
Check out this link for more info:
Build app with Xcode 4 - it always show some error about PNG image
not interlaced: You should use image which is not interlaced. This is the original png image.
interlaced: This option is suitable for the image which are getting downloaded from web. Specifically saying, this is used when you require to reduce image load time. What this option internally does is, it will create a .png file but with lower clarity and lower dpi like a normal jpeg image. That's why such images are having property that it is jpeg image.
Hope this will help you all.
Enjoy Coding :)
I got this error when I moved images around in the project's folder, to an "Images" folder.
Turns out my "Copy Resources" build phase contained the steps both to copy the files from their new, correct folder - and from the previous folder where they were stored. Removing the outdated build steps fixed the errors.
Another reason pngcrush considers PNG files to not really be PNG files is if you accidentally export them with layers intact. If you inspect the file in Finder, look around the More Info area (Dimensions, Color Space, etc.) for an item called "Layers"
It might say something like:
Layer 68, Title Banner, Group 26
This happens when designers sometimes Save As PNG instead of exporting for web/mobile. And it completely destroys libpng (and thus pngcrush).
The fix is to properly export the PNG, or open the PNG yourself and re-export it as a "flat" PNG.
This can be caused by incompatible PNG file format. You will need the "Color profile" for your png file to make it work in Xcode.
First off, check the info for your file.
While this is a valid PNG file, this is NOT the format that Xcode can take. You will need the following PNG format:
To convert your PNG file to a format that Xcode can take. You can use Preview to export the file.
Had this issue as well. The PNG existed and wasn't corrupt.
Solved it by:
R-click the image in xcode, select "Delete"
Remove reference only (don't actually trash the file)
Drag n' drop it back into xcode (in-place) making sure you select the correct targets
I had this problem and found there was a problem with the png. I remade it and worked fine.
I had the same problem. Even though the file extension may be png the file may still be something else. And 'get info' shows what ever the file extension is I think. Open up the file in preview and go to tools -> show inspector -> File tab. Here you should be able to see the actual file type.
I had this error and it was actually totally unrelated to the png's it was erroring on. The actual problem was I had two files with the same name in my project (I had drag'n'dropped a newer version of a 3rd party class assuming it would replace the older version).
I removed the reference to the duplicate file and that solved the build errors.
Problem Solved
I got the same problem couple of time in development but today i found that there are two solutions and their possibilities, here is this
Problem Solved#1: If you Create or your designer create the design which they saved the pnd from adobe illustrator then its got the problem if you create by yourself just copy all the AI artwork to the photoshop or if your designer create it then just tell them to import the illustrator format to the photoshop and send the pnd.
Problem Solved#2: select the image right click the image->get Info and check that it is in correct .png format or not if its not then just edit .png extension.
Just Enjoy.
I get the same error when I tried to copy my project folder and run the project. The project in the original folder didn't have that problem.
Deleting the copy and making a new copy of the folder solved my problem.
Error:
While reading /Volumes/Mac OS/RDC/Workpot/RestApp/RestApp/default1024_768.png pngcrush caught
libpng error: Not a PNG file..
Solution:
I opened "default1024_768" file in PaintBrush tool and saveAs PNG file with same name.
Replaced the Icon file in Xcode project --> Clean --> Build.
That's All its work like charm
Hope this will help someone.
I have this bug quite often. if you 100% sure that your png is there and is correct then just simply recompile the project, if does not work - recompile again and again, and sometimes it will start working ;-) that's a bug in Xcode that was there for long time (since Xcode3).

Resources