Stamps and Animation

E2B Version 1.78 and later versions can use some new features in grub4dos 0.4.6a.
 
Note: The E2B_Editor.exe menu editor does not display animations or stamps.
 

Transparency

If you enable Transparency (bit 7 = 0x80) then the bottom left pixel is used as the transparent colour.
Any pixel which has the same RGB value as the bottom left corner pixel will then not be written to the display, instead the wallpaper pixel will be written.
 
Tip: If some background pixels are not exactly the same RGB colour value, then they will appear as 'speckles' on your wallpaper image. An easy way to get around this is to cheat and use a wallpaper which has a similar coloured background. For instance, if your animation shows white speckles in transparent mode, ensure that the background wallpaper is also white behind the stamp/animation's location.
 
Use .bmp if you want to use transparency. .jpg files may not use exactly the same RGB colour value for the background which can cause dots/artifacts to be visible.
 
 

Stamps

E2B supports up to 10 stamps. 
A stamp is a 24-bit colour graphics bitmap or JPEG which will over-write the current wallpaper background at a specified x/y position.
A stamp can be any size, up to the maximum resolution of the graphics mode chosen (e.g. 800x600 or 1024x768), however, they are normally intended to be smaller than the background wallpaper and they can be positioned anywhere on the screen (even behind the menu area).
 
Try this in your \_ISO\MyE2B.cfg file to add an E2B boiler plate stamp to the top right of the screen:
set STAMP1=0x80=570=23 /_ISO/e2b/grub/E2BPlate.bmp
 
The wallpaper can be a large bitmap or JPEG file, or it can be a plain colour background, but the display must be in graphics mode (not text mode).
Stamps do not work if using a GFX Menu.
 
You can define STAMPn variables in the \_ISO\MyE2B.cfg file like this:
 
# Ovewrite the wallpaper. Format: set STAMPn=type=x=y (filespec)   note: must be space before filespec, type 0x00=opaque or 0x80=transparent background
set STAMP1=0x00=584=0 /_ISO/docs/Templates/Animate/easy2boot_stamp.bmp
set STAMP2=0x80=680=160 /_ISO/docs/Templates/Animate/E2B.bmp
set STAMP3=0x00=680=260 /_ISO/mystamp3.bmp
set STAMP4=0x00=680=360 /_ISO/mystamp4.jpg
 

The graphics files can be compressed using GZip or Encode_LZMA.cmd and can have any name or file extension.

If type=0x80 is used, the bottom-left corner pixel will be used to determine the transparent colour rgb value - any pixel of this same colour value (anywhere in the stamp) will not be displayed.

Tip: If you want to make text with a transparent background, use Microsoft Paint to make a 2-colour (black&white) .bmp file. This will create a non-dithered image with just two colours. Then re-load and re-save it as a 24-colour bmp and change the colour of the letters to whatever colour you want. This will leave a plain background which is suitable for using with transparency. Make sure the corner pixel (bottom-left) contains the rgb value that you want to be transparent. Any pixels colours of this same rgb value will then not be written to the display.

Alternatively, design and download your own text logo using this site (transparent page here).

Use a different 'stamp' for each menu

If you always use a stamp with the same size and position, you can use a different stamp for each submenu.

For instance, when we load the Antivirus submenu, we could display an antivirus logo stamp at the top-right of the menu but use a different stamp for the Main menu.

Make two new .mnu files as follows (0x00=opaque or 0x80=transparent):

\_ISO\MAINMENU\$$$$CONFIG\MMStamp.mnu
splashimage --offset=0x00=680=10 /_ISO/MMStamp.bmp

\_ISO\ANTIVIRUS\$$$$CONFIG\AVStamp.mnu
splashimage --offset=0x00=680=10 /_ISO/AVStamp.bmp

The 'stamps' will need to be exactly the same size and written to exactly the same position on the background so they exactly overwrite each other OR you could also use a splashimage command first to load a completely different background if you wish. (e.g. splashimage /_ISO/AVwall.bmp).
 
We use a folder called $$$$CONFIG because it must be the first alphabetically-sorted folder or file to be enumerated by E2B. Note that if you had a file called \_ISO\MAINMENU\$$$$$special.ISO, then the $$$$CONFIG folder would not be the first file/folder and so the MMStamp.mnu file would not work! Instead of using a $$$$CONFIG folder, you could just use a \_ISO\MAINMENU\$$$$MMStamp.mnu file - as long as it is enumerated first by E2B.
 

