nbimg is a command line tool which allows to convert HTC Splash Screen images from NB to BMP and create NB splash screens from BMP format. Any splash screen size is supported (yes, it works for Diamond or Athena at 640×480 resolution too).
=== nbimg v1.1 === Convert NB <--> BMP splash screens === (c)2008 Pau Oliva - pof @ xda-developers Usage: nbimg -F file.[nb|bmp] Mandatory arguments: -F <filename> Filename to convert. If the extension is BMP it will be converted to NB. If the extension is NB it will be converted to BMP. Optional arguments: -w <width> Image width in pixels. If not specified will be autodetected. -h <height> Image height in pixels. If not specified will be autodetected. -t <pattern> Manually specify the padding pattern (usually 0 or 255). -p <size> Manually specify the padding size. -n Do not add HTC splash signature to NB file. -s Output smartphone format. NBH arguments: (only when converting from BMP to NBH) -D <model_id> Generate NBH with specified Model ID (mandatory) -S <chunksize> NBH SignMaxChunkSize (64 or 1024) -T <type> NBH header type, this is typically 0x600 or 0x601
Example to convert a NB to BMP:
$ ./nbimg.exe -F diamond137.nb === nbimg v1.1 === Convert NB <--> BMP splash screens === (c)2008 Pau Oliva - pof @ xda-developers [] File: diamond137.nb [] Image dimensions: 480x640 [] Encoding: diamond137.nb.bmp [] Done!
Example to convert a BMP to NB:
$ ./nbimg.exe -F diamond137.bmp === nbimg v1.1 === Convert NB <--> BMP splash screens === (c)2008 Pau Oliva - pof @ xda-developers [] File: diamond137.bmp [] Encoding: diamond137.bmp.nb [] Image dimensions: 480x640 [] Done!
Download
version 1.2+
- Ssource code: nbimg github page
- Windows / MacOS X / Linux versions: nbimg downloads
version 1.1
- Linux version (source code): nbimg-1.1.tar.gz
- Windows version: nbimg-1.1win32.zip
version 1.0
- Linux version (source code): nbimg-1.0.tar.gz
- Windows version: nbimg-1.0win32.zip
Hi Pau,
I found your nbbmp converter through XDA and came upon your blog here via Google. I was thinking about making a simple gui-based application to do a similar process, and was wondering two things.
1) How were you able to figure out the format details of the NB file type? Is there a specification somewhere or did you somehow reverse-engineer it.
2) If there isn’t a spec somewhere, would you be ok with my using your file as a reference in making my own application, if I do end up making it?
Thanks!
-Al
Hi,
1) no specs as far as I know, I reversed it using imagemagick but that was quite a long time ago and I can’t remember the specific details now.
2) feel free to use my source as a reference, no problem at all. The code is licensed under the GPL3.
On lines 430, 453, 461 of source v1.1 above, require the following changes:
430:
(-) sprintf(filename, optarg);
(+) sprintf(filename, “%s”, optarg);
453:
(-) sprintf(modelid, optarg);
(+) sprintf(modelid, “%s”, optarg);
461:
(-) sprintf(type, optarg);
(+) sprintf(type, “%s”, optarg);
Built in Ubuntu 10.10 x64.
Thank you so much =) Please add this fix to 1.2!
Sorry for being daft, but how do I run this in Linux?
You need to compile it first: gcc nbimg.c -o nbimg
When I convert 24bit image (Original http://yfrog.com/hskbrtp ), I got 24bit image that looks like 16bit image (Converted image http://yfrog.com/kjnlfp ).
Can you give me a favor, so I can deal with this problem?
Doesn’t work. Command not found even after compiling.
In linux I mean, tried both versions. Using ubuntu 10.10
Run it with ‘./nbimg’ instead of ‘nbimg’, because it is not in your $PATH.
Utilizing this utility (v1.1 on win7 enterprise) for an HTC splash image of 720×1280 and the utility crashes at the “No padding added. Check file size” step. Any thoughts? It will work on an iMac however….
Hey Evan, I just modified and compiled a new version that will work with 720×1280 on Windows HERE
Also modified to go from 720×1280 .nb to .bmp
Thanks Dan, I just uploaded nbimg to a github repo:
https://github.com/poliva/nbimg
It would be cool if you can contribute your modifications back into the source.
Ah, I just opened an issue on your github lol I’m kinda new to github, but I’ll do some hardcore forking action and send a pull request once I modify it again.
Thanks for the pull request! Your changes have been merged into 1.2.1
I’ve implemented a bunch of new resolution support in the github repo:
https://github.com/poliva/nbimg
Released version v1.2 on github
Program received signal SIGSEGV, Segmentation fault.
convertBMP2NB (input=, filename=, dataLen=, addhtcsig=1, smartphone=0,
padsize=0, pattern=255) at nbimg.c:136
136 encoded |= (int)(pixdata[1]>>2) << 5 ; //G
(gdb)
Hi, thanks for this tool! FYI, version 1.2.1 available on github do not work well on Windows 7. Original colors of the bmp are lost + the quality is lowered (for instance, a green HTC logo is changed to a yellow one with a lot of pixels visible).
Version 1.1 available on this page works correctly!
Hi Pau,
Thanks for the tool.
I have a conversion problem with it. I’m trying to convert a bmp file (24-bit) created with GIMP. The file looks perfect with an image viewer under Linux (Mint 15).
The img file obtained with your tool is not correct : the colors are different (purple instead of blue) and the image is off-centered (a band of the right side of the image end up on the left side of the pic…..)…
I’m using your tool without any height or width parameters since my file is already the good size.
Tried 1.1 and 1.2….
Any clues as to what I’m doing wrong ?
try specifying the width & height manually in the command line
Hello again,
Thanks for your answer. Tried what you said with both versions with no luck… Any other idea ?
Maybe I can send you the .bmp file I’m working on so that you can check that it’s correct ?
Thank you for your time.