GithubHelp home page GithubHelp logo

kopaka1822 / imageviewer Goto Github PK

View Code? Open in Web Editor NEW
291.0 15.0 35.0 316.99 MB

HDR, PFM, DDS, KTX, EXR, PNG, JPG, BMP image viewer and manipulator

License: MIT License

C++ 11.57% C# 84.48% C 1.26% HLSL 1.91% Shell 0.77%
dds hdr ktx jpg filter image-viewer pfm cubemap png lat-long

imageviewer's Introduction

Image Viewer and Tonemapper

An image viewer for anyone related to computer graphics.

-> Getting Started Guide <-

File Formats

  • bmp, jpg, png, tga, gif
  • hdr, pfm, exr (import only)
  • dds, ktx, ktx2
  • numpy (integer and float types, import only)

Download

System Requirements:

Download the latest release from the Releases page.

Used Libraries

Build

If you want to build and debug the Image Viewer, follow the instructions here.

Features

View Modes

Simple Images

The status bar displays the current texture coordinates (cursor) along with the corresponding RGBA color values in linear color space. The display type can be changed from linear color space to Srgb color space via: View->Pixel Display->Format.

Images with multiple mipmaps and faces

Select a specific mipmap level and layer (face) of DDS and KTX textures and view cubemaps in projection or crossview:

Lat-Long Polar Images

View the raw polar image or look around in polar mode:

Lat-Long Cubemap Conversion

Convert between Lat-Long and Cubemaps with Tools->LatLong to Cubemap and Tools->Cubemap to LatLong. You can create a Cubemap or an arbitrary Texture2DArray from multiple images with File->Import as Array.

Side By Side Comparision and Image Manipulation

Compare up to 4 images side by side and use custom formulas to modify the displayed result. Additionally you can use the + and - Key to adjust the exposure.

I0 and I1 are the pixels from the first and the second image. sRGB values are in range [0,1] and you can combine them with following operators: * + - / ^. Numerical constants can be used as well. The detailed image equation guide can be found here.

Custom HLSL Compute Shader Filter

Filter are HLSL compute shader that can be imported by the ImageViewer. Only a single function needs to be implemented that will be called for each pixel of the image. User defined parameters can be set from within the GUI. Some filter, like the gaussian blur, are already implemented and can be imported via the filter tab:

An example for a simple gamma correction filter would look like this:

// general information about the shader
#setting title, Gamma Correction
#setting description, Nonlinear operation used to encode and decode luminance.

// define displayed name, variable name (for the shader), variable type, default value and optional minmum, maximum
#param Gamma, gamma, float, 1, 0
#param Factor, factor, float, 1.0, 0

// this function will be called once for each pixel
float4 filter(int2 pixelCoord, int2 size)
{
	float4 color = src_image[pixelCoord];

	const float invGamma = 1.0 / gamma;
	color.rgb = pow(abs(color.rgb * factor), float3(invGamma, invGamma, invGamma));
	
	return color;
}

The detailed filter guide can be found here.

3D Textures

3D textures can be displayed as well and are supported by the majority of image viewer features (export, custom filtering, mipmap generation and more). Simple flat shading and transparency rendering is also supported to help visualize certain datasets.

Additionally, one can explore the insides of a 3D texture by using the "Slice" feature:

For more on 3D textures see here.

imageviewer's People

Contributors

dependabot[bot] avatar jojendersie avatar kopaka1822 avatar mbas83 avatar sssooonnnggg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

imageviewer's Issues

Channel Selector / Separator Dropdown

Is your feature request related to a problem? Please describe.
For game asset research I am often faced with textures that included different types of information in separate channels of an image. For example, in the Unity engine standard shader, the roughness of the material is stored in the alpha channel of the metallic texture, or there are even further packed maps that include Ambient Occlusion, Metallicity, Specularity and Roughness into one picture, stored in the red, green, blue and alpha channel respectively.

Describe the solution you'd like
I would like to have a drop down or other kind of interface that allows me to explicitly only show a single channel as a greyscale picture so one can analyze the contents of such packed maps more efficiently. Oculante (another open source image viewer) has such a button, but it doesn't support all the exotic image formats (primarily DDS and BC5n) that I require for my research.
A simple dropdown or button interface that allows me to select RGBA, RGB, R, G, and B channels would make my life a lot easier, now that I have finally found an image viewer that can actually flawlessly open all the weird textures I am dealing with. Especially normal maps in the DDS format compressed with BC5n, that only have two channels, are finally able to be opened without having to convert them with texconv beforehand.

