透過指令轉換krita檔案格式

有些重覆性的操作,使用手動操作實在很花時間,最好可以透過指令的方式,有機會可以因此自動化處理,以提升效率。指令行的操作語法:

krita importfilename --export --export-filename exportfilename

實際測試,效率太差,每一個圖片檔案都要處理很久,較佳的解法是改手 .psd 格式,可以使用 ImageMagick CLI 程式來轉換,操作語法:

Usage: magick tool [ {option} | {image} … ] {output_image}
Usage: magick [ {option} | {image} … ] {output_image}
       magick [ {option} | {image} … ] -script {filename} [ {script_args} …]
       magick -help | -version | -usage | -list {option}

Convert single PSD to PNG or JPG

If your file name is psd-file.psd then you need to specify the name along with a [0] as shown below to export the PSD into image. If you don’t add [0] to the file name, all the objects and layers will get exported. To specify the output format, simply use the right extension in the output file name as shown below

$ magick 'psd-file[0].psd' png-file.png
$ magick 'psd-file[0].psd' jpg-file.jpg

Batch convert PSD to PNG or JPG

To batch convert a set of PSD files, you can use an ‘*’ to match all the PSD files in the current directory. Additionally, specify ‘%03d’ to the output file name to generate out files in numbered fashion such as out-file-001.png, out-file-002.png, out-file-003.png and so on.

$ magick '*[0].psd' out-file-%03d.png

更進階一點說明:

如何從指令行創建分層PSD文件
https://stackoverflow.max-everyday.com/2021/06/how-to-create-a-layered-psd-file-from-command-line/

ImageMagick 官網:
https://imagemagick.org/index.php


krita 指令使用範例:

/Applications/krita.app/Contents/MacOS/krita 挖.png --export --export-filename 挖.kra

說明:把「挖.png」轉換成「挖.kra」


krita 指令詳細用法:

Usage: /Applications/krita.app/Contents/MacOS/krita [options] [file(s)]

Options:
  -v, --version                                Displays version information.
  -h, --help                                   Displays this help.
  --template                                   Open a new document with a
                                               template
  --new-image <colorspace,depth,width,height>  Create a new image.
                                               Possible colorspace values are:
                                                  * RGBA
                                                  * XYZA
                                                  * LABA
                                                  * CMYKA
                                                  * GRAY
                                                  * YCbCrA
                                               Possible channel depth arguments
                                               are
                                                  * U8 (8 bits integer)
                                                  * U16 (16 bits integer)
                                                  * F16 (16 bits floating point)
                                                  * F32 (32 bits floating point)
  --workspace <workspace>                      The name of the workspace to
                                               open Krita with
  --windowlayout <windowlayout>                The name of the window layout to
                                               open Krita with
  --load-session <load-session>                The name of the session to open
                                               Krita with
  --canvasonly                                 Start Krita in canvas-only mode
  --nosplash                                   Do not show the splash screen
  --fullscreen                                 Start Krita in full-screen mode
  --dpi <dpiX,dpiY>                            Override display DPI
  --export                                     Export to the given filename and
                                               exit
  --export-sequence                            Export animation to the given
                                               filename and exit
  --export-filename <filename>                 Filename for export
  --file-layer <file-layer>                    File layer to be added to
                                               existing or new file

Arguments:
  [file(s)]  

krita 官方文件:
https://docs.krita.org/en/reference_manual/linux_command_line.html

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *