love-release icon indicating copy to clipboard operation
love-release copied to clipboard

Icons support

Open MisterDA opened this issue 9 years ago • 20 comments

Soo... about icons... For now, the script supports four different plateforms, each one having its own way to deal with icons.

Let's start with this. The developer/graphist has made some PNGs files, each one with differents resolutions. Where does it stores them ? Let's ask with a --icon option that leads to the directory where theses files are stored.

  • For Windows, the files must be packed into a .ico
  • For OS X, the files must be packed into a .icns
  • For Linux and Android, the files must be moved in a specific location depending of their resolution.

OS X

Now, OS X imposes its naming scheme. There is no way to generate a valid .icns icon than to follow this.

Filename Size of canvas (in pixels)
icon_512x512@2x 1024 x 1024
icon_512x512 512 x 512
icon_256x256@2x 512 x 512
icon_256x256 256 x 256
icon_128x128@2x 256 x 256
icon_128x128 128 x 128
icon_32x32@2x 64 x 64
icon_32x32 32 x 32
icon_16x16@2x 32 x 32
icon_16x16 16 x 16

Linux

In the meantime, Linux says that every PNG image should be named the same, and moved to a specific directory in /usr/share/icons/hicolor/YYxYY/apps, YY being the size of the canvas.

Size Scalable (SVG)
16x16 22x22 24x24 32x32 36x36 48x48 64x64 scalable
72x72 96x96 128x128 192x192 256x256 512x512

Android

While for android, you simply replace the following images in the res folder with PNG's of the same size:

Filename Size
drawable-mdpi/ic_launcher.png 42x42
drawable-hdpi/ic_launcher.png 72x72
drawable-xhdpi/ic_launcher.png 96x96
drawable-xxhdpi/ic_launcher.png 144x144

OUYA

There are two icons that they OUYA system uses:

  • Coverflow image in the PLAY section (You should locat this file at res/drawable-xhdpi/ouya_icon.png, the size should be 732x412px)
  • System icon (drawable-xhdpi/ic_launcher.png)

Windows

And finally, Windows... name_A_BBxBBxC.png where A is the counter of the PNGs, 1 for the lowest quality, BB the size of the canvas and C the image bitdepth (I guess). You can go further than 48x48, it's just an example.

game_1_16x16x4.png
game_2_32x32x4.png
game_3_48x48x4.png
game_4_16x16x8.png
game_5_32x32x8.png
game_6_48x48x8.png
game_7_16x16x32.png
game_8_32x32x32.png
game_9_48x48x32.png

So... We have to find a way to make every thing work together. For now, if you put a ${PROJECT_NAME}.ico or a ${PROJECT_NAME}.icns, the script will use them.

The idea here is to put the PNGs files in one location, to find a common naming scheme and to let the script handles everything for every plateform.

The roadmap:

  1. Different options.
    • find a common naming scheme for PNGs files or for subdirs where they could be placed.
    • say "give me the highest resolution you can make, and I'll use something like ImageMacgick or GIMP to resize"
    • SVGs ?
  2. Write the process. What bothers me the most is that the user has to install a lot of stuff.
    • .icns: needs to detect if running OS X, then use iconutil, else use libicns.
    • .ico: needs to detect if running Bash in Windows.
    • Debian, just move the PNGs in the appropriate directory
    • Android. As it is released separately from the others, it can be done more easely.

So... We're discussing (1) now !

MisterDA avatar Jul 21 '14 16:07 MisterDA

May I add OUYA Coverflow (732x412px)?

pablomayobre avatar Jul 22 '14 01:07 pablomayobre

To the issue I have made .ico files with Gimp... You place the files in different layers (Open as layers does the trick) and then specify the bitdepth of each layer (8, 16, 24 or 32 bits) and WOALA! the .ico file. We need a software that can generate everything from a single .svg file... that would be awesome!

pablomayobre avatar Jul 22 '14 01:07 pablomayobre

ResourceHacker/Gimp had some troubles with some bitdepth/icon sizes so I couldn't generate nice results with it (probably my mistake using the software)

pablomayobre avatar Jul 22 '14 01:07 pablomayobre

+1 to Ouya Cover. I'd really appreciate that :)

josefnpat avatar Jul 22 '14 03:07 josefnpat

Could probably mark imagemagick as a dep, and use that.

josefnpat avatar Jul 22 '14 03:07 josefnpat

Inkscape has export capabilities and PNG is supported inkscape -C -w=$SIZE-h=$SIZE -e=icon$SIZEx$SIZE.png icon.svg Then by checking whether to use iconutils or libicns you run the apropiate command to generate the .icns And then process them with gimp or ImageMagic I may be able to create a Script for GIMP but it might take some time

