Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Missing welcome image in NSIS/MUI2

Tags:

nsis

I'm struggling to add an image to the first page of an installer written with NSIS/MUI2.

Here's a trimmed down version of the code I'm using.

!include "MUI2.nsh"

!define MUI_HEADERIMAGE
    !define MUI_HEADERIMAGE_BITMAP nsis-header.bmp

!define MUI_WELCOMEFINISHPAGE_BITMAP nsis-welcome.bmp

OutFile "Setup.exe"

# Set language
!insertmacro MUI_LANGUAGE "English"

# Pages for installation
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "..\LICENSE"
!insertmacro MUI_PAGE_FINISH

Section Foo
SectionEnd

The header is shown correctly on the license page, but I can't get it to show on the welcome page. I tried with a 164x314 image (as the doc recommends), with bitmaps saved in 16b or 24b or 32b, with the same image as the header (to make sure it wasn't a problem with the bitmap), compiling the setup under Win2k and Linux... Nothing works.

The bitmap is correctly stored in the setup:

$ 7z l demyo-1.4.exe  | grep modern- | awk '{ print $4 }'
$PLUGINSDIR/modern-header.bmp
$PLUGINSDIR/modern-wizard.bmp

Any idea of what I'm doing wrong?

like image 734
Xr. Avatar asked Aug 27 '09 14:08

Xr.


3 Answers

Even with the guidance that Anders provided I could not get this to work. My problem was with the image itself.

These steps worked for me using GIMP 2.8.10:

  • create an image using RGB mode (Image > Mode > RGB) using the appropriate size for whatever you are creating (164x314 for MUI_WELCOMEFINISHPAGE_BITMAP, 150x57 for MUI_HEADERIMAGE_BITMAP)
  • File > Export as ...
  • name your file with a .bmp extension
  • click "Export"
  • in the window titled "Export Image as BMP" expand "Compatibility Options" and check the box that says "Do not write color space information"
  • also, in the window titled "Export Image as BMP" expand "Advanced Options" and check the radio button under "24 bits" next to "R8 G8 B8"
  • click "Export"

Now recompile your nsi script and your installer should be using the image(s) you specified.

like image 111
Travis Avatar answered Nov 09 '22 21:11

Travis


MUI_LANGUAGE macro(s) have to come after the MUI_PAGE_* macros in the source file

like image 33
Anders Avatar answered Nov 09 '22 22:11

Anders


For other people like me with the same problem but (slightly) different solution:

Make sure you do have the MUI_LANGUAGE macro. (And as the real answer suggests, it must be after the page macros). If you don't include it at all, many things seem to not work, not only images, but even some texts, and so on..

!insertmacro MUI_LANGUAGE "English"
like image 7
Cray Avatar answered Nov 09 '22 23:11

Cray