bbbradsmith / binxelview

Binxelview binary image explorer
150 stars 10 forks source link

Binxelview binary image explorer

Version 1.6.4.0 2024-10-17 Brad Smith et al.

https://github.com/bbbradsmith/binxelview http://rainwarrior.ca https://patreon.com/rainwarrior

This is a relatively simple tool for making visual analysis of data in binary files. It is intended to find and visualize data that is organized in a grid within the file, to assist locating uncompressed graphical image, or tile based video game maps, or other appropriate data within the file.

This is not a generic image viewing tool, nor is it an editing tool. I wrote it to use as the first step in analyzing or reverse engineering unknown file formats, which might contain data that can be identified visually in a grid. Once the data is identified and located within the file, more work would follow with other appropriate tools.

Video demonstration: https://www.youtube.com/watch?v=3GAPvPCM-lg

Unstable preview builds: https://nightly.link/bbbradsmith/binxelview/workflows/build/master

Requirements

.NET 4 framework Windows XP SP3, Vista, 7, 8, 10

The .NET runtime can be downloaded here: https://www.microsoft.com/en-ca/download/details.aspx?id=17718

This project is open source, and might be compatible with other .NET frameworks, which could potentially enable use on other platforms.

Basic Use

Open a binary file that you wish to inspect. Choose an image data type preset from the preset menu. Use the scroll bar to scan through the file looking for data. Fine tune the packing parameters to bring the grid of data into alignment. Hover over the image to see information about each pixel.

The lower panel displays the current loaded binary file according to a chosen pixel format. The top left corner of the display will start at the byte/bit offset given in the Position panel.

Right click on an image for an option to save it to disk. If the pixels are 8-BPP or less, it will be saved as an indexed image.

Alt+0 - Return to position to the start of the file.

Alt+B - Advance the position by 1 byte. Alt+I - Advance the position by 1 bit. Alt+X - Advance the position by 1 pixel. Alt+R - Advance the position by 1 row. Alt+N - Advance the position by 1 image (or 16 rows if the image height is 1).

Shift+Alt+B,I,X,R,N - Retreat the position by 1 byte, bit, pixel, row, image.

Ctrl+O - Open a new file. Ctrl+R - Reload the current file. Ctrl+W - Toggle pixel window.

Pixel Formats

Presets can be loaded and saved. The Preset menu is populated from the directory of the executable, but this can be changed to another directory of your choice, which will be saved with your options.

Palette

If the BPP setting is 16 or lower, custom palettes can be used, otherwise an automatic one can be applied.

Custom palettes are 24-bit RGB triples (8 bits for each component). Click on a colour in the palette box to edit it.

If you are able to view a block of palette data in a file, you can quickly copy it to the palette. Right click on the first pixel of the block, and the palette will be generated with the colour of each pixel starting with that one. Note that this assumes contiguous pixel data, and will not account for row stride, next stride, or tiling. (Stride for row and next should be auto, tiling values should be 0.)

For example, using the 24BPP preset, you can view a saved palette file as coloured pixels. Right clicking on the first pixel, you can "load" this palette directly from the file. Similarly, the VGA Palette preset may be able to find palettes in a format commonly found in DOS games. After transferring the palette, you will need to select another preset to view other data in the file using that palette.

If using the Random automatic palette, the "Auto" button can be used to generate a new random palette.

Other Notes

Due to signed 32-bit integer limitations of C sharp, files must be less than 2GB in size. To inspect extremely large files, you may have to split them first.

Command Line Options and INI Configuration Files

To open a file, just add that file's path to the command line.

Options can be set with a command line argument beginning with '-', followed by the option name, an '=' separator, and the value for the option. If a space is required in the value, you should enclose the entire argument in quotes. Paths can be either absolute or relative to the current working directory. For an INI file, paths can be either absolute or relative to the INI file's directory.

