mb21 / panwriter

Markdown editor with pandoc integration and paginated preview.
https://PanWriter.com
GNU General Public License v3.0
1.07k stars 52 forks source link

Potential Windows/Linux builds #2

Closed ianchanning closed 5 years ago

ianchanning commented 6 years ago

Hi there, this looks a great project. Seeing as it's electron based, is there a chance you'll release Linux and Windows builds?

mb21 commented 6 years ago

With your changes to the package.json, I made a new release with Linux and Windows versions. Let me know if anything is broken in those...

ianchanning commented 6 years ago

I just re-cloned your repo to a new directory and built from there. All went well install, build, dist.

For anyone building on Windows, they need to install the following chocolatey packages:

choco install -y yarn
choco install -y nodejs
choco install -y psc-package

Obviously you can install via other methods but chocolatey makes it much easier on Windows.

Currently the psc-package version (0.4.2) in chocolatey will be wrong and I'm not sure when the package gets updated. So they will have to download v5.1.0 from https://github.com/purescript/psc-package/releases/ until the chocolatey package is updated.

What didn't work though was the icon fix. It's now worse because both the icon on the taskbar and the application icon are cut off.

However there could be some problems around uninstall/re-install. I uninstalled Panwriter through the Windows uninstall menu. This appeared to work correctly - the icon was deleted from the start menu. However when I now try and re-run the new PanWriter 0.5.0.exe then it doesn't appear to re-run the installer, it just starts up as if it is already installed and doesn't try to re-add the application to the Windows start menu. So there could be some horrible caching issue going on.

Actually, no. Now I see the difference, the portable change that you made converted it to a stand alone application that doesn't try to install itself. So where as the previous install was PanWriter Setup 0.5.0.exe the new file is just PanWriter 0.5.0.exe, I've added it to my dropbox folder: https://www.dropbox.com/sh/215jatb80n27uq7/AAAp5gL6JImHam4qITYb6KuFa?dl=0

2018-12-04 01_41_47-

mb21 commented 6 years ago

Now I see the difference, the portable change that you made converted it to a stand alone application that doesn't try to install itself.

Ah, so what's better for most Windows users? The installer or the exe? If you figure out a way to fix the icon on Windows, let me know...

ianchanning commented 6 years ago

For Windows it's better to have the installer, that has the same effect as the linux AppImage file - it adds the program to the Start Menu so that you can just search for the name from there an run the program.

I'll have a look around for the windows icon, but it's not so bad - the icon looks great everywhere except the small icon in the top-left corner. But it is annoying.

mb21 commented 6 years ago

I see, then I'll make the next release with the installer... we're getting there! :-)

ianchanning commented 5 years ago

I've tried some experiments using a icon.ico file and also attempting to name the file both icon-256x256.png and icon-512x512.png but none of that seems to matter. These are based off the suggestion that you mentioned. However looking more closely that is purely talking about the icon on the taskbar rather than the application icon in the top left-hand corner. So currently I'm out of ideas. My Google fu doesn't turn up anything either unfortunately.

ianchanning commented 5 years ago

I tried running yarn dist with a completely different .ico file and this works fine, so there's some issue with the automated conversion of the png file to the ico file. Could you try manually generating an .ico file with whatever tool you use to generate the icon.png file?

mb21 commented 5 years ago

It seems the max .ico size it 256x256 in Windows... can you try this? Just created with macOS Preview...

icon-256x256.ico.zip

ianchanning commented 5 years ago

So another odyssey... it appears something to do with the transparency was causing problems.

The short version is that using https://icofx.ro/ allowed me to create decent looking icons, here's a zip file of the ico file (https://www.dropbox.com/s/1kupo8nlrl5y415/icofx.zip?dl=0) that works.

Plus I've put up the dist directory of the built Windows installer: https://www.dropbox.com/s/sw3duyqvfbvvvq2/dist-windows.zip?dl=0

I'll post the long version a bit later, not for any particular reason but just in case someone ever comes across this thread

2018-12-09 16_23_16-greenshot

ianchanning commented 5 years ago

