Powertoys: Image Resizer - Value does not fall within the expected range

Created on 28 Apr 2020  路  27Comments  路  Source: microsoft/PowerToys

image resizer if throwing me this error when I try resizing pic take w/ my S10 Plus. seems to work fine w/ other images. I tried uninstalling & installing the old non-powertoys individual version & I'm getting the same error.

dimension of the original pic are 4032x1908

pt-error

Issue-Bug Priority-2 Product-Image Resizer

Most helpful comment

I suspect the issue is due to the file contains that short video preview

All 27 comments

@SFNMutt, can you give us one of the images? take one of grass or the wall. Just want to be sure we have an image that is known to cause an issue

sure, I just updated to .17 & still have the problem. it's w/ every photo I take w/ my galaxy S10+.

2020-05-08 12 26 27

Thanks, i'm assuming .19 will be filled with stability fixes so i'm marking with for .20 release

unless @bricelam has some spare cycles :)

thanks! been using this for years and install on everyone's PCs.

Commenting to mention I'm experiencing the same issue but more importantly, thank the team that's been supporting this tool. I've been using it for years as well and really appreciate your continued development and support!

thank you for reporting the issues :)

Possibly a limitation of the WIC codec not handling something about the image. After opening the image in Paint and saving, Image Resizer works just fine.

ok, this is most likely a windows 10 issue. I'm getting a similar error when using the photos app to crop photos. I'm only having this error with photos from my S10+ & it doesn't matter how I transfer them to the PC. (drobox, email, or usb cable)

OppsWeCouldntSaveThatOne

I tried on more than 1 PC & had the same issue.

On my S10+ I switched to google camera & used that instead of the built in samsung camera and those photos don't have this issue. it's only when using samsung's camera app.

i went into the samsung camera app and "reset settings". new photos work now. I'm not sure what the offending setting might have been.

i went into the samsung camera app and "reset settings". new photos work now. I'm not sure what the offending setting might have been.

Can confirm. Was also using a Samsung, model S10 5G. Reset camera settings and pictures resize accordingly. I've never changed the settings aside from zooming in and out and wouldn't have thought of this. Must have been something they updated recently. Thanks @SFNMutt for updating the post with a resolution!

we can go in and see if we can't be more resilient.

image resizer if throwing me this error when I try resizing pic take w/ my S10 Plus. seems to work fine w/ other images. I tried uninstalling & installing the old non-powertoys individual version & I'm getting the same error.

dimension of the original pic are 4032x1908

pt-error

Tried unchecking make pictures smaller but not larger?

I opened photos in Paint, saved them as png. Then I could right click and choose Resize image in Windows explorer afterwards.

I suspect the issue is due to the file contains that short video preview

Hi,

I have same issue. same error.

version 0.20.1

Did anybody find a solution?

Hi,
I have same issue. same error.
version 0.20.1
Did anybody find a solution?

Are you using a Samsung phone to take the pictures? I resolved this by going into the camera app --> Clicking the Gear --> Click Reset Settings. Even though I hadn't changed any settings previously, this resolved it for me.

@OndrejL81 we haven't had time to investigate the issue yet.

getting same issue with version 022, photo taken with Samsung Note 10+ 5G, using with tool many years (from Vista time) and now cant used it :( so very sad

This problem also occurs with every JPG file generated by the ON1 Photo Raw program, including both the 2020 and 2019 versions of that program. I assume you could download a trial version of the program and generate a JPG file to confirm (https://www.on1.com/products/photo-raw/download/). If it matters (probably not, but...?), I generate JPG files from Sony RAW (ARW) files.

It appears to be caused by an ArgumentException that occurs when cloning the metadata to the new BitmapFrame. I was able to workaround the issue by attempting to clone the metadata inside a try-catch block and then passing a null metadata into BitmapFrame.Create if it fails. It enables you to successfully resize the image, but you lose the metadata for images with this issue. I'm happy to submit a PR with the change, but I suspect the loss of metadata would make it unacceptable.

Thanks for the post, tonymitchell. I am not sure which specific problem you're discussing - whether it's the problem overall, in phones and etc., or the problem specific to ON1. My thoughts are that it would be best if the reason why an ArgumentException is being thrown. I don't know which programming product you're using however, so I don't know how difficult that might be for you. But that would seem "the right way" to fix the problem.

That said, I do not see the loss of metadata as an overriding concern. Remember that resized images are often temporary, generated for emails and etc. And that the original photo =typically= remains on the system. I often delete the resized pics when I am finished with them. In the case of ON1, the in addition to the JPG file likely remaining on the system unaltered, the original RAW file certainly remains on the system, forever unaltered. In fact, discarding metadata might even be argued as a feature, that is, to the extent it might result in a smaller file.

The solution you propose would certainly make Image Resizer work for me again. Which is to say, it does not work for me at all, at present. It simply leaves empty or corrupt files in its wake, whenever I try to run it.

Another possibility occurs to me, maybe. If you're getting an ArgumentException, then I'm guessing you're actually trying to =parse= the metadata, bit by bit, byte by byte. Maybe that's actually required, I dunno. But if that's what's being done, then it seems at least conceptually possible (to me) to "block copy" the metadata, assuming you can determine the size of the metadata in the source file. I am not sure that you would need to modify many metadata items. Width and height, perhaps, but probably not much more than that. Unless you might be adding a comment that it's gone through image resizer.

No worries. Just my random late night thoughts. I'd be happy with any kind of "fix" that would make the program work for me again, including the one you propose. :)

Lets do the PR and give a file that fails. Let's see if we can't try a different method then to inject it back in.

I've submitted a PR. It seems like the underlying image libraries are trying to copy the entries one by one and running into a type of metadata entry that they don't know how to handle.

The error processing the metadata doesn't seem to be limited to the Image Resizer tool. If I try to edit the tags via the Details tab in the file Properties dialog of Windows Explorer I get a similar error:
image

I suspect the underlying issue here is in the BitmapMetadata library. The exception thrown when I attempt to clone the metadata is in the SetQuery method:
at System.Windows.Media.Imaging.BitmapMetadata.SetQuery(String query, Object value)
at System.Windows.Media.Imaging.BitmapMetadata.CopyCommon(BitmapMetadata sourceBitmapMetadata)
at System.Windows.Freezable.Clone()

Despite the issue, I can access most metadata values, so the suggestion to copy at least some values does seem feasible.

1928 also involves piecemeal copying of metadata. It might be work thinking about that feature while fixing this issue.

we want to not nuke meta data on failure to copy. Code base currently does this so it won't fail to resize

Was this page helpful?
0 / 5 - 0 ratings