56

Just got a weird error. I was sent an image on email, opened the email in Outlook (Office 365 version) and double clicked image to open. I got this error:

"Windows Photo Viewer can't display this picture because there might not be enough memory available on your computer. Close some programs that you aren't using or free some hard disk space (if it's almost full) and then try again."

enter image description here

Few points:

  • I've always used photo viewer on this laptop and not had an issue before. I restarted and tried to open the image again but no luck.
  • The image is not corrupted. I saved to desktop, tried to open, same issue. I opened with Photoshop, that worked fine. I saved it down from PSD as a new JPG. The new JPG also displays the same message.
  • Any image I've tried to open results in this error.
  • The image is 200KB in size, res of 1428x2000.
  • My laptop has 32GB of RAM, and currently using 8GB of that according to task manager.

What I've tried:

This post from Microsoft: https://social.technet.microsoft.com/Forums/windows/en-US/7b6ae08b-4b5c-443b-9d43-e87ca5e7aeb1/wndows-photo-viewer-operation?forum=w7itproappcompat

  • This didn't work because when I get to colour management, I have no profiles set up so I can't delete.

I've seen this post: Windows Photo Viewer needs more ram?

  • I have 2 video cards built in: standard Intel(R) HD Graphics 530 and an Nvidia Quadro M1000M. I've tried the resolution in the post (moving it to different monitors powered by different video card) and nothing changed.

Disk clean up. Had plenty of spare space anyway but nothing changed.

Specs: I'm running Windows 10 v1909 Build 18363.535 on a Lenovo P50 laptop with 32GB memory, 500GB storage (currently 192GB free), Intel Core i7-6700HQ .

Appreciate if anyone can help fix this. The new Microsoft Photos app is absolutely terrible and I will avoid it at all costs.

7
  • Photo Viewer (the old one you showed above) has been deprecated and no longer part of a new Windows 10 Install. Can you use the newer Microsoft Photos (Photos in the Windows 10 menu)
    – anon
    Commented Dec 11, 2019 at 12:03
  • 2
    Hello @John - It's been deprecated for some time but it's still worked fine till today. As per my last comment I want to avoid the Photos app as I find it slow and not great to use.
    – AutoBaker
    Commented Dec 11, 2019 at 12:21
  • On an older version of Windows, I was able to get Photo Viewer working but it disappeared in V1903 or V1909. It is gone now, so I suggest using the current app. I have Windows 10 V1909 and it is working well
    – anon
    Commented Dec 11, 2019 at 12:24
  • Yep it disappeared ages ago. But it's still been there just hidden - little tweak of a registry key and you can use it as normal.
    – AutoBaker
    Commented Dec 11, 2019 at 13:48
  • 5
    I have an answer to this question and need a superuser to permit me to answer. The question is locked out to low ranking peasants like myself. The EASIEST solution is to open up the image in a hex editor such as Notepad++, navigate to 'ICC_PROFILE'. You will find this in the first line. Change the 'E' to an 'X', so it reads 'ICC_PROFILX' and save the file. Voila, you can now open your picture using Windows Photo Viewer. It works by preventing WPV from recognising and acting on this field.
    – IqbalHamid
    Commented Jan 21, 2021 at 2:49

6 Answers 6

28

I dig this issue because I had similar problem with photos exported from Android Send Reduced Free application.

This issue in my case is related to included Profile-icc in that JPG file.

  Profiles:
  Profile-icc: 536 bytes

It can be verified with ImageMagick identify -verbose command.

This is maybe not solution for Opening it right from Outlook but You can fix that files in source.

I've discovered that when I run convert BADFILE.jpg -strip GOODFILE.jpg command on that file it opens on Windows 7 Photo Viewer without any problem.

-strip  - strip image of all profiles and comments

You can get this whole tool here: https://imagemagick.org/script/download.php

So if You want make that all images again accessible just run batch on them:

mogrify.exe -format jpg -verbose -path C:\OUTPUT_DIR -strip *.jpg