Animation

 This animation is playing in non-transparent mode (when in transparent mode, the black background will be transparent).  
 

You can define only one animation sequence using the ANIMATE variable in the MyE2B.cfg file.
The sequence will either play for 1 to 15 times during E2B start-up and before the E2B Main Menu is displayed, OR it can be continuously displayed on the background wallpaper when the menu is displayed.

An animated GIF file must be split into multiple 24-bit colour .bmp or .jpg files (frames). E2B will load them one after the other with a delay between each one.

The easiest way to create an animation is use Google to find an Animated GIF, convert it using KickMyGraphics and then make it into an .IMA file using GIFtoIMA.cmd (see 'How to make animated frames for E2B' below).

Rules for animation files

  1. Extracted .BMP files must be in 24/32-bit colour depth (not 256 colour)
  2. Extracted .JPG can be used but do not support transparent backgrounds
  3. The dimensions of each .bmp/.jpg (Width x Height) must be identical for all frames - otherwise you get jitter and remnants on screen
  4. Animated GIFs which only store differences must be converted using KickMyGraphics.
  5. When you play animations using a transparent setting, the bottom-left corner pixel RGB colour value is used as the transparent colour.
  6. Max 255 frames supported
  7. If the last frame is the same as the first, reduce 'last' number by one so there is no 'pause'
  8. You can either loop it 1-15 times or play it continuously
  9. The file frame name and file extension must end in nnn.eee where nn is 01-99 or 001-255 and eee is any three letters (typically .bmp or .jpg).
  10. Use the free app KickMyGra phics to convert a GIF into the correct format (loopback mode=off) then use GIFtoIMA to convert it to a .IMA file.

E2B cannot directly use Animated .GIF files, you must extract the frames first.

Tip: Try the DNA Animation .mnu file (in Alternate Downloads - Other Files area) for a 120-frame rotating transparent DNA model...

or maybe display a wavy flag  on your menu.

The F2 key will stop/start the animation (if the F2 key has not been already defined as a menu hotkey).

Avoid positioning an 'infinite-play' animation inside the E2B Menu area or where text may be located (e.g. avoid the menu help text area under the menu or the 'footer' help text area under the menu).

You can specify a transparent background (the bottom-left pixel is regarded as the transparent pixel RGB value).

If the 'type' includes %infinite% then it will play the sequence continuously on the wallpaper when the menu is displayed.

If you specify the number of cycles (1-15), then the background will be displayed and the animation will play during E2B start-up and before the E2B menu is displayed.

Grub4dos only supports one animated sequence on the display at any one time.

Example (multiple .bmp files)

The example below displays 9 frames - 530791_frame_0001.bmp to 530791_frame_0009.bmp - the last frame is 09 so last=9.

The file name and extension must end in nn.eee where nn is 01-99 and eee is any three letters (typically .bmp or .jpg). Bitmap files can be compressed using GZip or LZMA. If there are more than 99 frames, the file name should end in 001.bmp or 001.jpg (max=255). The filename should always be the first frame (e.g. abc01.bmp or abc001.bmp).

Note: All individual frames must be the same x,y dimensions or the image will jitter and may leave remnants on the screen during animation.
Also, they each frame must contain a complete image (you can only checking by viewing the extracted .bmp file). Some GIFS use a 'differences only' encoding format.
Tip: Extract the frames using IrfanView and then configure Explorer to display the 'Dimension' column so you can check they all have the same dimension.

KickMyGraphics will convert an animated GIF into the correct format.

A sample of some animation code for the MyE2B.cfg file is shown below:

# ANIMATE - displays a sequence - first file must be end in 01.xxx (can be compressed bitmap using gzip or LZMA or JPEG file) - must use .bmp or .jpg as extension
# trans=transparent, infinite=animate on menu or use 1-15 for number of cycles, current animation is stopped if type=0x00
# 18 delay units = 1 second, x and y in pixels, last = last frame number in sequence 01-255.xxx
set trans=0x80 && set infinite=0x10
 
