mirror of
https://github.com/NaitLee/Cat-Printer.git
synced 2025-05-21 01:30:10 -07:00
Merge pull request #59 from nodlek-ctrl/imagemagik-usability
Fix #58 and add some more configuration information regarding IM Security Policy.
This commit is contained in:
commit
23d9d6d5c3
20
README.md
20
README.md
@ -82,6 +82,26 @@ On Arch Linux based distros you may install `bluez` first, as it may not be inst
|
||||
sudo pacman -S bluez bluez-utils
|
||||
```
|
||||
|
||||
<details>
|
||||
<summary>Further steps</summary>
|
||||
|
||||
You may want to use the command line interface for hackiness...
|
||||
|
||||
You may or may not need to install ImageMagick and Ghostscript, depending on your distro.
|
||||
|
||||
```bash
|
||||
sudo apt install imagemagick ghostscript
|
||||
```
|
||||
or use your distro's package manager.
|
||||
|
||||
Extra configuration is required for ImageMagick to work. Because IM is made for external webserver, a strict security policy is applied. You need to add the following line to `/etc/ImageMagick-6/policy.xml` before `</policymap>`:
|
||||
```xml
|
||||
<policy domain="coder" rights="read | write" pattern="PDM" />
|
||||
```
|
||||
|
||||
Because this script is only accesible by localhost, or at most your local network, this is safe.
|
||||
</details>
|
||||
|
||||
*Packaging is also on the way!*
|
||||
|
||||
### MacOS
|
||||
|
@ -596,6 +596,9 @@ _MagickExe = fallback_program('magick', 'magick.exe', 'convert', 'convert.exe')
|
||||
def magick_text(stdin, image_width, font_size, font_family):
|
||||
'Pipe an io to ImageMagick for processing text to image, return output io'
|
||||
read_fd, write_fd = os.pipe()
|
||||
if _MagickExe is None:
|
||||
fatal(i18n("imagemagick-not-found"), code=129)
|
||||
|
||||
subprocess.Popen([_MagickExe, '-background', 'white', '-fill', 'black',
|
||||
'-size', f'{image_width}x', '-font', font_family, '-pointsize',
|
||||
str(font_size), 'caption:@-', 'pbm:-'],
|
||||
@ -605,6 +608,9 @@ def magick_text(stdin, image_width, font_size, font_family):
|
||||
def magick_image(stdin, image_width, dither):
|
||||
'Pipe an io to ImageMagick for processing "usual" image to pbm, return output io'
|
||||
read_fd, write_fd = os.pipe()
|
||||
if _MagickExe is None:
|
||||
fatal(i18n("imagemagick-not-found"), code=129)
|
||||
|
||||
subprocess.Popen([_MagickExe, '-', '-fill', 'white', '-opaque', 'transparent',
|
||||
'-resize', f'{image_width}x', '-dither', dither, '-monochrome', 'pbm:-'],
|
||||
stdin=stdin, stdout=io.FileIO(write_fd, 'w'))
|
||||
|
@ -159,5 +159,7 @@
|
||||
"test-unknown-device": "Test Unknown Device",
|
||||
"scan": "Scan",
|
||||
"now-will-scan-for-all-bluetooth-devices-nearby": "Scan set to search for all bluetooth devides nearby.",
|
||||
"pf2-font-not-found-or-broken-0": "PF2 font not found or broken: '{0}'"
|
||||
"pf2-font-not-found-or-broken-0": "PF2 font not found or broken: '{0}'",
|
||||
"imagemagick-not-found": "ImageMagick not found, please install it and retry."
|
||||
|
||||
}
|
@ -137,5 +137,7 @@
|
||||
"test-unknown-device": "I HAV STRENGE KITTE",
|
||||
"now-will-scan-for-all-bluetooth-devices-nearby": "WIL FIND ALL THINY KITTE OR NOT",
|
||||
"scan": "FIND",
|
||||
"pf2-font-not-found-or-broken-0": "KITTE FONT LOST OR DEAD> {0}"
|
||||
"pf2-font-not-found-or-broken-0": "KITTE FONT LOST OR DEAD> {0}",
|
||||
"image-magick-not-found": "IMAGEMAGICK NOT FINDZ, PLZ INSTALL IT AND HAVES ANODA GO."
|
||||
|
||||
}
|
||||
|
@ -149,5 +149,6 @@
|
||||
"javascript-catprinter-description": "猫咪打印机 (Cat-Printer) 主脚本",
|
||||
"free-software": "自由软件",
|
||||
"free-software-description": "尊重您计算自由的软件。",
|
||||
"pf2-font-not-found-or-broken-0": "PF2 字体丢失或损坏:'{0}'"
|
||||
"pf2-font-not-found-or-broken-0": "PF2 字体丢失或损坏:'{0}'",
|
||||
"image-magick-not-found": "未找到 ImageMagick,请安装并重试。"
|
||||
}
|
@ -149,5 +149,6 @@
|
||||
"javascript-catprinter-description": "貓咪打印機 (Cat-Printer) 主腳本",
|
||||
"free-software": "自由軟件",
|
||||
"free-software-description": "尊重您計算自由的軟件。",
|
||||
"pf2-font-not-found-or-broken-0": "PF2 字體丟失或損壞:'{0}'"
|
||||
"pf2-font-not-found-or-broken-0": "PF2 字體丟失或損壞:'{0}'",
|
||||
"imagemagick-not-found": "未找到 ImageMagick,請安裝並重試。"
|
||||
}
|
@ -149,5 +149,6 @@
|
||||
"javascript-catprinter-description": "貓咪打印機 (Cat-Printer) 主腳本",
|
||||
"free-software": "自由軟件",
|
||||
"free-software-description": "尊重您計算自由的軟件。",
|
||||
"pf2-font-not-found-or-broken-0": "PF2 字體丟失或損壞:'{0}'"
|
||||
"pf2-font-not-found-or-broken-0": "PF2 字體丟失或損壞:'{0}'",
|
||||
"imagemagick-not-found": "未找到 ImageMagick,請安裝並重試。"
|
||||
}
|
@ -149,5 +149,5 @@
|
||||
"javascript-catprinter-description": "貓咪印表機 (Cat-Printer) 主指令碼",
|
||||
"free-software": "自由軟體",
|
||||
"free-software-description": "尊重您計算自由的軟體。",
|
||||
"pf2-font-not-found-or-broken-0": "PF2 字型丟失或損壞:'{0}'"
|
||||
"pf2-font-not-found-or-broken-0": "未找到 ImageMagick,請安裝並重試。"
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user