NOTE: In Inkscape I used the page export so everything should be fitted inside the page, also if the width and the height is not the same the image will be transformed in ugly ways (scaled to fit the square)

EDIT: A guy already did something similar with ImageMagick here

pablomayobre avatar Jul 22 '14 04:07 pablomayobre

libicns doesnt support sizes bigger than 512 (when linked with Jasper) so the 512x2 and 1024 cant be generated that might be a problem too

pablomayobre avatar Jul 22 '14 04:07 pablomayobre

I have found this script. This looks very, very, very promizing.

MisterDA avatar Sep 05 '14 10:09 MisterDA

Hi folks!

So today I was making the official packages for my game and decided to also provide a deb. Works smoothly, great job! The only down side is that it looks bad in the menus with the Love icon instead of the game icon. So I made a few changes to the debian script to accept a --debian-icon file, put it in the right place (/usr/share/icons/.....) and change the .desktop to use it.

Would this be usefull or are you looking for something more advanced? Currently I'm only using a 128x128 icon, I don't know if its mandatory/adviseable to provide at least a few other sizes...

nunodonato avatar Sep 17 '14 10:09 nunodonato

Well, it's a very good start. Truth is that I was to lazy to implement something.

The idea I have is that the user provides an image PNG/JPG, doesn't matter, which could be of the highest resolution possible, and then the script uses ImageMagick directly or IconImp, a Bash script reliying on ImageMagick that does everything we need (but does it do it well ?).

If you'd like to submit a push request, I'll gladly add your changes, and l'll add the whole functionality later.

MisterDA avatar Sep 17 '14 11:09 MisterDA

Ok! My changes accept only a 128x128 icon, how many do we need anyway? In my own icons folder I have like 20 different resolutions for icons :/

So maybe the best way was to ask the user for a 256x256, and then automatically generate 3 or 4 scaled down versions? (128, 64, 32?)

My doubt is, if we are just scaling down an icon, isnt it enough to provide a big one and let the desktop environment/window managet/whatever do the scaling itself? i thought the the point of having different resolutions was if your icon sucked in different sizes and you need to have slightly differences in them to make them look good. if we are just rescaling, is it worth it?

nunodonato avatar Sep 17 '14 11:09 nunodonato

Oh, yes, you are right...

So --icons should point to a folder containing icons. They must have their resolution specified, like "32x32", "64x64" in the filename, but the filename itself doesn't matter. By using a bit of regex, I should be able loop over the files, extract their resolution, and move them into the standard path. Then, they would be renamed to match the project's name.

This should cover Debian packages, as well as Android an OUYA coverflows. Anyway, the user still needs to create by himself .ico and .icns files...

MisterDA avatar Sep 17 '14 12:09 MisterDA

From a user point-of-view (and a lazy one :p) that seems like too much work just to get the icon. Can't it be easy and simple like in windows and mac? we could make optional arguments for other sizes, and keep just one of them mandatory, like --deb-icon-128 file128.png --deb-icon-32 file32.png

nunodonato avatar Sep 17 '14 13:09 nunodonato

if you use a global --icon option to link to a dir where every icons would be stored, the script could even detect files ending with ".ico" or ".icns", and thus release at once executables + icons for Win/Mac/Deb

that's a great idea, using only one solution that fits all :)

nunodonato avatar Sep 17 '14 14:09 nunodonato

One solution to rule them all...

MisterDA avatar Sep 17 '14 15:09 MisterDA

Awesome :)

nunodonato avatar Sep 18 '14 23:09 nunodonato

I've tried adding Icons. I created a new folder:

DebianIcons/
    -- myapp.svg
    -- myapp32x32.png
    -- myapp64x64.png

I pass this directory using --Dicon ../DebianIcons/

But the menu entries get no icons... :( Am I doing something wrong?

Germanunkol avatar Oct 21 '15 05:10 Germanunkol

No, it's love-release that is wrong... It is broken to the core. I should have written tests, but I had just began programming when I started developing love-release and I didn't know about them. I'm sorry it does'nt work out-of-the box (at all ?). If I have time I'll try to check what's going on, but in the meantime I'm trying to rewrite it in lua. Sorryy for the inconvenience. :/

MisterDA avatar Oct 21 '15 06:10 MisterDA

Hey, no worries, it works like a charm. The only thing that doesn't is the icons, which isn't really a big thing. The whole project is really cool. I've been using it to generate the packages for trAInsported for a long time now. Looking forward to the new version!

Edit: The coolest thing is that it now supports .deb packages. Yay!

Germanunkol avatar Oct 21 '15 07:10 Germanunkol

rcedit could be used instead of Resource Hacker for changing the Windows icon.

Sarah-Duck avatar Jul 29 '16 11:07 Sarah-Duck