# display sequence on menu (with transparent background)
set /A type=%infinite% + %trans% > nul
# uncomment line below to play sequence 3 times immediately
###set /A type=%trans% + 3 > nul
set delay=0x3
set last=09
set x=650
set y=40
set FILE=(bd)/_ISO/530791_frame_0001.bmp
set ANIMATE=%type%=%delay%=%last%=%x%=%y% %FILE%
set trans= && set infinite= && set delay= && set type= && set last= && set y= && set x= && set FILE=
 
If you wish, you can reduce this to just one line:
set ANIMATE=0x90=3=9=650=40   /_ISO/530791_frame_0001.bmp

 

There must be 9 files in the \_ISO folder, 530791_frame_0001.bmp to 530791_frame_0009.bmp.
 
Note: By using type=1 and last=1, you can display any single picture for a set period of time during E2B startup.
          Use delay=0 to stop animation (infinite delay), the specified first frame (e.g. 530791_frame_0003.bmp) only will be displayed.

 

Load animation files into memory for faster animation (.IMA file)

If you use the example shown above using 'infinite' animation, it will continuously load the graphics files from the E2B USB drive.
This can affect the delay between each picture and also can cause wear of a USB Flash memory drive.
 
A much better solution is to load all the graphics files into memory first.
This can be done by making a floppy disk image file (e.g. E2B_GIF.ima) which contains all the frame images.
It is better for performance reasons, to use uncompressed .bmp files for the frames but you can compress the final .ima file using Encode_LZMA.cmd.
This image will be loaded as floppy disk 3 (fd3) by E2B. You must set the ANIMFD3 variable and specify (fd3) for the source of the animation files.
 
# ANIMATE - displays a sequence - first file must be end in 01.xxx (can be a compressed bitmap using gzip or LZMA) - must use .bmp or .jpg as extension
# type: trans=transparent, infinite=animate on menu or add 1-15 for number of cycles, disable playing = 0x0
# 18 delay units = 1 second, top-left offset x and y in pixels, last = last frame number in sequence 01-255.xxx
# display a sequence on the menu (with transparent background)
set trans=0x80 && set infinite=0x10
set /A type=%infinite% + %trans% > nul
set delay=0x3
set last=09
set x=650
set y=40
# if images are inside a disk image, specify (fd3) as the device
set FILE=(fd3)/frame_0001.bmp
set ANIMATE=%type%=%delay%=%last%=%x%=%y% %FILE%
set trans= && set infinite= && set delay= && set type= && set last= && set y= && set x= && set FILE=
# If using a floppy disk image (fd3), we must specify the image file
# The floppy disk image is loaded into memory and so the animation is faster and does not constantly access the disk
# ANIMFD3 if a floppy disk image file containing the files - it is mapped to fd3 by E2B
set ANIMFD3=/_ISO/docs/Templates/Animate/E2B_GIF.ima
 
If you wish, this can be shortened to just two lines:
set ANIMFD3=/_ISO/docs/Templates/Animate/E2B_GIF.ima
set ANIMATE=0x90=3=9=650=40 (fd3)/frame_0001.bmp
 
For details of how to make a floppy disk image containing the frames, see below.
 
You can find example animations in the Alternate Download Area - Other Files folder (e.g. DNA and MrBean).
 
Tip: Sometimes the first and last frame are identical. This can cause a ripple effect at the end of each cycle. To fix this, reduce the last frame number by 1.
 

Multiple animations sequences

You can play animation sequences one after another from a MyE2B.cfg file.
You should only use an infinite sequence for the menu, and you must set the ANIMATE variable last of all.
For instance this will play two animation immediately first, enumerate the MAINMENU files and then play another one continuously on the menu.
If you relaod the menu using F8, they will play again:
 
# we must be in graphics mode
graphicsmode -1 800
#first display a background (optional)
splashimage /_ISO/wallpaper.bmp
 
# first play animation
set trans=0x80 && set infinite=0x10
# play sequence 3 times immediately
set /A type=%trans% + 3 > nul
set delay=0x3 && set last=15 && set x=350 && set y=40
set FILE=/_ISO/ANIM/A_frame_01.bmp
set ANIMATE=%type%=%delay%=%last%=%x%=%y% %FILE%
# play sequence now
splashimage --animated=%ANIMATE%
 
