Use the ICC profile for the monitor that the window is on

Ideas for improvements and requests for new features in XnView MP

Moderators: helmut, XnTriq, xnview

Posts: 6
Joined: Wed Jun 08, 2011 7:32 pm

Use the ICC profile for the monitor that the window is on

Post by jsXnv333 »

Right now enabling ICC profiles with the "System" option uses the default profile for the primary display, so if the window is on a different monitor the colors will be wrong. I would like to suggest instead using the profile for whatever display the window is on. This would be very useful for opening multiple instances of XnView to compare how an image looks on different displays at once, for example.

- Since it is probably too slow to check the monitor and possibly reload the image every time the window moves, I would be content with checking the monitor only when the image is loaded. So, for instance, the user could move the window to the desired display and press Ctrl+R to reload and apply the correct profile.

- For edge cases where the window is partially on multiple displays, I would settle for the easier solution of just using one of the profiles based on the display the window is "mostly" on. For example, the Win32 API provides the MonitorFromWindow ( ... fromwindow) function which "retrieves a handle to the display monitor that has the largest area of intersection with the bounding rectangle of a specified window". I am only familiar with Windows but if Mac OS or Linux provides similar API's you could use those.

- For edge cases where displays are added / removed / disabled etc. while XnView is running, I would be content with incorrect results until XnView is restarted. If it is easy to handle this condition somehow (e.g. reload the image if the OS provides a "displays changed" message or similar) that would be nice too.

I was curious to see how difficult it is to get the ICC profile from a window and, at least on Windows, it seemed fairly trivial using the GetICMProfileW ( ... cmprofilew) and MonitorFromWindow API's. I posted a very rudimentary sample to GitHub if it will help. ... Window.cpp