欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

如何使用draw.io插件在vscode中一體化導(dǎo)出高質(zhì)量圖片

 更新時(shí)間:2022年08月06日 09:09:23   作者:zdlwhereyougo  
這篇文章主要介紹了draw.io插件在vscode中一體化導(dǎo)出高質(zhì)量圖片需要的工具是vscode,?draw.io擴(kuò)展,draw.io桌面版?、python,本文給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒,需要的朋友可以參考下

‘’’
Author: zzx
Date: 2022-07-30 15:52:15
LastEditors: zdl
LastEditTime: 2022-07-30 16:03:20
FilePath: \matlabcodef:\BaiduNetdiskWorkspace\markdown寫雜談\python導(dǎo)出drawio文件
Description:

Copyright © 2022 by zdl, All Rights Reserved.
‘’’

vscode一體化導(dǎo)出drawio

需要的工具:vscode, draw.io擴(kuò)展,draw.io桌面版 、python

提示:這個(gè)方法并沒有簡(jiǎn)化流程,只是能夠減少打開窗口,在vscode中直接查看原始文件,導(dǎo)出文件,效率并沒有顯著提升。

啰嗦的部分:
drawio流程圖繪制軟件比visio好用。而且vscode有插件。vs插件的優(yōu)點(diǎn)在于支持mermaid流程圖,缺點(diǎn)非常明顯不支持指定分辨率圖像導(dǎo)出。
網(wǎng)上檢索發(fā)現(xiàn)drawio的桌面版可以在命令行操作。在drawio安裝目錄下運(yùn)行cmd,然后通過draw.io -help 命令可以查看全部命令。
查看命令發(fā)現(xiàn)沒有針對(duì)性的dpi設(shè)置。我就想到給圖片輸入寬度和高度的方式。根據(jù)我猜測(cè)這個(gè)寬度和高度應(yīng)該對(duì)應(yīng)的就是像素點(diǎn)數(shù)量,所以我就按照實(shí)際尺寸,以及dpi的定義
寫了一個(gè)命令, 發(fā)現(xiàn)可用。但是每次都要計(jì)算寬度、高度、調(diào)用cmd命令窗口,太麻煩。功能強(qiáng)大的python加上插件齊全的vscode能不能全部實(shí)現(xiàn)呢?
折騰了幾個(gè)小時(shí),終于搞定了。

進(jìn)入正題:
1、安裝draw.io插件,和桌面版,記住桌面版的路徑
2、繪制好的圖片有一個(gè)實(shí)際的尺寸,記住實(shí)際尺寸的寬和高
3、python轉(zhuǎn)換 寬度

dpivalue=600#dpi
realwidth=89.4#mm
realheight=81.2#mm
width=round(dpivalue*realwidth/25.4)
height=round(dpivalue*realheight/25.4)

4、 構(gòu)造命令行,不嫌麻煩可以自己寫完整目錄

inputfilepath=r'F:\BaiduNetdiskWorkspace\00typora\大論文\drawio\算法流程圖.drawio'
outputfilepath=r'F:\BaiduNetdiskWorkspace\00typora\大論文\drawio\test.png'
starttext=r'draw.io -x '
midletext=r" -f png -t --width "+str(width)+r" --height " +str(height)+r" -o "
commandtext1=starttext+inputfilepath+midletext+outputfilepath

5、 改變python文件工作目錄并執(zhí)行命令

path="D:/draw.io/"#安裝文件夾
os.chdir( path )# 修改當(dāng)前工作目錄
v2=os.system(commandtext1)

完整的代碼

代碼量并不大,非常簡(jiǎn)單

'''
Author: zzx
Date: 2022-07-27 10:12:38
LastEditors: zdl
LastEditTime: 2022-07-30 16:10:22
FilePath: \matlabcodef:\BaiduNetdiskWorkspace\00typora\大論文\drawio\output.py
Description: 

Copyright (c) 2022 by zdl, All Rights Reserved. 
'''
import os
dpivalue=600#dpi
realwidth=89.4#mm
realheight=81.2#mm
width=round(dpivalue*realwidth/25.4)
height=round(dpivalue*realheight/25.4)
inputfilepath=r'F:\BaiduNetdiskWorkspace\00typora\大論文\drawio\算法流程圖.drawio'
outputfilepath=r'F:\BaiduNetdiskWorkspace\00typora\大論文\drawio\test.png'
starttext=r'draw.io -x '
midletext=r" -f png -t --width "+str(width)+r" --height " +str(height)+r" -o "
commandtext1=starttext+inputfilepath+midletext+outputfilepath
path="D:/draw.io/"#安裝文件夾
os.chdir( path )# 修改當(dāng)前工作目錄
v2=os.system(commandtext1)

# 快速運(yùn)行F5
# print(v2)

#關(guān)于python權(quán)限的問題
# https://blog.csdn.net/qq_33731081/article/details/103812749
# 如何在python中運(yùn)行命令行命令
# https://blog.csdn.net/qq_34769162/article/details/119037908
#報(bào)錯(cuò)為空值的問題
# https://blog.csdn.net/xiaoxiaogh/article/details/88320102

