abo-abo / org-download

Drag and drop images to Emacs org-mode
1.08k stars 79 forks source link

org-download.el (org-download-clipboard): Correct ImageMagick's executable name on Windows #199

Open archiif opened 2 years ago

archiif commented 2 years ago

On default installations of ImageMagick on Windows, executables such as convert.exe are considered a legacy feature (perhaps due to name collisions with system programs) and as such are not included unless the user asks for it during the installation. Instead, these utilities are treated as subcommands that can be accessed through magick.exe.

shelper commented 2 years ago

related https://github.com/abo-abo/org-download/pull/184

Infro commented 1 year ago

Why not just use powershell (Original idea from https://www.sastibe.de/2018/11/take-screenshots-straight-into-org-files-in-emacs-on-win10/)

((windows-nt cygwin)
            (if (executable-find "powershell")
                "powershell -command \"Add-Type -AssemblyName System.Windows.Forms;[System.Windows.Forms.Clipboard]::GetImage().Save('%s', [System.Drawing.Imaging.ImageFormat]::Png);\""
              (user-error
                "Failed to save image using powershell")))

; "powershell -command \"Add-Type -AssemblyName System.Windows.Forms;if ($([System.Windows.Forms.Clipboard]::ContainsImage())) {$image = [System.Windows.Forms.Clipboard]::GetImage();[System.Drawing.Bitmap]$image.Save('%s',[System.Drawing.Imaging.ImageFormat]::Png); Write-Output 'clipboard content saved as file'} else {Write-Output 'clipboard does not contain image data'}\""