# second animation
set delay=0x5 && set last=12 && set x=650 && set y=400
set FILE=/_ISO/ANIM/B_frame_01.bmp
set ANIMATE=%type%=%delay%=%last%=%x%=%y% %FILE%
# play sequence now
splashimage --animated=%ANIMATE%
 
# setup ANIMATE for Menu from a floppy disk image
set ANIMFD3=/_ISO/docs/Templates/Animate/E2B_GIF.ima
set ANIMATE=0x90=3=9=650=40 (fd3)/frame_0001.bmp
 
# delete unwanted variables
set trans= && set infinite= && set delay= && set type= && set last= && set y= && set x= && set FILE=

 

Play animation from IMA file 3 times with different background, before going to menu

Note that any error in code syntax will prevent the following lines from executing unless errorcheck off is used.
Make sure the 'last' parameter is correct - if it is too big it may continue playing when the menu is reached!
By testing for DONEMENU, the animation only plays on first boot and not when F8 is pressed.
 
### play boots animation on first boot 3 times - then use horse animation on main menu
 
### if error in our code, it will not run any lines afterwards if errorcheck on is used, so turn off
errorcheck off
### we must be in graphics mode
if not exist DONEMENU graphicsmode -1 800
###display a background on first boot - bitmap or single colour fill (optional)
#if not exist DONEMENU splashimage /_ISO/smile.bmp
### or just fill screen with one colour
if not exist DONEMENU splashimage --fill-color=0x010101
 
### first play animation 3 times using IMA file - make sure %last% is correct or strange things happen!
set trans=0x80 && set infinite=0x10
set type=0x3
set delay=0x1
set last=24
set x=250 && set y=40
### load IMA as fd3
map --mem /_ISO/bootsKMG.ima (fd3) > nul
map --hook > nul
set ANIMATE=%type%=%delay%=%last%=%x%=%y% (fd3)/E2B/bootsKMG_frame_0001.BMP
### play sequence now
if not exist DONEMENU splashimage --animated=%ANIMATE%
 
### set up animation for menu
set ANIMFD3=/_ISO/AnimhorseKMGTrans.ima
set ANIMATE=0x90=1=7=370=510 (fd3)/E2B/AnimhorseKMGTrans_frame_0001.BMP
 
 

How to make animated frames for E2B

GIFtoIMA.cmd

 
1. Convert an animated GIF to the correct format using KickMyGraphics
2. Convert the GIF to an IMA file using GIFtoIMA
 

GIFs which only store differences are not suitable for conversion. You can check them using the GIFtoIMA - View Slideshow option and convert them using KickMyGraphics if necessary.

An easy way to make an IMA file from a GIF file is to drag-and-drop the animated GIF file onto the \_ISO\docs\E2B Utilities\GIFtoIMA\GIFtoIMA.cmd file.
For convenience, you can copy the GIFtoIMA.cmd file to another location if you wish (e.g. Desktop or folder containing GIFs).
GIFtoIMA will extract the .bmp files from a GIF and then make a IMA file (uses IrfanView and ImDisk which must be pre-installed).

GIFs which have frames of different sizes are not suitable (they cause jitter and leave remnants on screen).
GIFtoIMA allows you to change the size of the frames (and maintain aspect ratio).
GIFtoIMA can convert to JPGs for smaller size but the transparent background option will not work well with JPG files.

Note: if you don't make a large enough virtual floppy drive (Z:), you will get an error, press CTRL+C to abort and try again with a larger size.

Once the .IMA file is made, you can then compress the IMA file using LZMA_Encode, if you wish. Drag-and-drop the IMA file onto the \_ISO\docs\E2B Utilities\LZMA\LZMA_Encode.cmd file. This will compress the file for faster loading, but it will not change the .IMA file extension.

You can cut-and-paste the lines of code that are displayed after conversion by GIFtoIMA, directly into your \_ISO\MyE2B.cfg file.
GIFtoIMA also saves a .txt file with the required code lines, e.g.