"-ini=mysettings.ini" Loads an applies settings from another INI file besides the default. This option can only be used from the command line, and not within an INI file. If the save on exit option is enabled (see -saveini below), it will save to this file used with -ini, rather than the default location. (This only applies to the command line. INI files loaded from the Options menu do not become the save on exit file.)

-saveini=1 If this option is enabled (1) current settings will be saved back to the loaded INI when you quit. If this option is disabled (0) your current settings will not be remembered when you quit.

"-presetfile=C:\mypreset.bxp" Loads the current preset directly from a file, without adding it to the preset library.

"-preset=Atari ST 4BPP" Chooses a named preset from your preset library.

"-presetdir=C:\mypresets" Discards the preset library and reloads a new library from this directory only. If also using -preset or -presetfile, these options should come after -presetdir.

"-pal=my palettes\red.pal" Loads a palette file. If -paltype is not used (see below) it will detect the type by the file extension. If the extension is .BMP .GIF .PNG or .TIF it will load it as an palette from an image. If the extension is .VGA it will load it as 6-bit RGB18 format. If the extension is .RIFF it will load it as a Microsoft RIFF palette. Otherwise it will load it as RGB24.

-paltype=1 Overrides the extension check for the next -pal option. (Must be used before -pal.) 0 = RGB24, 1 = Image, 2 = VGA, 3 = RIFF, -1 = Use extension.

-autopal=Greyscale Chooses an automatic palette, one of: RGB - RGB with the current preset BPP, bits evenly divided with G bits >= R bits >= B bits. (Red is MSB.) Random - Every colour is randomized. Greyscale - Gradient from black to white. Cubehelix - Smooth gradient with rotating hue, created by Dave Green. See: https://people.phy.cam.ac.uk/dag9/CUBEHELIX/

-background=FF0088 Set the Background grid colour, uses a 6 digit hexadecimal RRGGBB value.

-zoom=3 Set the Zoom value.

-grid=1 Set the Grid Padding option (1 on, 0 off).

-hexpos=1 Set the Position byte display to use hexadecimal (1 hexadecimal, 0 decimal).

-snapscroll=1 Set the "Snap scroll to next stride" option (1 on, 0 off).

-splitview=1 Set the "Pixel Window" option to create a separate viewing window (1 on, 0 off).

-splitvieww=640 -splitviewh=480 Set the Pixel Window's width and height.

-horizontal=1 Set the layout option (1 horizontal, 0 vertical).

-twiddle=1 Set the twiddle option (0 off, 1 twiddle Z, 2 twiddle N).

INI files provide the same options as the command line, with minor differences:

If not overridden with the -ini command line option, Binxelview will look for Binxelview.ini. It will search 3 locations, checked in this order:

When save on exit is applied, options will be saved back to the first INI file that was found, or the INI selected from the command line -ini option. If no INI was found, it will try to create a default Binxelview.ini file in 2 possible locations, attempted in order. (Appdata is used as a fallback in case the executable is installed in a protected location like Program Files.)

Because save on exit is an option saved to the INI file, if you want to create a "read only" INI that gives you an unchanging default setup, turn off save on exit, then "Save Current Options" from the menu. This will save the current options now, since disabling that option will prevent them from being saved when you exit the program.

You can create "workspaces" for Binxelview by putting a Binxelview.ini, presets, etc. into a folder, then opening Binxelview with that folder as the current working directory.

Alternatively, you might use the -ini command line option to create a shortcut that applies a specific INI setup.

Changes

1.6.5.0 (unreleased beta)

1.6.4.0 (2024-10-17)

1.5.0.0 (2020-07-31)

1.4.0.0 (2019-04-25)

1.3.0.0 (2019-04-16)

1.2.0.0 (2019-04-14)

1.1.0.0 (2019-04-13)

License

This program was written by Brad Smith, with contributions from other authors. It is made freely available under the the terms of the Creative Commons Attribution license: https://creativecommons.org/licenses/by/4.0/

Source code is available at GitHub: https://github.com/bbbradsmith/binxelview

Author's website: http://rainwarrior.ca