Might be also used relative path like -path OUTPUT_DIR if You want them in subfolder.

If You have to open that files directly from Outlook I'd recommend for example IrfanView which does not have problem with opening that files. Just set it as default graphics files program.

Some people adviced something related to changeing default profiles in Your screen configuration, but I have it set to my Monitor type so I don't want to mess with that settings.

If You want this fully automatic You need 3 things:

  1. DefaultProgramsEditor ( https://defaultprogramseditor.com/ )
  2. ImageMagick ( https://imagemagick.org/download/binaries/ImageMagick-7.0.10-1-portable-Q16-x64.zip )
  3. Batch script which will process opened file.

1) First decompress ImageMagick to c:\apps\ImageMagick-7.0.10-1-portable-Q16-x64

2) Create batch script c:\apps\gfxopen.bat:

@echo off
C:\Apps\ImageMagick-7.0.10-1-portable-Q16-x64\convert.exe %1 -strip c:\temp\temp12345file.jpg

rundll32 "C:\Program Files\Windows Photo Viewer\PhotoViewer.dll", ImageView_Fullscreen c:\temp\temp12345file.jpg

del c:\temp\temp12345file.jpg

3) Decompress DefaultProgramsEditor and run it, then choose File Type Settings > Context Menu > find jpg extension, then > Add...

Command name: Open Fixed Image

Program path: "C:\apps\gfxopen.bat" "%1"

Then choose "Open Fixed Image" and press "Set selected command as default"

Then Save context menu

That's all :)

8
  • 1
    Is there any way to do strip the profile metadata like this using photoshop, windows cmd line, or a text editor (e.g. notepad++)? I have one photo that needs this fix and I'd rather not download a whole new program for it
    – ETL
    Commented Oct 1, 2020 at 18:26
  • This is small app and it does not require to be installed. I think that removing such data rather requires using specific application.
    – mike
    Commented Oct 4, 2020 at 20:26
  • 2
    Good to know. For a low-tech solution, I discovered you can just open the image in MS Paint then Save As a new jpeg (or file type of your choice). By using Save As, the metadata are not preserved.
    – ETL
    Commented Oct 6, 2020 at 13:36
  • I'm the developer of SendReduced. (1) Experiments show that the ICC profile is included in the jpeg whether or not the jpeg is sent as-is from the camera or reduced with SendReduced. So it's not a SendReduced problem. (2) No problem with opening such images with Win10's (hidden) Windows Photo Viewer, but the Win8.1 version does fail on them. So it's looking like a Microsoft problem resolved in Win10. (3) In a few days I will release a SendReduced Pro version with a Super Strip option that removes all data from a jpeg file other than the image itself, and that works around the problem. Commented May 18, 2021 at 18:01
  • The Paint trick from @ETL did not work for me. I saved as both a new JPG and a PNG, but when I opened either with Windows Photo Viewer I still got the error message.
    – Josh
    Commented Aug 20, 2021 at 23:24
22

I got the same issue and solved it following simple steps:

  • Open image file with Notepad++, or any other similar hex editors.
  • Find ICC_PROFILE inside the text and replace to ICC_PROFILX (generally on the first text line of file)
  • Save the edited file. That is all!

Before enter image description here After enter image description here

4
  • 1
    This actually works Commented Feb 14, 2022 at 14:31
  • 2
    This works for me. But it would be great if there is a permanent tweak on my Windows Photo Viewer instead.
    – elwc
    Commented Mar 11, 2022 at 3:06
  • This is my go to fix every time this comes up.
    – HippoDuck
    Commented Jun 6, 2022 at 9:53
  • This works great!
    – Harvey Lin
    Commented Jan 6 at 3:47
20

Type color in the windows startmenu search box and open the Colour Management.

"color" start menu search

Go then to the Advanced tab and select Agfa:Swop Standard for the Device Profile

Colour Management screen