The long version is:

  1. Your macOS Preview icon wasn't liked by Windows. At least I got some weird issues in the beginning: 2018-12-08 19_20_09-gimp message (I've since tried again, as I must have messed something up with the first attempt and your macOS preview icon does actually work, but I still suffers from the same issue which is the cut off icon.)

  2. After that fail I looked at this SO .ico question and made a basic attempt with GIMP. This only created an icon of one particular size and Windows wants one of multiple sizes, I found this pretty good guide on the sizes required, plus there is a Windows XP documentation page too

  3. After giving up on GIMP as I couldn't follow the instructions I tried ImageMagick, I eventually got the following command working which creates an icon of similar quality to the macOS one you sent me, but still suffers from the same cut off icon issue:

    magick convert image.png -define icon:auto-resize:256,48,32,24,16 favicon.ico
  4. I went through about 20 different configurations of ImageMagick icons rebuilding and trying the PanWriter install each time, each suffering from different problems.

  5. The basic issue seemed to be that I could get nice looking icons at all scales and fix the cut off icon issue if I got rid of the alpha/transparency, but that's not an option

  6. I eventually gave up on a FOSS solution working and tried a couple of freeware options. First AveIconifier which gave the same results and then I gave https://icofx.ro/ a try and this worked perfectly: 2018-12-09 16_34_34-icofx ico - icofx trial

Issues of image quality from ImageMagick / macOS / AveIconifier. As well as the cut off icon issue there were major issues of quality for the different icon sizes for the 32x32 and 16x16, these two show the various options I tried.

  1. You get good quality if you have no transparency, with a black or white background - but this isn't an option
  2. Otherwise the all smaller icons looked badly scaled
  3. icofx solved all the problems - transparency + decent quality at smaller sizes + fixing the cut off icon issue

In the following images, you can see that that icofx.ico file looks by far the best. I've highlighted the icons so that you can see which ones are transparent and which not:

16x16: 2018-12-09 17_12_01-icons

32x32: 2018-12-09 17_14_00-downloads

Given that without the transparency I can get decent quality icons from ImageMagick and through icofx I can get equal quality icons but with transparency, there's possibly some setting that I'm missing in ImageMagick that will handle the icon conversion better, but after two days of trying I've given up.

ianchanning commented 5 years ago

As a final attempt at being able to use free software, I gave paint.net + a plugin a try (paint.net used to be open source but they stopped a while ago). On my second attempt at this I got a transparent .ico file to work. It's not quite as good as the icofx set but it's better than the regular icons.

https://www.dropbox.com/s/qa9ti3x89xdixmv/paintnet_256x256_v2.ico?dl=0

2018-12-09 22_27_46-greenshot

You can compare icofx.ico at the top to paintnet_256x256_v2.ico at the bottom.

2018-12-09 22_04_41-icons 2018-12-09 22_03_46-

mb21 commented 5 years ago

Thanks! I've just added the fx icon to the repo...

mb21 commented 5 years ago

Finally got around to making a new release. This time with all the adjustments to the Linux and Windows files. Let me know if there are still problems, but closing this for now. Thanks again!

Venryx commented 4 years ago

Another option that worked for me: resaving the 256x256 png file, in "8 bit" mode, with the default settings:

However, I recommend your Paint.NET + ICO approach above, as it seemed to give very slightly better/smoother results for me. (in the Windows taskbar anyway -- I'm guessing because it chose the 32-bit version from the ICO file, rather than the 8-bit version, as presumed comparable to the plain 8-bit png file)

mb21 commented 4 years ago

@Venryx you're saying you still have issues with the icon on windows with the newest release and managed to fix it with a different icon.ico file? if so, feel free to make a pull request or upload the fixed file here...

Venryx commented 4 years ago

Oh sorry, no; my issue was the icon for my own program.

I posted the solution above on this thread, because it's the one that was linked to from the generic problem thread for Electron. (will post future information on that thread instead)

ianchanning commented 4 years ago

Haha, sometimes endless hours wasted with odysseys with icon file creation can be useful after all :smile: