homebrew-emacs-plus icon indicating copy to clipboard operation
homebrew-emacs-plus copied to clipboard

Images are not rendered. Imagemagick issue

Open fkgruber opened this issue 2 years ago • 9 comments

I installed emacs 27 with brew install emacs-plus@27 --with-modern-orange-icon --with-xwidgets

I can't open any images files. They are blank. Images embedded on orgmode are also blank.

the Message buffer gives error:

ImageMagick error: UnableToOpenFile '/var/folders/_w/dcs87wy950b8bsf1ftp8w39nbjnl50/T/magick-CvuAudv07yXwfleoAGagJBzGdr4EJfd3': No such file or directory @ error/constitute.c/ReadImage/612
ImageMagick error: NoDecodeDelegateForThisImageFormat `PNG' @ error/constitute.c/ReadImage/572 [7 times]

Output of brew config

$ brew config
HOMEBREW_VERSION: 3.2.13
ORIGIN: [email protected]:Homebrew/brew.git
HEAD: 109f24fd601177dea4a754b43efe684903db2a83
Last commit: 13 hours ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 3416ef2e31ed976f16f297700facd666a9ca3950
Core tap last commit: 17 minutes ago
Core tap branch: master
HOMEBREW_PREFIX: /Users/fred/brew
HOMEBREW_REPOSITORY: /Users/fred/brew
HOMEBREW_CELLAR: /Users/fred/brew/Cellar
HOMEBREW_CASK_OPTS: []
HOMEBREW_DISPLAY: /private/tmp/com.apple.launchd.QLmWIV0dFE/org.xquartz:0
HOMEBREW_EDITOR: emacs
HOMEBREW_MAKE_JOBS: 12
Homebrew Ruby: 2.6.3 => /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby
CPU: dodeca-core 64-bit kabylake
Clang: 12.0.5 build 1205
Git: 2.30.1 => /Applications/Xcode.app/Contents/Developer/usr/bin/git
Curl: 7.64.1 => /usr/bin/curl
macOS: 11.6-x86_64
CLT: 12.5.1.0.1.1623191612
Xcode: 12.5.1

Output of brew doctor

$ brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!

Warning: Suspicious https://github.com/Homebrew/brew git origin remote found.
The current git origin is:
  [email protected]:Homebrew/brew.git

With a non-standard origin, Homebrew won't update properly.
You can solve this by setting the origin remote:
  git -C "/Users/fred/brew" remote set-url origin https://github.com/Homebrew/brew

Warning: "config" scripts exist outside your system or Homebrew directories.
`./configure` scripts often look for *-config scripts to determine if
software packages are installed, and which additional flags to use when
compiling and linking.

Having additional scripts in your path can confuse software installed via
Homebrew if the config script overrides a system or Homebrew-provided
script of the same name. We found the following "config" scripts:
  /Users/fred/anaconda3/bin/icu-config
  /Users/fred/anaconda3/bin/freetype-config
  /Users/fred/anaconda3/bin/python3.6m-config
  /Users/fred/anaconda3/bin/libpng-config
  /Users/fred/anaconda3/bin/python3-config
  /Users/fred/anaconda3/bin/ncursesw6-config
  /Users/fred/anaconda3/bin/pcre-config
  /Users/fred/anaconda3/bin/python3.6-config
  /usr/local/bin/python3.9-config
  /usr/local/bin/python3-config

Warning: Unbrewed dylibs were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected dylibs:
  /usr/local/lib/libtcl8.6.dylib
  /usr/local/lib/libtk8.6.dylib

Warning: Unbrewed header files were found in /usr/local/include.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected header files:
  /usr/local/include/fakemysql.h
  /usr/local/include/fakepq.h
  /usr/local/include/fakesql.h
  /usr/local/include/itcl.h
  /usr/local/include/itcl2TclOO.h
  /usr/local/include/itclDecls.h
  /usr/local/include/itclInt.h
  /usr/local/include/itclIntDecls.h
  /usr/local/include/itclMigrate2TclCore.h
  /usr/local/include/itclTclIntStubsFcn.h
  /usr/local/include/mysqlStubs.h
  /usr/local/include/odbcStubs.h
  /usr/local/include/pqStubs.h
  /usr/local/include/tcl.h
  /usr/local/include/tclDecls.h
  /usr/local/include/tclOO.h
  /usr/local/include/tclOODecls.h
  /usr/local/include/tclPlatDecls.h
  /usr/local/include/tclThread.h
  /usr/local/include/tclTomMath.h
  /usr/local/include/tclTomMathDecls.h
  /usr/local/include/tdbc.h
  /usr/local/include/tdbcDecls.h
  /usr/local/include/tdbcInt.h
  /usr/local/include/tk.h
  /usr/local/include/tkDecls.h
  /usr/local/include/tkPlatDecls.h

Warning: Unbrewed '.pc' files were found in /usr/local/lib/pkgconfig.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected '.pc' files:
  /usr/local/lib/pkgconfig/tcl.pc
  /usr/local/lib/pkgconfig/tk.pc

Warning: Unbrewed static libraries were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected static libraries:
  /usr/local/lib/libtclstub8.6.a
  /usr/local/lib/libtkstub8.6.a

Warning: Your Homebrew's prefix is not /usr/local.
Some of Homebrew's bottles (binary packages) can only be used with the default
prefix (/usr/local).
You will encounter build failures with some formulae.
Please create pull requests instead of asking for help on Homebrew's GitHub,
Twitter or any other official channels. You are responsible for resolving
any issues you experience while you are running this
unsupported configuration.


Warning: /usr/bin occurs before /Users/fred/brew/bin in your PATH.
This means that system-provided programs will be used instead of those
provided by Homebrew. Consider setting your PATH so that
/Users/fred/brew/bin occurs before /usr/bin. Here is a one-liner:
  echo 'export PATH="/Users/fred/brew/bin:$PATH"' >> /Users/fred/.bash_profile

The following tools exist at both paths:
  pp
  python3
  pip3

thanks FKG

fkgruber avatar Sep 20 '21 14:09 fkgruber

Oh my. In case you installed Emacs+ some time ago and then did run brew upgrade, you might need to reinstall Emacs+, because ImageMagick was updated (and for some reasonbrew didn't enforce recompilation of Emacs+ :shrug: ). And by reinstall I mean brew uninstall emacs-plus followed by brew install emacs-plus [your-options]. Do not use brew reinstall command.

d12frosted avatar Sep 20 '21 14:09 d12frosted

Ok I tried:

brew uninstall emacs-plus
brew upgrade
brew install emacs-plus@27 --with-modern-orange-icon --with-xwidgets

PNG and JPG are working now but SVG still gives problem: Opening a SVG I get: ImageMagick error: must specify image size `/var/folders/_w/dcs87wy950b8bsf1ftp8w39nbjnl50/T/magick-NcZBgepTosekSswYPrRmyIaVxR3BuPQi' @ error/mvg.c/ReadMVGImage/186