Describe alternatives you've considered
I have noticed that I can achieve this with the equations and the r(), g(), b(), and a() functions, but that is a lot of work compared to simply clicking a button, albeit it is quite useful for comparing the different channels to each other.

Additional context
here you can see the drop down from Oculante in the top left corner. The image viewer in the Blender 3D modeling software also has such a dropdown, but it's not exactly meant as a stand alone image viewer for quickly opening up images.
image

Why astc and etc2 looks different from orginal png?

Describe the bug
ASTC and ETC2 textures look different from orginal png

To Reproduce
use PVRTexToolGUI.exe to encode any png into astc (sRGB) (no mipmap) or ect2 (sRGB) (no mipmap), container is ktx.
in PVRTexToolGUI.exe, the encoded texture looks almost same as the original input png.
open the astc version in ImageViewer, it will looks much lighter
open the etc2 version in ImageViewer, it will looks much greener

8K Cubemap

Entering 8192 into field for latlong to cubemap and hitting ok causes program to exit. With the same texture, 4096 works and does not crash.

It would be great if I could produce a 8K cubemap from a 8K equirectangular image.

Great program btw, very useful and certaintly has great usable features! KTX & KTX2 support are top-notch!

Windows 10
NVIDIA Geforce 3060, latest drivers.

Thanks!

Export dialog generate default name (based on original file name)

If doing an export it would be much easier if the input filename would be used with a different file ending.
Since there is also the 'confirm overwrite' stuff I see no danger even if the file format is the same and the export name is the same as the input one. This would also resample a load/store cycle as common.

Add Ctrl+O for opening files

It's a standard feature of every program that has to open files to use keyboard gestures such as Ctrl+O. It would be nice to implement this for the ImageViewer as well.

Statistics broken

Average and Root Avg in the statistics window are extremely small (even smaller than the Min which should be impossible).

Logo

Hello mate, I want to contribute on your project. I made a logo for imageviewer. Here's the logo if you want to use it I can send PR or all files to use it.

imageviewer

KTX 1.1 load error "Attempted to divide by zero." Image Viewer v3.4

Describe the bug
When I try to load a .ktx file, I just get an error dialog "Attempted to divide by zero".

image

To Reproduce
Steps to reproduce the behavior:

  1. File / Open
  2. Load https://github.com/KhronosGroup/KTX-Software/blob/master/tests/testimages/hi_mark.ktx (tried a few others from https://github.com/KhronosGroup/KTX-Software/tree/master/tests/testimages, which failed too)
  3. See dialog "Attempted to divide by zero."

Expected behavior
It opens the file, as it's evidently KTX 1.1 format (not KTX 2.0):
image

Desktop (please complete the following information):

  • OS: Windows 10 20H1 19043.1110 x64
  • Version: Image Viewer 3.4 x64
  • GPU: NVidia Quadro P400
    I tried v3.3 for comparison, and it instead says "HRESULT: [0x80070057], Module: [General], ApiCode: [E_INVALIDARG/Invalid Arguments], Message: The parameter is incorrect.".

I don't have C# installed at the moment for Visual Studio, just C++, but if you need a stack, I can try to build the project.

[update] I see the error happens with DDS files too, but not PNG or JPEG.

3.5 download zip is tagged with a virus

Describe the bug
When trying to download the 3.5 version of the ZIP, Windows/Chrome won't allow it to be downloaded, saying it contains a virus.

To Reproduce
Steps to reproduce the behavior:

  1. Go to https://github.com/kopaka1822/ImageViewer
  2. Click on https://github.com/kopaka1822/ImageViewer/raw/Release/Build/ImageViewer3_5.zip
  3. See error

Expected behavior
3.5 downloads correctly and virus free.

Screenshots
If applicable, add screenshots to help explain your problem.
image

Desktop (please complete the following information):

  • OS: Windows 10

Additional context

Missing key binding for Gamma correction

For gamma correction, only the numpad +/- work, which is detrimental especially on notebooks which do not have a numpad. To solve this, an additional binding for regular +/- seems desirable.

Add shortcut to turn off/on alpha channel and shortcut to show Alpha channel only.

Is your feature request related to a problem? Please describe.
its not related to any problem.
Add shortcut to see texture in RGB mode (turn off Alpha channel)
Add shortcut to see texture in Alpha only mode (trun off RGB channel)

Describe the solution you'd like
just like XnView
press 'M', xnview will display alpha channel only ('M' means Mask, i guess)
press 'M' again, xnview ill restored to its previous display mode.
press Ctrl + 'H', turn off textures alpha channel.

