【笔记】比较好看的配图的上传随笔
个人生成图片的通常流程
TeX Live,启动!
打开 VS Code,小写一下代码,
\documentclass[border=10pt,tikz]{standalone}
\usepackage{tikz}
\usetikzlibrary{graphdrawing, graphs, shadows}
\usegdlibrary{trees}
\begin{document}
\begin{tikzpicture}[
rd/.style = {
draw = black,
fill = red,
font = \color{white}\bf,
circle, minimum size = .8cm,
drop shadow
},
bk/.style = {
draw = black,
fill = black,
font = \color{white}\bf,
circle, minimum size = .8cm,
drop shadow
},
nl/.style = {
draw = black,
fill = black!80,
font = \color{white}\sf,
rectangle,
minimum width = .4cm,
minimum height = .4cm,
drop shadow
},
ti/.style = {
draw = orange,
fill = orange!30,
isosceles triangle,
inner sep = 0,
anchor = apex,
minimum height = 2cm,
minimum width = 1cm,
shape border rotate = 90
}
]
\clip (-7, -8) rectangle (7, 0.5);
\graph[
binary tree layout,
level distance = 1.5cm,
sibling distance = 0.6cm
]{
21[bk] -- {
6[bk] -- {
3[bk] -- {
t1[nl, as = N],
5[rd] -- {
t2[nl, as = N],
t3[nl, as = N]
}
} ,
13[bk] -- {
9[rd] -- {
t4[nl, as = N],
t5[nl, as = N]
} ,
14[rd] -- {
t6[nl, as = N],
t7[nl, as = N]
}
}
} ,
71[bk] -- {
40[rd] -- {
23[bk] -- {
t8[nl, as = N],
t9[nl, as = N]
} ,
55[bk] -- {
41[rd] -- {
t10[nl, as = N],
t11[nl, as = N]
} ,
66[rd] -- {
t12[nl, as = N],
t13[nl, as = N]
}
}
} ,
75[bk] -- {
t14[nl, as = N],
99[rd] -- {
t15[nl, as = N],
t16[nl, as = N]
}
}
}
}
};
\end{tikzpicture}
\end{document}
然后用
由于洛谷不支持居中,所以我现在的做法是通过 clip 控制命令来在图片两侧留出充足空格,这样放在网页上就能占满全宽,达到居中的显示效果。
顺带一提,
图片上传
在一年前,我探索过怎么在图床里放 svg 格式的文件并显示出来。基本思路是,利用这样两个特性:
- 题目附件可以上传
\text{svg} 文件; - Markdown 可以接受题目附件的链接并显示图片。
这样就可以绕开洛谷图床上传后的图片会强制转成
所以还是回归本源,直接传
在相当长的一段时间里,我都是直接使用
>>> pdftocairo -png sample.pdf
不过后来我发现,
pdftocairo version 22.02.0
Copyright 2005-2022 The Poppler Developers - http://poppler.freedesktop.org
Copyright 1996-2011 Glyph & Cog, LLC
Usage: pdftocairo [options] <PDF-file> [<output-file>]
-png : generate a PNG file
-ps : generate PostScript file
-eps : generate Encapsulated PostScript (EPS)
-pdf : generate a PDF file
-svg : generate a Scalable Vector Graphics (SVG) file
-print : print to a Windows printer
-printdlg : show Windows print dialog and print
-printer <string> : printer name or use default if this option is not specified
-printopt <string> : printer options, with format <opt1>=<val1>[,<optN>=<valN>]*
-setupdlg : show printer setup dialog before printing
-f <int> : first page to print
-l <int> : last page to print
-o : print only odd pages
-e : print only even pages
-singlefile : write only the first page and do not add digits
-r <fp> : resolution, in PPI (default is 150)
-rx <fp> : X resolution, in PPI (default is 150)
-ry <fp> : Y resolution, in PPI (default is 150)
-scale-to <int> : scales each page to fit within scale-to*scale-to pixel box
-scale-to-x <int> : scales each page horizontally to fit in scale-to-x pixels
-scale-to-y <int> : scales each page vertically to fit in scale-to-y pixels
-x <int> : x-coordinate of the crop area top left corner
-y <int> : y-coordinate of the crop area top left corner
-W <int> : width of crop area in pixels (default is 0)
-H <int> : height of crop area in pixels (default is 0)
-sz <int> : size of crop square in pixels (sets W and H)
-cropbox : use the crop box rather than media box
-mono : generate a monochrome image file (PNG, JPEG)
-gray : generate a grayscale image file (PNG, JPEG)
-transp : use a transparent background instead of white (PNG)
-antialias <string> : set cairo antialias option
-icc <string> : ICC color profile to use
-level2 : generate Level 2 PostScript (PS, EPS)
-level3 : generate Level 3 PostScript (PS, EPS)
-origpagesizes : conserve original page sizes (PS, PDF, SVG)
-paper <string> : paper size (letter, legal, A4, A3, match)
-paperw <int> : paper width, in points
-paperh <int> : paper height, in points
-nocrop : don't crop pages to CropBox
-expand : expand pages smaller than the paper size
-noshrink : don't shrink pages larger than the paper size
-nocenter : don't center pages smaller than the paper size
-duplex : enable duplex printing
-opw <string> : owner password (for encrypted files)
-upw <string> : user password (for encrypted files)
-q : don't print any messages or errors
-v : print copyright and version info
-h : print usage information
-help : print usage information
--help : print usage information
-? : print usage information
这里面比较重要的,一个是
别的选项我也扒过用途,感觉没啥特别有用的。
>>> pdftocairo -png -r 300 -transp sample.pdf
我试过把
透明通道,太爽!
不过显然画图的质量还是需要我个人的绘图水平的。
最近有阅读过 奇怪的具体需求也尝试在
然后就是用工具的时候可以多去查查这玩意儿有啥其他功能。比如多翻翻
其实
所以人还是要多学习啊!