I have installed emacs27 on windows from official release. when I run orgmode with inline image, the image do not resize according to width attribute (400 as below example)!

#+attr_org: :width 400
#+attr_latex: :width 400
#+attr_html: :width 400

enter image description here

Then I search orgmode source code and found below section (lisp/org.el):

(defcustom org-preview-latex-process-alist
     :programs ("latex" "dvipng")
     :programs ("latex" "convert")
     :description "pdf > png"
     :message "you need to install the programs: latex and imagemagick."
     :image-input-type "pdf"
     :image-output-type "png"
     :image-size-adjust (1.0 . 1.0)
     :latex-compiler ("pdflatex -interaction nonstopmode -output-directory %o %f")
     ("convert -density %D -trim -antialias %f -quality 100 %O")))
  :group 'org-latex
  :version "26.1"
  :package-version '(Org . "9.0")
  :type '(alist :tag "LaTeX to image backends"
        :value-type (plist)))

I have installed imagick.exe and the convert command should be "magick convert". I need to customize the image-converter to below line:

("magick.exe convert -density %D -trim -antialias %f -quality 100 %O")))

Is it possible to customize it in init.el file? Or any other proper way to call "magick.exe convert" instead of "convert"?


It is probably easier to use Customize on the variable: say C-h v org-preview-latex-process-alist, click on the customize link, scroll down to the ImageMagick section, find the :image-converter property and change its value; then save the customization for this and future sessions.

If you are intent on doing it manually, try the following in your init.el:

(with-eval-after-load 'org
    (cdr (assq 'imagemagick org-preview-latex-process-alist)) 
    :image-converter '("magick.exe convert -density %D -trim -antialias %f -quality 100 %O")))

Disclaimer: all this shows is how to change the property. I don't run Windows, so I have not tested the command itself.

  • Thanks, looks like (image-type-available-p 'imagemagick) return nil, then that logic has been skipped. I need to find a emacs with imagemagick enable! – lucky1928 Jan 2 at 17:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.