私はSVG形式でQRコードを生成しようとしています。残念ながら、R qrencoder
パッケージはラスタ画像のみを生成する。 PNGなどです。したがって、これを最初に生成し、それを画面にプロットし、画面をキャプチャし、最後にSVGとして画面に書き込みます。おそらくこれを達成するためのより簡単な方法がありますか?QRをSVG形式で生成する方法は?
library(rsvg)
library(raster)
library(qrencoder)
library(svglite)
tmp <- tempfile()
svglite::svglite(tmp, width = 10, height = 7)
#==============================================
old_mar <- par()$mar
par(mar=c(0,0,0,0))
image(qrencoder::qrencode_raster("http://rud.is/b"), asp=1, col=c("white", "black"),
axes=FALSE, xlab="", ylab="")
par(mar=old_mar)
#==============================================
dev.off()
rsvg::rsvg_svg(tmp, "out.svg")
出力ファイルはQRコードを含むout.svg
です。しかし、最後の行rsvg_svg
を実行すると、次のエラーにつながる:
(process:733): GdkPixbuf-WARNING **: Cannot open pixbuf loader module file '/usr/local/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache': No such file or directory
This likely means that your installation is broken.
Try running the command
gdk-pixbuf-query-loaders > /usr/local/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache
to make things work again for the time being.
(process:733): GdkPixbuf-WARNING **: Cannot open pixbuf loader module file '/usr/local/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache': No such file or directory
This likely means that your installation is broken.
Try running the command
gdk-pixbuf-query-loaders > /usr/local/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache
to make things work again for the time being.
(process:733): GdkPixbuf-WARNING **: Cannot open pixbuf loader module file '/usr/local/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache': No such file or directory
This likely means that your installation is broken.
Try running the command
gdk-pixbuf-query-loaders > /usr/local/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache
to make things work again for the time being.
私はPIXBUFが正しくMacPortsの中に設置されていることを参照してください。
/var/root$ port installed | grep pixbuf
gdk-pixbuf2 @2.36.9_0+x11
gdk-pixbuf2 @2.36.11_0+x11 (active)
私は本当の問題が何であるか見当がつかないです... SVG形式でQRを生成する簡単な方法はありますか?おそらくより簡単なAPIは、好ましくは画面にプロットする必要はない、画面をキャプチャし、ファイルを保存し、それをリロードする?
は、そうでなければ誰もがこのエラーの修正を提案することができますか?
は、単純に何かがあるかもしれませんが、あなたは 'BMP'または** NetPBMの**' PGM'ファイルを生成するために 'qrencoder'を説得できるかどうか、あなたは' SVG'にそれを変換するために、 'potrace'を使用することができます。 'potrace'は** homebrew **から利用できます。 –
これを問題として投稿するか、このページに追加できますか?https://github.com/hrbrmstr/qrencoder/issues/5を作成しましたか?あなたの望む機能を明示的に述べると助けになります。 'magick'パッケージの出現により、' qrencoder'はコードリフレッシュを使用し、ディスクの往復の必要性を完全に緩和する可能性があります。 – hrbrmstr