ImHex icon indicating copy to clipboard operation
ImHex copied to clipboard

[Feature] visualize bytes as gray image

Open dianwoshishi opened this issue 2 years ago • 7 comments

What feature would you like to see?

I found a fun feature. We can convert the hex bytes to gray image! the texture of the binary file can reflect some properties of the software, like a similar malware family! how can I add this feature to this work?

I have developed a demo, just like this: image

How will this feature be useful to you and others?

this feature can summarise the binary file through the texture.

Request Type

  • [X] I can provide a PoC for this feature or am willing to work on it myself and submit a PR

dianwoshishi avatar Feb 07 '22 18:02 dianwoshishi

This is sort of already being worked on with the Image and Byte Distribution Visualizar Nodes introduced in 69c48edfdfd3e44aa9f10847d8f3063c22586896 and a48a1ef2724fb3871e4d57a783d63d53df695df9. You use them from the Data Processor panel.

manokara avatar Feb 07 '22 18:02 manokara

Yeah there has been some work in that direction with the data processor recently. A visualization like yours would absolutely fit in with those nodes as well. Alternatively a sort of minimap view where you can click onto to jump to various segments of the files would be really really cool

Here's a picture of my work:

WerWolv avatar Feb 07 '22 18:02 WerWolv

I believe minimap and raw image are similar but distinct features. Minimap is good for navigation, Raw image is good to figure out the format of known data (but unknown encoding).

OP demo has the width parameter crucial for raw image display. What I would like to see as well is a format for each pixel - number of bytes per pixel and their arrangement (ideally a bitmask per color channel, with some presets like rgba, argb).

By the way, maybe there is a way to manipulate the data with a separate block and send into a picture visualizer block? This way the implementation can be more generic but it will require more effort to configure the pipeline.

KillyMXI avatar Feb 07 '22 18:02 KillyMXI

oh, It's cool! thanks

dianwoshishi avatar Feb 07 '22 18:02 dianwoshishi

maybe a raw image node could be add into the visualizer of dataprocessor

minimap is a good feature,but i have no idea how to implement it,would you please gei some suggestions?

dianwoshishi avatar Feb 07 '22 19:02 dianwoshishi

I'd probably just make a view where that image data filles the entire content region and detect where on the image the user clicked. Top of the image corresponding to the start of the data, bottom corresponding to the end. You can use the RequestSelectionChange event to cause the hex editor view to jump to a certain address and select a number of bytes there:

EventManager::post<RequestSelectionChange>(Region { address, size });

WerWolv avatar Feb 07 '22 19:02 WerWolv

@dianwoshishi Would you mind to rename the issue to say the feature ? I sometimes browse through issues and I can never remember what this one is about

It would make it easier to be picked up by someone wanting to fix it, also

iTrooz avatar Aug 04 '22 17:08 iTrooz