set ANIMFD3=/_ISO/horsedrawingKMG.ima
set last=6
# 1st param - use 0x90 for looping+transparent background, use 0x10 for opaque background
# 2nd param is delay (1\18th second), 3rd is last frame number, 4th is x pos, 5th is y pos (in pixels), 6th is path to first frame
set ANIMATE=0x10=3=%last%=575=225 (fd3)/E2B/horsedrawingKMG_frame_0001.bmp

You will need to change the position and delay parameters. For more details see blog post here.

 

KickMyGraphics

Use the free app KickMyGraphics to load (Add Graphics) and then save (Make animated GIF) a GIF in the correct format (use loopback mode=off).

KickMyGraphics
1. Load GIF
2. Loopback mode off
3. Check plays OK  (can adjust quality for large pictures). I suggest you don't change the size using this app.
4. Make Animated GIF (save file)
 
You can now convert it to an IMA file using GIFtoIMA.cmd.
 

Manual method

We need to find or make an Animated GIF file and then de-construct it into .bmp files.
 
1. Select a static picture that you want to animate. If you want to use a transparent background in E2B, the bottom-left pixel should be the 'transparent' colour.
For example, if the bottom left pixel has an RGB value of 0xFF0000 (pure red), then all pixels of that colour will be written as 'transparent' pixels.
 
Tip: If you want to make animated text, use Microsoft Paint to make a 2-colour (black&white) .bmp file. This will create a non-dithered image with just two colours. Then re-load and re-save it as a 24-colour bmp and change the colour of the letters to whatever colour you want. This will leave a plain background which is suitable for using with transparency.
Tip: You can use Google to find animated GIFs. Use Images - Tools - Size - Icon to find suitable ones
 
2. There are many web-based animated GIF makers, use Google to find one. I used Animizer.
 
Select the desired effect and choose the number of frames you want (use less than 20 if possible, max=255).
Make the .GIF file and download it.
 
3. I used IrfanView 4.41 to load the GIF file and then Options - Extract all frames to extract the frames as aaaaa-0001.bmp files (they will be in the correct format if you use IrfanView).
 
There are also many web-based sites that will convert .GIF files to a sequence of .bmp files, but you may have to rename the files because they must end in 001.bmp, 002.bmp, etc..  Some sites you may find useful for web-based extraction from a GIF file are herehere and here.
 
IMPORTANT: Many animated GIFs do not extract to the same size .bmp frames. After you extract the .bmp files, check that all frames are exactly the same dimensions or else the animation will jitter, leave remnants on the screen and won't work properly.
 
4. To reduce the size of the .bmp files and for faster loading, select all the files and then drag-and-drop them onto the \_ISO\docs\E2B Utilities\LZMA\LZMA_Encode.cmd file. This will compress all the .bmp files in one go, but will not change their file extension.

If you are going to make a .ima floppy disk image file (recommended - see below), then do not compress the .bmp files.
 
For the fastest animation, use uncompressed .bmp files rather than .jpg files, make a floppy disk image as below and then compress the .ima file using LZMA_Encode.cmd (you can find it in the \_ISO\docs\E2B Utilities\LZMA folder).
 
 

How to make a floppy disk image (.ima)

To make a floppy disk image containing the graphics frames, you can use WinImage or ImDisk.
Once you have made the .IMA image file, you can compress the .IMA file using LZMA_Encode.
 

WinImage (max 2.88MB)

1. Download and install WinImage
 
2. Click on File - New and choose a suitable size for the disk (max 2.88MB)
Choose a size just large enough to hold all the images.
 
3. Drag-and-drop the bitmaps onto the window
 
4. Save the file
 
 

ImDisk (for images larger than 2.88MB)

 
ImDisk is slightly more difficult to use, but you can make a floppy image of any size (small or large).
 
1. Install ImDisk (if not already installed)
 
2. Run ImDisk Virtual Disk Driver from the Start Menu - Programs menu (or click on it in the Windows - Control Panel) and choose Mount New...
 
3. Specify the filename and size of floppy image, etc. (see screenshot) and Format the new volume (Windows will pop-up a Format dialogue box for you).
 
4. Copy the bitmap files onto the new virtual drive (e.g. I:)
 
5. Select the Drive\Image in the ImDisk Control panel and click on Remove.
 
To reduce the file size, you can compress the .ima file using LZMA_Encode.
 
  1. Use the free app KickMyGraphics to save a GIF in the correc format.