Open xicubed opened 2 years ago
I'm pretty sure this is an Asciidoctor PDF issue. Asciidoctor PDF does not support reading webp files. Those files have to be converted to a format that the PDF generation library (Prawn) supports, which is jpg, png, and SVG. But we certainly could look into what would need to happen to support webp.
@mojavelinux - I agree that this is a Asciidoctor PDF issue. Could you please move this issue to that project?
This is technically an AsciidoctorJ PDF issue. That's because Asciidoctor PDF will support webp if you have prawn-gmagick installed. But not AsciidoctorJ PDF:
WARNING: could not embed image: image.webp; image file is an unrecognised format; install prawn-gmagick gem to add support
prawn-gmagick does not currently work with AsciidoctorJ PDF. So AsciidoctorJ PDF would need to provide something equivalent in order to support image formats other than what Prawn itself support (PNG, JPG, and SVG).
I tried to add the prawn-gmagick gem locally, but that doesn't seem to work. I am not sure what I have to do to make this gem building on my machine, even after installing graphicsmagick first. This is the error I get from JRuby:
current directory: /Users/robertpanzer/dev/asciidoctorj-pdf/asciidoctorj-pdf/build/.gems/gems/prawn-gmagick-0.0.9/ext/image
/Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home/bin/java -cp :/Users/robertpanzer/.gradle/caches/modules-2/files-2.1/org.jruby/jruby-complete/9.2.9.0/8e44ce7a1417966d89957bd766a148601e28828b/jruby-complete-9.2.9.0.jar org.jruby.Main -r ./siteconf20220428-43202-pd42cb.rb extconf.rb
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.headius.backport9.modules.Modules (file:/Users/robertpanzer/.gradle/caches/modules-2/files-2.1/org.jruby/jruby-complete/9.2.9.0/8e44ce7a1417966d89957bd766a148601e28828b/jruby-complete-9.2.9.0.jar) to method sun.nio.ch.NativeThread.signal(long)
WARNING: Please consider reporting this to the maintainers of com.headius.backport9.modules.Modules
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Errno::ENOENT: No such file or directory - No such file or directory
waitpid at org/jruby/RubyProcess.java:917
system at org/jruby/RubyKernel.java:1700
xsystem at uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/mkmf.rb:395
open at uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/mkmf.rb:320
xsystem at uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/mkmf.rb:384
pkg_config at uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/mkmf.rb:1790
<main> at extconf.rb:3
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=uri:classloader:/META-INF/jruby.home/bin/jruby
--with-GraphicsMagickWand-config
--without-GraphicsMagickWand-config
--with-pkg-config
--without-pkg-config
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/Users/robertpanzer/dev/asciidoctorj-pdf/asciidoctorj-pdf/build/.gems/extensions/universal-java-11/2.5.0/prawn-gmagick-0.0.9/mkmf.log
extconf failed, exit code 1
I could be wrong, but I'm almost certain that prawn-gmagick isn't compatible with JRuby. However, there is an image processing library for JRuby named ruby-vips that could be used to provide an equivalent gem. It could also be done using pure Java.
Here's what prawn-gmagick does: https://github.com/packetmonkey/prawn-gmagick/blob/master/lib/prawn/gmagick.rb (It just needs the decoded data from the image).
Observed vs. expected behavior
A webp image works fine until I export to a pdf and it doesn't show up. jpg works as expected.
Steps to reproduce
Put in an image say...
.Image caption image::LIGHTYEAR.webp["Lightyear movie 4 astronauts in a vehicle with cat and Lightyear driving", 400]
Hit the PDF button, a pdf is produced but the image doesn't show up. Even tried specifying the format... [format="webp","Lightyear.... but that didn't help.
Environment
macOS current versions of everything.
Plugin Version: 0.37.12
IntelliJ Details:IntelliJ IDEA 2021.3.3 (Ultimate Edition) Build #IU-213.7172.25, built on March 15, 2022
Runtime version: 11.0.14.1+1-b1751.46 x86_64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. macOS 12.3.1 GC: G1 Young Generation, G1 Old Generation Memory: 2048M Cores: 12 Registry: debugger.watches.in.variables=false
Non-Bundled Plugins: ski.chrzanow.foldableprojectview (1.1.2) org.toml.lang (213.5744.224) net.seesharpsoft.intellij.plugins.csv (2.18.2) in.xiv.cs (0.1) com.perl5 (2021.3.1) com.jetbrains.plugins.ini4idea (213.5744.190) com.jetbrains.plugins.asp (213.5744.122) com.intellij.ideolog (203.0.27.0) org.jetbrains.kotlin (213-1.6.10-release-961-IJ6777.52) org.jetbrains.erlang (0.11.1129) com.intellij.apacheConfig (213.5744.190) com.alayouni.ansiHighlight (1.2.4) org.asciidoctor.intellij.asciidoc (0.37.12) mobi.hsz.idea.gitignore (4.4.0) com.microsoft.vso.idea (1.162.0) com.perl5.lang.mason.framework (2021.3.1) com.perl5.lang.mason.mason2 (2021.3.1) com.cursiveclojure.cursive (1.12.1-2021.3) com.github.brcosta.cljstuffplugin (0.6.1) com.intellij.plugins.html.instantEditing (213.5744.122) com.jetbrains.php (213.7172.28) com.jetbrains.twig (213.5744.224) com.jetbrains.php.wordPress (213.5744.125) com.jetbrains.php.blade (213.6461.21) de.espend.idea.laravel (0.15.4) Pythonid (213.7172.26) ru.adelf.idea.dotenv (2022.1)
Kotlin: 213-1.6.10-release-961-IJ6777.52