Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Canon Raw .CR2 file corrupted after ImageGlass saved rotation #1504

Closed
Davexx opened this issue Mar 9, 2023 · 3 comments
Closed

Canon Raw .CR2 file corrupted after ImageGlass saved rotation #1504

Davexx opened this issue Mar 9, 2023 · 3 comments
Assignees
Milestone

Comments

@Davexx
Copy link

Davexx commented Mar 9, 2023

System information:

  • Windows OS version: 11 Home 10.0.22621
  • ImageGlass version: 8.7.11.6 x64 [Portable]

To Reproduce

Steps to reproduce the behavior:
0. In settings > Edit: "Save the viewing image after rotating" is checked/on.

  1. Double-click an associated Canon Raw .CR2 file
  2. Rotate either left or right 90 degrees.
  3. move to the next image
  4. move back to the .CR2 image
  5. Error Message: "ImageGlass cannot open this picture because the file appears to be damaged corrupted or not supported." See screenshot (below) for full message.

Actual behavior:

The file has saved and is bigger, from 33,707,533 bytes ballooning to 84,555,210 bytes.
In ImageGlass, moving back to view the newly rotated .CR2 file displays the error message. See screenshot (below).

Expected behavior:

The newly rotated and saved file should not be corrupted and display in ImageGlass.
Image should be the same size, or within a few bytes.

Screenshots:

Image Glass Error Rotating and saving CR2 Canon RAW

Additional context:

Perhaps related to a 2021-06-14 issue: "Image (still) gets corrupted after rotating #1097"
[https://github.com//issues/1097]

@d2phap
Copy link
Owner

d2phap commented Mar 17, 2023

This issue should be fixed in the latest build of ImageGlass Moon 8.7: https://imageglass.org/moon.

The saving behaviors are also changed:

  • When user make a change to the viewing image, ImageGlass will show a warning message when they want to override it.
  • When user make a change to the viewing image and then exit the app, or view another image, ImageGlass will show a prompt to ask user if they want to save the change or not.

image

image

@Davexx
Copy link
Author

Davexx commented Mar 20, 2023

I checked with version 8.7.113.17 x64 Portable, and unfortunately the bug still exists.

  1. Rotating a ,CR2 180 degrees with Settings > Edit > Save the viewing image after rotating (Checked).
  2. Move to next image in the batch and I get the warning window.
    Image is saved, but,
  3. I still get the corruption notification.
  4. The 32MB .CR2 file still gets very large (87MB).

Pardon my lack of understanding regarding image file formats, but I thought there was two ways to "rotate" an image:

  1. A destructive rotate where the software completely maps the pixels and rewrites the entire file.
  2. A scripted, non-destructive rotate, where the software sets a rotate flag (90, -90, 180 degrees). The file is not overwritten, but the rotation instruction byte(s) are saved in the metadata.
    It's been a long time, but I think I recall that one of the reasons why ACDSee was so efficient, back in the day, was because it would use this method of "Rotating" images with a rotation flag.
    If this is indeed possible with .CR2 files, perhaps you could consider this powerful enhancement?

I read that the Canon .CR2 file is actually a TIFF image file under the hood, with a full sized JPEG "thumbnail" image in the header, as well as other smaller JPEG thumbnails, and some metadata. I don't know if the aforementioned style of non-destructive rotation is possible with these types of RAW files.

ImageGlass CR2 error

@d2phap
Copy link
Owner

d2phap commented Mar 20, 2023

Unfortunately, I will remove the save (override) image for the unsupported write formats which already documented here: https://imageglass.org/docs/supported-formats. I have tried, but it's getting complicated to make MagickNET detect the input format.

If user rotates then press Ctrl+S for the unsupported write formats (e.g. CR2, PSD,...), it will open "Save as..." dialog.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants