You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
Patch "Out of memory" exception when opening images containing an unknown color profile
Tested on:
Windows Vista Home PremiumWindows 7 Enterprise Version 6.1.7601 Service Pack 1 Build 7601Windows 10 Pro Version 1903 Build 18362.356Windows 10 Version 22H2 Build 19045.2486Windows 11 Pro 10.0.22000 build 22000
Why?
Why not?Windows Photo Viewer is EOL but i like it and a lot of people still use it. Besides, on a fresh install of Windows 7 you have nothing else to open images (except Paint).
Usage
Download the lastest release
Browse for ImagingEngine.dll
Press "Patch"
If you get an access denied error manually take ownership of the folder and give yourself full read and write permissions
Before you start
The DLL we need to patch (ImagingEngine.dll) is usually located in"C:\Program Files\Windows Photo Viewer\" or"C:\Program Files (x86)\Windows Photo Viewer\".I suggest patching both the x86 and x64 dll, most of the times Windows uses the x86 one even if you are in a x64 environment
Note that sometimes the antivirus may flag the .exe but it's a false positive and you can safely add it to the exclusions list.
How does it work?
When the image contains an unknown icc profile Windows Photo Viewer tries to perform color mapping by callingCreateMultiProfileTransform but fails, we can patch the check to ignore the invalid icc profile and move on.What happens if we ignore the invalid profile? Does it use the default one? I really don't know, I only know it starts working.
Changing the check from JNE to JMP opens the image correctly. Ignoring exceptions maybe but do we care? I think not.
Wanna make your own patch?
Open PhotoViewer.rundll32.exe [path to PhotoViewer.dll],ImageView_Fullscreen [path to image]
[path to PhotoViewer.dll] is usually"C:\Program Files\Windows Photo Viewer\PhotoViewer.dll" or"C:\Program Files (x86)\Windows Photo Viewer\PhotoViewer.dll"
[path to image] must not be quoted!
Attach your favourite debugger torundll32.exe
Select the loaded moduleImagingEngine.dll
Search for an intermodular call toCreateMultiProfileTransform
Change theJNE toJMP
Alternative method (patch the single image instead of the software)
You can edit the image with an hex editor like HxD and corrupt the color profile indication.Search for the stringICC_PROFILE and just change a random letter (for example make it ICC_aROFILE).You can now normally open the image on every computer without needing the patch
About
Windows Photo Viewer gives "Out of memory" error when opening images with unknown color profiles (like Xiaomi/Huawei screenshots). This will fix it