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

Image conversion not working on Windows #318

Closed
amarcolini opened this issue Aug 6, 2024 · 6 comments · Fixed by #321
Closed

Image conversion not working on Windows #318

amarcolini opened this issue Aug 6, 2024 · 6 comments · Fixed by #321
Assignees
Labels
bug Something isn't working crate: cli Related to the CLI crate documentation Improvements or additions to documentation

Comments

@amarcolini
Copy link

(Slightly unrelated) I think for non-Mac users it would be beneficial to note that ImageMagick is required for image conversion somewhere in the documentation (or maybe the error messages). Also, maybe check for ImageMagick v7 before legacy versions. Windows has its own "convert" command that may get confused for ImageMagick. Another fix could be to make sure the convert command isn't in System32.

Attempting to export an iOS message database using -c compatible on Windows yielded these errors:

  • without ImageMagick: Unable to update "some_filename.jpeg" metadata: The system cannot find the file specified. (os error 2). This occurs with many files, but some attachments do get copied (excluding any .heic or .heif files). No conversion occurs.
  • with ImageMagick (no convert.exe): Same as without ImageMagick.
  • with legacy ImageMagick (with convert.exe): Same as without ImageMagick.

This doesn't seem to have to do with ImageMagick at all, since it doesn't change the behavior of the program

@ReagentX ReagentX self-assigned this Aug 6, 2024
@ReagentX ReagentX added bug Something isn't working crate: cli Related to the CLI crate labels Aug 6, 2024
@ReagentX ReagentX moved this to Todo in 2.1: Prickly Pear Aug 6, 2024
@ReagentX ReagentX added documentation Improvements or additions to documentation needs info More information required to diagnose and removed bug Something isn't working crate: cli Related to the CLI crate labels Aug 6, 2024
@ReagentX
Copy link
Owner

ReagentX commented Aug 6, 2024

  • I agree that the docs should mention this for Windows
  • Changing the order makes sense
  • However, I cannot replicate the issue you are reporting. Both magick and convert work when I modify the source code to force them on

An error like The system cannot find the file specified suggests that the files may be missing, not that the converter is causing the problem.

Can you share more about your platform and how you are running imessage-exporter? What is the output of imessage-exporter -d?

@amarcolini
Copy link
Author

amarcolini commented Aug 6, 2024

Here is the output for -d:

Handle diagnostic data:
    Contacts with more than one ID: 8
Message diagnostic data:
    Total messages: 140685
    Messages not associated with a chat: 3
Attachment diagnostic data:
    Total attachments: 7485
        Data referenced in table: 7.81 GB
        Data present on disk: 6.41 GB
    Missing files: 1010 (13%)
        No path provided: 1
        No file located: 1009
Global diagnostic data:
    Total database size: 40.00 KB
    Duplicated contacts: 32
    Duplicated chats: 6

I will also note that on version 1.9.0 of the CLI this issue doesn't occur, and regardless of whether ImageMagick is present imessage-exporter outputs "No HEIC converter found". I believe version 2.0.1 fixed finding executables on the system path for Windows, but it finds the built-in Windows convert, leading to the first two error messages. I still don't understand the last one, because running where convert outputs:

C:\Program Files\ImageMagick-6.9.13-Q16-HDRI\convert.exe
C:\Windows\System32\convert.exe

I'm using the latest version of the imessage-exporter CLI on Windows 11.

@ReagentX
Copy link
Owner

ReagentX commented Aug 6, 2024

Thank you for the details, I will look into this.

@amarcolini
Copy link
Author

Ok I seem to have found something. This answer points out that some Windows API for creating command processes checks System32 before the PATH variable, which would give the system convert priority over ImageMagick's. It could be that Rust uses this API internally to call commands.

@ReagentX
Copy link
Owner

ReagentX commented Aug 6, 2024

There indeed is some platform specific behavior here. See: #37519.

Given the name collision, I may need to remove the legacy support altogether.

@ReagentX ReagentX added bug Something isn't working crate: cli Related to the CLI crate and removed needs info More information required to diagnose labels Aug 6, 2024
@ReagentX ReagentX moved this from Todo to In Progress in 2.1: Prickly Pear Aug 6, 2024
@amarcolini
Copy link
Author

I can confirm the name collision. Renaming the Windows convert utility to something else causes image conversion to work as normal. All .heif and .heic files are converted to .jpeg (.mov files stay the same).

ReagentX added a commit that referenced this issue Aug 7, 2024
KevinPBurke pushed a commit to KevinPBurke/imessage-exporter that referenced this issue Aug 12, 2024
KevinPBurke pushed a commit to KevinPBurke/imessage-exporter that referenced this issue Aug 12, 2024
@ReagentX ReagentX mentioned this issue Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working crate: cli Related to the CLI crate documentation Improvements or additions to documentation
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants