- NSIS Discussion
- Branding Image problems
Archive: Branding Image problems
Kaos61
17th February 2008 11:01 UTC
Branding Image problems
Yes, it's me again!
I have searched and read everything I can lay my hands on - not only from this forum but from other sites as well - but I am now more confused than when I started.
I think my confusion may be related to my not being familiar with the terminologies used in the documentation.
Firstly, what IS a branding image? Is it the blue (or orange) image on the left side of the interface?
Is creating a custom interface (I have 4 that will be used VERY regularly) as simple as changing the nsisconf.nsh file and then saving that UI as "custom_ui" or something?
I have thus far been "cheating" by simply moving the default "win.bmp" image out of the NSIS directory and replacing it with my own win.bmp image.
I have no doubt there is an easier way. If someone could gently join the dots for me this tired old dinosaur would be eternally grateful.
fabian.rap.more
17th February 2008 13:09 UTC
taken from the NSIS manual::
4.8.1.1 AddBrandingImage
(left|right|top|bottom) (width|height) [padding]
Adds a branding image on the top, bottom, left, or right of the installer. Its size will be set according to the width/height specified, the installer width/height and the installer font. The final size will not always be what you requested; have a look at the output of the command for the actual size. Because this depends on the installer font, you should use SetFont before AddBrandingImage. The default padding value is 2.
AddBrandingImage only adds a placeholder for an image. To set the image itself on runtime, use SetBrandingImage.
AddBrandingImage left 100
AddBrandingImage right 50
AddBrandingImage top 20
AddBrandingImage bottom 35
AddBrandingImage left 100 5
4.9.14.12 SetBrandingImage
[/IMGID=item_id_in_dialog] [/RESIZETOFIT] path_to_bitmap_file.bmp
Sets the current bitmap file displayed as the branding image. If no IMGID is specified, the first image control found will be used, or the image control created by AddBrandingImage. Note that this bitmap must be present on the user's machine. Use File first to put it there. If /RESIZETOFIT is specified the image will be automatically resized (very poorly) to the image control size. If you used AddBrandingImage you can get this size, by compiling your script and watching for AddBrandingImage output, it will tell you the size. SetBrandingImage will not work when called from .onInit!
4.8.1.1 AddBrandingImage
(left|right|top|bottom) (width|height) [padding]
Adds a branding image on the top, bottom, left, or right of the installer. Its size will be set according to the width/height specified, the installer width/height and the installer font. The final size will not always be what you requested; have a look at the output of the command for the actual size. Because this depends on the installer font, you should use SetFont before AddBrandingImage. The default padding value is 2.
AddBrandingImage only adds a placeholder for an image. To set the image itself on runtime, use SetBrandingImage.
AddBrandingImage left 100
AddBrandingImage right 50
AddBrandingImage top 20
AddBrandingImage bottom 35
AddBrandingImage left 100 5
Kaos61
18th February 2008 00:35 UTC
I've read all that so many times I almost know it by heart. However it is all completely meaningless to me. Is there an example script somewhere I missed? I couldn't find one.
fabian.rap.more
18th February 2008 03:14 UTC
let me make it simple 4 u. look at win.bmp and complie a script. c where it is. now try ::
SetBrandingImage some_image.bmp
then recompile it. that image must have changed. AddBrandingImage is used to tell the compiler where it must be placed
Kaos61
18th February 2008 15:43 UTC
I must be missing something here cos it still makes absolutely no sense to me at all. I have no doubt we are dealing with a PEBKAC error here.
I'm going to take a break from scripting for a few days then look at it again. Hopefully, whatever insignificant detail I have not absorbed will somehow register in my head and the lights will come back on! :confused:
EDIT: I thank you for your attempts to help enlighten an old man.
fabian.rap.more
18th February 2008 15:48 UTC
it is just an image placed at the side of the installer on the welcome page.....run the nsis installer again and have a look
Kaos61
19th February 2008 12:02 UTC
Sorry .... still not getting it. I don't understand where in the script I should put it, and in what context/syntax.
http://img.photobucket.com/albums/v4...more/3_8_2.gif
EDIT:
I have attached a basic script called "test.nsi". If I want to change the "win.bmp" image on the installer to "abc.bmp" how would I do it?
I know, I know! I'm a pain in the rear. But if you don't ask you don't learn. ;)
Kaos61
19th February 2008 12:22 UTC
Hmmmm - it seems you can't add attachments on an edit.
Here it is any how! :confused:
fabian.rap.more
19th February 2008 12:45 UTC
here is a simple example. u should be able to replicate it
Kaos61
19th February 2008 13:34 UTC
fabian
I thank you so much! If I could send you a beer through this forum I would.
Your patience is appreciated.
http://img.photobucket.com/albums/v4...ls/4_17_11.gif
Daniel James
19th February 2008 14:01 UTC
Nice try but no banana
Originally posted by fabian.rap.more
here is a simple example. u should be able to replicate it
Nice ... but that's not what I thought the OP wanted (nor what I would want).
MUI already uses a bitmap (
not created as a BrandImage) on the WELCOME page, and it is that bitmap that I think the OP wants to replace (and certainly it is that image that I should like to be able to replace).
If you add a branding image to a MUI installer that image is displayed
as well as the MUI image on the WELCOME page ... or rather it isn't because the image isn't loaded until after the WELCOME page has been dismissed.
Try sticking a
!insertmacro MUI_PAGE_WELCOME
in front of the
!insertmacro MUI_PAGE_INSTFILES
in your example and you'll see what I mean ...
fabian.rap.more
19th February 2008 14:57 UTC
yes u have a point daniel.......i never checked it..........unfortunately i have no time left today so ill try tomorrow.
any moderators or senior members have any idea on how to replace it without renaming the win.bmp?
demiller9
19th February 2008 15:25 UTC
The large image on the welcome page is control 1200, and is loaded by mui2 macros with the line
System::Call 'user32::LoadImage(i 0, t s, i ${IMAGE_BITMAP}, i 0, i 0, i ${LR_LOADFROMFILE}) i.s' "$PLUGINSDIR\modern-wizard.bmp"
I suggest looking at how they did that in Program Files\NSIS\Contrib\Modern UI 2\Pages\Welcome.nsh
You can get a handle to the control by
FindWindow $0 "#32770" "" $HWNDPARENT
GetDlgItem $0 $0 1200
Daniel James
20th February 2008 13:28 UTC
Solution ...
A little (more) Googling reveals the solution in a post from 2004 :)
!define MUI_WELCOMEFINISHPAGE_BITMAP "MyImage.bmp"
!insertmacro MUI_PAGE_WELCOME
Easy when you know how ... but the documentation is largely non-existent :(
GregL
26th February 2008 15:33 UTC
I've noticed that it's not always a lack of documentation, but more that you be looking in the right one. I still use MUI v1, and I knew the answer to your question from Day 1, personally. But if you said you were using MUI2 or nsDialogs, I'd have no idea. :)
A lot of the stuff I've learned was accidental, just from browsing the Help file for a different topic. I'm led to believe that nsDialogs is faster, but it takes 5 or 6 lines of that code to do the same thing in 1 with MUI. I don't see how that's better. :( A time savings of 200 milliseconds is very negligible to me.
Daniel James
27th February 2008 13:27 UTC
Originally posted by GregL
... it's not always a lack of documentation, but more that you be looking in the right one.
Indeed ... but I have
never seen MUI_WELCOMEFINISHPAGE_BITMAP mentione in any documentation. If there is some that covers it I'd love to know where?
I still use MUI v1, and I knew the answer to your question from Day 1, personally. But if you said you were using MUI2 or nsDialogs, I'd have no idea. :)
Yes, the post that I found was talking about MUI v1, but I tested it in MUI v2 and it works.
A lot of the stuff I've learned was accidental, just from browsing the Help file for a different topic.
Sounds familiar :( ... it shouldn't have to be that way!
I'm led to believe that nsDialogs is faster, but it takes 5 or 6 lines of that code to do the same thing in 1 with MUI. I don't see how that's better. :( A time savings of 200 milliseconds is very negligible to me.
Oh, I like nsDialogs ... I use it for custom pages
with MUI2. I like being able to define the whole layout of a dialog in one place (the .nsi file) and not have to manage and maintain a .ini file as well. Saving a few tenths of a second isn't the issue, really.
pengyou
27th February 2008 17:29 UTC
I have never seen MUI_WELCOMEFINISHPAGE_BITMAP mentione in any documentation. If there is some that covers it I'd love to know where?
From the Modern UI ReadMe:
MUI_WELCOMEFINISHPAGE_BITMAP bmp_file
Bitmap for the Welcome page and the Finish page (recommended size: 164x314 pixels).
Default: ${NSISDIR}\Contrib\Graphics\Wizard\win.bmp
From the Modern UI 2 ReadMe:
MUI_WELCOMEFINISHPAGE_BITMAP bmp_file
Bitmap for the Welcome page and the Finish page (recommended size: 164x314 pixels).
Default: ${NSISDIR}\Contrib\Graphics\Wizard\win.bmp
Daniel James
28th February 2008 00:44 UTC
So it's IS in the doscs ... it's just impossible to find ...
Originally posted by pengyou
Quote: [snip]
From the Modern UI 2 ReadMe:
MUI_WELCOMEFINISHPAGE_BITMAP bmp_file
Bitmap for the Welcome page and the Finish page (recommended size: 164x314 pixels).
Default: ${NSISDIR}\Contrib\Graphics\Wizard\win.bmp
Originally by me
I have never seen MUI_WELCOMEFINISHPAGE_BITMAP mentione in any documentation. If there is some that covers it I'd love to know where?
|
As I said, I'd never seen it ... but now that you mention it I see that it is there if you click "Expand All". I missed some of the sections that it's possible to expand, and there's a lot there that I hadn't seen before. :o
Thanks for that ... but my basic feeling remains the same: if the documentation isn't accessible it isn't good documentation.
Red Wine
28th February 2008 00:59 UTC
As I said, I'd never seen it ... but now that you mention it I see that it is there if you click "Expand All". I missed some of the sections that it's possible to expand, and there's a lot there that I hadn't seen before.
Thanks for that ... but my basic feeling remains the same: if the documentation isn't accessible it isn't good documentation.
I guess you're not good observer. Documentation is fine, but, as far I can tell, you're always welcome to contribute and improve it.
btw you could click on expand all, or on every bold blue link above every section of the documentation ;)