#關(guān)于drawio導(dǎo)出命令,靈感來源https://j2r2b.github.io/2019/08/06/drawio-cli.html
'''
Options:
  -V, --version                      output the version number
  -c, --create                       creates a new empty file if no file is
                                     passed
  -k, --check                        does not overwrite existing files
  -x, --export                       export the input file/folder based on the
                                     given options
  -r, --recursive                    for a folder input, recursively convert
                                     all files in sub-folders also
  -o, --output <output file/folder>  specify the output file/folder. If
                                     omitted, the input file name is used for
                                     output with the specified format as
                                     extension
  -f, --format <format>              if output file name extension is
                                     specified, this option is ignored (file
                                     type is determined from output extension,
                                     possible export formats are pdf, png, jpg,
                                     svg, vsdx, and xml) (default: "pdf")
  -q, --quality <quality>            output image quality for JPEG (default:
                                     90)
  -t, --transparent                  set transparent background for PNG
  -e, --embed-diagram                includes a copy of the diagram (for PNG,
                                     SVG and PDF formats only)
  --embed-svg-images                 Embed Images in SVG file (for SVG format
                                     only)
  -b, --border <border>              sets the border width around the diagram
                                     (default: 0)
  -s, --scale <scale>                scales the diagram size
  --width <width>                    fits the generated image/pdf into the
                                     specified width, preserves aspect ratio.
  --height <height>                  fits the generated image/pdf into the
                                     specified height, preserves aspect ratio.
  --crop                             crops PDF to diagram size
  -a, --all-pages                    export all pages (for PDF format only)
  -p, --page-index <pageIndex>       selects a specific page, if not specified
                                     and the format is an image, the first page
                                     is selected
  -g, --page-range <from>..<to>      selects a page range (for PDF format only)
  -u, --uncompressed                 Uncompressed XML output (for XML format
                                     only)
  --enable-plugins                   Enable Plugins
  -h, --help                         display help for command
'''

到此這篇關(guān)于draw.io插件在vscode中一體化導(dǎo)出高質(zhì)量圖片的文章就介紹到這了,更多相關(guān)draw.io vscode一體化導(dǎo)出圖片內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

您可能感興趣的文章:

相關(guān)文章

  • sublime3之內(nèi)網(wǎng)安裝python插件Anaconda的流程

    sublime3之內(nèi)網(wǎng)安裝python插件Anaconda的流程

    這篇文章主要介紹了sublime3之內(nèi)網(wǎng)安裝python插件Anaconda的流程,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧
    2020-11-11
  • python requests更換代理適用于IP頻率限制的方法

    python requests更換代理適用于IP頻率限制的方法

    今天小編就為大家分享一篇python requests更換代理適用于IP頻率限制的方法,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧
    2019-08-08
  • Python應(yīng)用實(shí)現(xiàn)處理excel數(shù)據(jù)過程解析

    Python應(yīng)用實(shí)現(xiàn)處理excel數(shù)據(jù)過程解析

    這篇文章主要介紹了Python應(yīng)用實(shí)現(xiàn)處理excel數(shù)據(jù)過程解析,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下
    2020-06-06
  • flask之郵件發(fā)送的實(shí)現(xiàn)示例

    flask之郵件發(fā)送的實(shí)現(xiàn)示例

    Flask-Mail是一個(gè)處理電子郵件發(fā)送的擴(kuò)展,它提供了簡(jiǎn)單且易于使用的API,可以方便地發(fā)送電子郵件,本文就來介紹一下flask之郵件發(fā)送的實(shí)現(xiàn)示例,感興趣的可以了解一下
    2023-12-12
  • python中的位置參數(shù)和關(guān)鍵字參數(shù)詳解

    python中的位置參數(shù)和關(guān)鍵字參數(shù)詳解

    位置參數(shù)和關(guān)鍵字參數(shù)是 Python 中的兩種不同類型的函數(shù)參數(shù)傳遞方式,位置參數(shù)依賴于參數(shù)的位置順序,而關(guān)鍵字參數(shù)通過參數(shù)名傳遞,不受位置影響,本文通過代碼示例給大家詳細(xì)介紹了python中的位置參數(shù)和關(guān)鍵字參數(shù),需要的朋友可以參考下
    2023-12-12
  • Python基礎(chǔ)語(yǔ)言學(xué)習(xí)筆記總結(jié)(精華)

    Python基礎(chǔ)語(yǔ)言學(xué)習(xí)筆記總結(jié)(精華)

    給大家分享一篇關(guān)于Python基礎(chǔ)學(xué)習(xí)內(nèi)容的學(xué)習(xí)筆記整理總結(jié)篇,里面匯集了學(xué)習(xí)Python基礎(chǔ)語(yǔ)言的難點(diǎn)和技巧,分享給大家。
    2017-11-11
  • Python實(shí)現(xiàn)操作Redis所有類型的方法詳解

    Python實(shí)現(xiàn)操作Redis所有類型的方法詳解

    Redis作為一款高性能的NoSQL數(shù)據(jù)庫(kù),越來越受到了廣大開發(fā)者的喜愛。本篇博客將介紹如何使用Python操作Redis的所有類型,以及一些高級(jí)用法,感興趣的可以了解一下
    2023-04-04
  • python列表中常見的一些排序方法

    python列表中常見的一些排序方法

    在Python實(shí)際開發(fā)中會(huì)經(jīng)常需要用到對(duì)列表進(jìn)行排序,下面這篇文章主要給大家介紹了關(guān)于python列表中常見的一些排序方法,文中通過實(shí)例代碼介紹的非常詳細(xì),需要的朋友可以參考下
    2022-09-09
  • 用 Python 連接 MySQL 的幾種方式詳解

    用 Python 連接 MySQL 的幾種方式詳解

    這篇文章主要介紹了用 Python 連接 MySQL 的幾種方式,大家可以根據(jù)實(shí)際情況選擇合理的連接方式,需要的朋友可以參考下
    2018-04-04
  • Python 字符串處理特殊空格\xc2\xa0\t\n Non-breaking space

    Python 字符串處理特殊空格\xc2\xa0\t\n Non-breaking space

    今天遇到一個(gè)問題,使用python的find函數(shù)尋找字符串中的第一個(gè)空格時(shí)沒有找到正確的位置,下面是解決方法,需要的朋友可以參考下
    2020-02-02

最新評(píng)論