6
  • 1
    This doesn't work for me.
    – elwc
    Commented Mar 11, 2022 at 3:04
  • Interesting, for me it helped on three different W10 computers. Commented Apr 3, 2022 at 16:49
  • 3
    Thank you!!! This worked for me: Windows 7, both JPG and PNG images.
    – NPS
    Commented Apr 9, 2022 at 15:50
  • It worked perfectly in my case. No need to change the color profile of the actual image as the accepted answer suggests
    – jajube
    Commented Nov 4, 2022 at 15:49
  • 1
    Thanks! It worked for me on Windows 7. The default device profile was "sRGB IEC61966-2.1" and changed it to "Agfa: Swop Standard" as per you solution. But is there any downsides/side effects? Commented May 31, 2023 at 7:55
5

Windows Photo Viewer has a bug where .jpg files made with invalid ICC profiles (such as Android 9+ screenshots) would render an error as you shown.

Someone actually took their time and patched the app accordingly. No need to install ICC profiles/modify JPGs. Source code, instructions and release app is in the link bellow:

https://github.com/PaaaulZ/PhotoViewerOutOfMemoryNoMore

3
  • 1
    While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - From Review Commented Sep 14, 2023 at 15:26
  • This is a github page and they never change unless the author deletes it, which is very rare. In that case, a user can just look up the archive.org page.
    – George
    Commented Sep 14, 2023 at 17:06
  • This worked great for me. Just needed to claim ownership of the file, before building and running the solution. X
    – TinyRacoon
    Commented Oct 17, 2023 at 9:41
4

I fixed this problem by unTick ICC Profile: sRGB when saving jpg with Photoshop.

See Properties of the image:

Photoshop Save As & Image Properties

3

For any Android developers who may come across this: Seems that Windows Photo Viewer doesn't like the ICC profile metadata that Bitmap.compress writes (maybe it doesn't like any ICC profiles actually? I haven't checked).

Here's a way to simply strip out that metadata segment from the JPEG file, which results in a JPEG that is compatible with Windows Photo Viewer again:

    // Some image viewer applications (such as Windows Photo Viewer) doesn't seem to like the ICC profile meta data that Android's Bitmap.compress writes.
    // This decorator removes the section.
    private static class RemoveFFE2OutputStreamDecorator extends OutputStream {
        OutputStream underlyingStream;
        boolean marker = false;
        boolean skipSegment = false;

        public RemoveFFE2OutputStreamDecorator(OutputStream underlyingStream) {
            this.underlyingStream = underlyingStream;
        }

        @Override
        public void write(int b) throws IOException {
            // Based on https://en.wikipedia.org/wiki/JPEG#Syntax_and_structure
            if (this.marker) {
                this.marker = false;
                if ((b & 0xFF) == 0xE2) { // The 0xFF,0xE2 segment that Android writes seems to cause trouble with Windows Photo Viewer.
                    this.skipSegment = true;
                } else {
                    this.skipSegment = false;
                    this.underlyingStream.write(0xFF);
                    this.underlyingStream.write(b);
                }
            } else if ((b & 0xFF) == 0xFF) {
                this.marker = true;
            } else if (!this.skipSegment) {
                this.underlyingStream.write(b);
            }
        }

        @Override
        public void flush() throws IOException {
            this.underlyingStream.flush();
        }

        @Override
        public void close() throws IOException {
            this.underlyingStream.close();
        }
    }
2
  • Hi, Whatever it is your code is doing, I wonder if it would be possible for me to do the same thing manually by opening up the image using NotePad++? If so, I would appreciate a brief translation of the above code to allow me to make the necessary amendment manually. Thank you.
    – IqbalHamid
    Commented Jan 21, 2021 at 1:34
  • From my reading, byte stuffing can only be counted on in the ECS data, so an FF E2 sequence can occur in some frames, such as the JFIF thumbnail, and that will screw up the code. I could be wrong about this. Commented May 18, 2021 at 15:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .