org-download icon indicating copy to clipboard operation
org-download copied to clipboard

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

Open archiif opened this issue 3 years ago • 2 comments

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.

archiif avatar Apr 25 '22 01:04 archiif

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

shelper avatar Apr 27 '22 18:04 shelper

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'}""

Infro avatar Nov 29 '22 00:11 Infro