PFM image with not-a-one scale is not displayed properly.

Describe the bug

If I generate grey-scale PFM with third parameter being different from 1, image in the viewer won't change

e.g.

Pf
100 100
-1.0
.....

will be displayed the same as

Pf
100 100
-5.0
.....

To Reproduce
Make simple PFM grey-scale with scale = 1. Display it. Change scale from -1 to -5. Same display

Expected behavior
Display should behave same was as if I multiplied data array by 5.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: Windows 10 x64
  • Version: 3.4

Additional context
Add any other context about the problem here.

Avg statistics

Use 1/3 weight for all channels in the stastics tab. Since there is a choice anyway, this does not break perception stuff. However, using pure average is better for algorithmic analysis where color is irrelevant.

ImageConsole.exe using float as a filterparam

Describe the bug
When you try to use a filter parameter with a dot number, the tool will try to convert in to a int.

To Reproduce
.\ImageConsole.exe -open .\<ktx file> -addfilter .\Filter\gamma.hlsl -filterparam 0 Gamma 0.5 -export .\<pngfilename>.png RGBA8_SRGB

Expected behavior
I expected thats i can use float as a filter param

Screenshots
Error message:
could not convert "0.5" at index 2 to integer

Desktop (please complete the following information):
Windows 10

Additional context
The problem is in the file FilterParameterCommand.cs in the line 31. You try to read in as int not as a float. I fix it locally and test it.
Problemcode block

case ParameterType.Float:
  fp.GetFloatModel().Value = reader.ReadInt("value");
  break;

Fixedcode Block

case ParameterType.Float:
  fp.GetFloatModel().Value = reader.ReadFloat("value");
  break;

Format information

It would be nice if the status bar could display some information about the image format (e.g. is it RGB9E5)

KTX Cubemap export

I believe, your KTX(1.0) exported for cubemaps has some bug.

According to the specification 2.16:

For most textures imageSize is the number of bytes of pixel data in the current LOD level.
This includes all array layers, all z slices, all faces, all rows (or rows of blocks) and all pixels (or blocks) in each row for the mipmap level. It does not include any bytes in mipPadding.

The exception is non-array cubemap textures (any texture where numberOfFaces is 6 and numberOfArrayElements is 0). For these textures imageSize is the number of bytes in each face of the texture for the current LOD level, not including bytes in cubePadding or mipPadding.

But your exporter writes imageSize as number of bytes in 6 faces of the texture for the current LOD level.

Do not delete equations

Currently deleting an image, or enabeling an equation using a non-existent image deletes the equation. On the other hand it is possible to type a wrong equation without problems.
-> simply keep the equations and do not evaluate them in the above to cases. If someone presses the apply button the current error message will appear and the user can decide what to do with the equation.

  • maybe one could draw a red edge around a wrong equation (always, including if typing new ones). An error message would maybe not even necessary in this case. It would be possible to show the error on mouse-over of a wrong equation.

Port to macOS or Linux

Is your feature request related to a problem? Please describe.
I need a tool for viewing & editing .ktx2 textures including comparing images compressed with varying compression parameters. I need it to run on macOS.

Describe the solution you'd like
I'd like ImageViewer ported to macOS and Linux.

Describe alternatives you've considered
Add ktc2 support to Compressonator but I've been reliably informed the code base is not of sufficient quality for basing a professional product on it.

Additional context
Do you any plan to or interest in porting ImageViewer?

Lock alpha equation

Minor priority improvement.

Use a lock symbol to make the alpha equation match the RGB equation. Default is locked. Only allow typing in the alpha equation if the lock is explicitly released.
I have observed people to always edit both equations -- even if there is no alpha channel. And even if there is an alpha channel the wanted default behaviour is likely a copy.

Crashes on loading sample KTX file

3D rendering library "LOVR" includes a file ibl.ktx in its samples.

https://github.com/bjornbytes/lovr-docs/tree/v0.16.0/examples/Lighting/PBR_Materials

This was created from filament's "cmgen" app.

When ibl.ktx is opened in ImageViewer using FIle->Open, ImageViewer crashes (suddenly closes). There are no error messages.

Expected behavior

The file is probably legitimate. But if it is not valid ImageViewer should at least display an error message rather than crashing..

Desktop (please complete the following information):

  • OS: Windows 10.0.19045
  • Version: ImageViewer3_6_lite.zip from the Version 3.6 release on the Github page.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.