fkgruber avatar Sep 20 '21 15:09 fkgruber

This seems to be related to. imagemagick:

convert tst.svg tst.pdf
convert: must specify image size `/var/folders/_w/dcs87wy950b8bsf1ftp8w39nbjnl50/T/magick-GsdZ3V7-4U9uNBbt0s-jEqxXyRsgdAuC' @ error/mvg.c/ReadMVGImage/186.
convert: no images defined `tst.pdf' @ error/convert.c/ConvertImageCommand/3322.

any idea what my be causing this?

fkgruber avatar Sep 20 '21 16:09 fkgruber

This works: convert -size 568x604 tst.svg tst.pdf

so it seems that the current version of convert requires you to specify the image size for svg files.

fkgruber avatar Sep 20 '21 16:09 fkgruber

It is very strange the list of delegate clearly shows that it is using rsvg-convert to do the transformation

fred$ convert -list delegate |grep svg

        cdr =>          "@UniconvertorDelegate@' '%i' '%o.svg'; /bin/mv '%o.svg' '%o"
        cgm =>          "@UniconvertorDelegate@' '%i' '%o.svg'; /bin/mv '%o.svg' '%o"
        dot =>          "dot' -Tsvg '%i' -o '%o"
        dxf =>          "@UniconvertorDelegate@' '%i' '%o.svg'; /bin/mv '%o.svg' '%o"
        fig =>          "@UniconvertorDelegate@' '%i' '%o.svg'; /bin/mv '%o.svg' '%o"
        pnm<= trace     "potrace' --svg --output '%o' '%i"
        svg =>          "rsvg-convert' -o '%o' '%i"

and this works if I call it directly rsvg-convert -o tst2.png tst.svg

fkgruber avatar Sep 20 '21 17:09 fkgruber

After further research it seems that some svgs work while other don't. SVGs that are missing the viewport do not work. The weird thing is that when I tried emacs-mac homebrew the same svg works fine. I'm not sure how they did it. FKG

fkgruber avatar Sep 21 '21 00:09 fkgruber

@fkgruber nice investigation 🕵️ Could you please send me an example SVG so I can check this. I do preview images in Emacs, but SVG support was always clunky, so I don't use it for that.

The weird thing is that when I tried emacs-mac homebrew the same svg works fine. I'm not sure how they did it.

They are using different renderer, which I guess tolerates stuff like this.

d12frosted avatar Sep 21 '21 05:09 d12frosted

I'm interested in rendering SVG to include handwritting content to my org-roam notes: handwriting

I'm attaching 2 svgs. The Yin_yang.svg should work fine. I then removed the viewport from it and saved it as yinyang2.svg. That one does not work for me. Can you replicate that behavior?

svgimage.zip

fkgruber avatar Sep 21 '21 12:09 fkgruber

I can replicate this issue with Emacs installed via brew install emacs-plus@28: Yin_yang.svg displays fine, while yinyang2.svg doesn't display. With Emacs installed via brew install emacs-mac both display but only the lower right quarter of yinyang2.svg is shown (as is the case in macOS quicklook).

orgtre avatar Nov 07 '22 18:11 orgtre