Missing welcome image in NSIS/MUI2
Asked Answered
M

7

8

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?

Mackey answered 27/8, 2009 at 14:1 Comment(2)
The size that seemed to work for me is 57 px height, actually measured from the MUI2 dialog. A 149x57 size got me an undistorted banner. Wonder what's causing that difference?Mindoro
For headers, you should actually use 150x57. The doc is here: nsis.sourceforge.net/Docs/Modern%20UI/Readme.html . My description was about the vertical image on left.Mackey
M
12

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

Memling answered 27/8, 2009 at 18:52 Comment(1)
This is incredibly silly (of me), and absolutely correct. Thanks a lot.Mackey
F
20

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.

Fireback answered 20/10, 2014 at 17:53 Comment(2)
MUI_WELCOMEFINISHPAGE_BITMAP adviced dimensions are incorrect. The right dimensions are 164x314. nsis.sourceforge.io/Docs/Modern%20UI/Readme.html#trigger_inwfChaille
I second this; when I added a MUI_HEADERIMAGE_BITMAP that had colorspace information, neither the MUI_HEADERIMAGE_BITMAP nor the MUI_WELCOMEFINISHPAGE_BITMAP (which was fine!) got shown. I had to fix that on the first image to get both of them working. So don't even think "this one is fine so at least it should work" - it seems like if any of them are "broken" not even the fine ones will display.Brambly
M
12

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

Memling answered 27/8, 2009 at 18:52 Comment(1)
This is incredibly silly (of me), and absolutely correct. Thanks a lot.Mackey
C
7

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"
Conform answered 28/5, 2011 at 22:44 Comment(1)
Thank you! That was it, finally! Man I hate NSIS, I can't believe there's no alternative to this day (WiX is overly complex for simple installers)...Higbee
L
3

Ensure your image it's 8bit

Leverick answered 4/5, 2010 at 18:9 Comment(2)
Seems to work with 24 and 32 bit too, at least on the recent version.Conform
Thank you, this worked for me. I used IrfanView Freeware, can recommend it to send images from X bit -> 8 bit.Dihydric
D
1

Your code appears fine, but I noticed you said:

I tried with a 164x364 image (as the doc recommends)

The documentation actually recommends 164x314. So if that's not just a typo on your part, try resizing your image.

If that doesn't help, tell us what's showing up instead of your image. Is it the default image or is it just blank?

Donegan answered 27/8, 2009 at 14:26 Comment(1)
Yeah, that was a typo, sorry.Mackey
M
1

You want to see the nsis-welcome.bmp file and put into archive the modern-wizard.bmp.

Mycosis answered 15/4, 2011 at 6:36 Comment(0)
S
0

I faced the same problem and the problem is solved as mentioned in the original answer.

!define MUI_ABORTWARNING
!define MUI_ICON "my.ico"
!define MUI_UNICON "my.ico"

!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP orange.bmp
!define MUI_WELCOMEFINISHPAGE_BITMAP orange_b.bmp

!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "LicenseAgreement.rtf"
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"

!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES

one point of interest here, if the language file is already loaded in other place in any header file using

LoadLanguageFile "${NSISDIR}\Contrib\Language files\English.nlf" ;don't include while using MUI2

Then NSIS reports the following error.

Error: can't load same language file twice.
Error in macro MUI_LANGUAGE on macroline 9

Any language file inclusion must be commented out to see the header images.

Senaidasenalda answered 4/11, 2014 at 9:56 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.