Skip to content
⌘ NSIS Forum Archive

Remove header image

11 posts

oldfriend#

Remove header image

Hello.

Is there any way to completely remove header image field? Not just an image whole field where it is placed?

Actually what I need is to set different images to the header in a few custom page and for now I didn't find a way to do this without SetBrandingImage. But SetBrandingImage places image over the header, right? How can I do you nicer?

Thanks.
meoit#
If you are using MUI2, open this file and edit: "\NSIS\Contrib\Modern UI 2\Interface.nsh" lines code follow:

;--------------------------------
;Initialization of GUI

!macro MUI_HEADERIMAGE_INITHELPER_LOADIMAGEWITHMACRO MACRO

!ifdef MUI_HEADERIMAGE_RIGHT
!ifndef MUI_OPTIMIZE_ALWAYSLTR ; Undocumented
${if} $(^RTL) == 1
!insertmacro ${MACRO} $mui.Header.Image "${PATH}" Left Leak
${Else}
!insertmacro ${MACRO} $mui.Header.Image "${PATH}" Right Leak
${EndIf}
!else
!insertmacro ${MACRO} $mui.Header.Image "${PATH}" Right Leak
!endif
!else
!insertmacro ${MACRO} $mui.Header.Image "${PATH}" Auto Leak
!endif

!macroend
!macro MUI_HEADERIMAGE_INITHELPER_LOADIMAGE UN RTL IMGRESID PATH

GetDlgItem $mui.Header.Image $HWNDPARENT ${IMGRESID} ; This variable is not used by every mode but we have to reference it to avoid a compiler warning.

!if "${MUI_HEADERIMAGE_${UN}BITMAP${RTL}_STRETCH}" == "NoStretchNoCropNoAlign"

SetBrandingImage /IMGID=${IMGRESID} "${PATH}"

!else if "${MUI_HEADERIMAGE_${UN}BITMAP${RTL}_STRETCH}" == "NoStretchNoCrop"

!insertmacro MUI_HEADERIMAGE_INITHELPER_LOADIMAGEWITHMACRO \
MUI_LOADANDXALIGNIMAGE

!else if "${MUI_HEADERIMAGE_${UN}BITMAP${RTL}_STRETCH}" == "AspectFitHeight"

!insertmacro MUI_HEADERIMAGE_INITHELPER_LOADIMAGEWITHMACRO \
MUI_LOADANDASPECTSTRETCHIMAGETOCONTROLHEIGHT

!else

!if "${MUI_HEADERIMAGE_${UN}BITMAP${RTL}_STRETCH}" != "FitControl"
!warning 'MUI_HEADERIMAGE_${UN}BITMAP${RTL}_STRETCH set to unknown value, defaulting to FitControl'
!endif
SetBrandingImage /IMGID=${IMGRESID} /RESIZETOFIT "${PATH}"

!endif

!macroend


>>>>>>You can detele all ${PATH}
🙂
oldfriend#
Originally Posted by meoit View Post
If you are using MUI2, open this file and edit: "\NSIS\Contrib\Modern UI 2\Interface.nsh" lines code follow:🙂
As I understand this code should be placed in Interface.nsh. But what does it do? And how to use it?
oldfriend#
AddBrandingImage top 0 0 
Completely covers HEADERIMAGE_BITMAP place. Actually this looks like a miracle for me 🙂

If someone can explain how to use params of width and height there that would be perfect.
meoit#
Easier, replace file nsis.bmp at ""C:\Program Files\NSIS\Contrib\Graphics\Header\nsis.bmp" with your bmp file, dimension: 150x57 pixels. 🙂
oldfriend#
Originally Posted by meoit View Post
Easier, replace file nsis.bmp at ""C:\Program Files\NSIS\Contrib\Graphics\Header\nsis.bmp" with your bmp file, dimension: 150x57 pixels. 🙂
I have 5 different custom pages, every one has it's own branding image. Replacing will not help 😉
oldfriend#
Unfortunately AddbrandingImage/SetbrandingImage doesn't work for Windows 8/10 ... Does anybody now why?
oldfriend#
Originally Posted by oldfriend View Post
Unfortunately AddbrandingImage/SetbrandingImage doesn't work for Windows 8/10 ... Does anybody now why?
Answering myself. Everything works, it's me noobing. Images should be included to installer as far as they are set in their places at run-time.