Image Magic根据文本点数对齐文本点(Image Magick align text points based on number of text points)
是否有可能以某种方式得到一个人在图像魔法中绘制的文本的宽度?
我当前的convert命令如下所示:
convert -size 720x480 -background#000 xc:black -fill white -stroke white \ -font Arial -pointsize 18 \ -draw“text 72,370'NavP1'”\ -font Arial -pointsize 18 \ -draw“text,''” \ -font Arial -pointsize 18 \ -draw“text,''”\ -font Arial -pointsize 18 \ -draw“text 370,370'Extras'”\ -font Arial -pointsize 18 \ -draw“text 430,370'opt'” \ -font Arial -pointsize 18 \ -draw“text 550,370'NavP1'”\ C:\ xampp \ htdocs \ labelText.bmp
我以编程方式执行此操作,并希望根据我有多少导航点将导航点对齐并相互对齐
(我从我的php formular / database获得了导航点的数量)。
这是我的意思和它应该是什么样子的一个小草图
________________________________________ | | | | | | | navp1 navp2 | |_______________________________________| ________________________________________ | | | | | | | navp1 navp2 navp3 | |_______________________________________|
我对该图像有一个固定的宽度(720px)。
因此,我有最少2个导航点和最多6个导航点。
我的想法是,如果我能得到每个导航(文本/单词)点的宽度,我可以正确计算和对齐点。
但是知道我找不到这样做的功能。
我试过Mark Setchell,但我的命令似乎有误
convert -debug annotate -size 720x480 -background#000 xc:black -fill white -stroke white \ -font Arial -pointsize 18 \ -draw“text 72,370'nav1'”\ -font Arial -pointsizeize 18 \ -draw“text 180,370 'nav2'“\ -font Arial -pointsize 18 \ -draw”text 430,370'nav3'“\ -font Arial -pointsize 18 \ -draw”text 550,370'nav4'“\ C:\ xampp \ htdocs \ test.bmp
但我收到以下错误消息:
没有图像定义'-background'@ error / convert.c / ConvertImageCommand / 325
Is it possible to get somehow the width of a text which one draws in image magick?
My current convert command looks like this:
convert -size 720x480 -background #000 xc:black -fill white -stroke white \ -font Arial -pointsize 18 \ -draw "text 72,370 'NavP1'" \ -font Arial -pointsize 18 \ -draw "text , ''" \ -font Arial -pointsize 18 \ -draw "text , ''" \ -font Arial -pointsize 18 \ -draw "text 370,370 'Extras'" \ -font Arial -pointsize 18 \ -draw "text 430,370 'opt'" \ -font Arial -pointsize 18 \ -draw "text 550,370 'NavP1'" \ C:\xampp\htdocs\labelText.bmp
I did this programmatically and want to center and align the navigation points to each other based on how many navigation points I have
( I get the number of navigation points from my php formular / database ).
Here is a little sketch of what I mean and how it should look like
________________________________________ | | | | | | | navp1 navp2 | |_______________________________________| ________________________________________ | | | | | | | navp1 navp2 navp3 | |_______________________________________|
I have a fixed width for that image (720px).
Thus I have a minimum number of 2 navigation points and a maximum number of 6 navigation points.
My thought is that if I could get the width of each Navigation (text/word) point I could calculate and align the points correctly.
But right know I could not find a function which does that.
I tried Mark Setchell Answer but my command seems to have a mistake
convert -debug annotate -size 720x480 -background #000 xc:black -fill white -stroke white \ -font Arial -pointsize 18 \ -draw "text 72,370 'nav1'" \ -font Arial -pointsize 18 \ -draw "text 180,370 'nav2'" \ -font Arial -pointsize 18 \ -draw "text 430,370 'nav3'" \ -font Arial -pointsize 18 \ -draw "text 550,370 'nav4'" \ C:\xampp\htdocs\test.bmp
but I get following error message:
no images defined '-background' @ error/convert.c/ConvertImageCommand/325
原文:https://stackoverflow.com/questions/37608525
最满意答案
你最好的选择是使用subst.exe或联结点来创建一个虚拟目录。 有关交界点的信息,请参阅此处 。 Subst.exe只是创建一个虚拟驱动器号。 将所有可部署的文件放在具有定义良好的常量子路径的目录树中,并使该树的根为联结点或虚拟驱动器。
Actually what I did was setup a script.cmd to run after my project output is built to copy the dependencies to a folder that is relative to the actual project folder from the declared $(DLL_PATH). The setup project actually uses relative paths to the project, not absolute ones. So this works no matter what the build machine looks like. Then a script to remove this folder at the end.
相关问答
更多-
右键单击安装项目 - >查看 - >文件系统 右键单击应用程序目录 - >属性 - >默认位置 Right-click on Setup Project --> View --> File System Right-click on Application Directory --> Properties --> Default Location
-
auto关键字的可移植性(Portability of auto keyword)[2023-12-25]
auto删除引用和顶级cv限定符( const和volatile )。 c的类型是something const& ,即使你写了auto& c = f_x()也是一样的(与Scott Meyers的“Type Deduction和Why you care”的幻灯片15中的v5情况相同)所以你没有那里需要一个const 。 c_copy的类型是something (注意:即使RHS是const引用也没有const ;与同一幻灯片上的v3相同),这就是c_copy = c调用复制构造函数的原因。 auto re ... -
这当然完全取决于你的构建环境,并且与C本身无关。 你可以尝试的一件事是在你的makefile中设置你的include路径: INCDIRS=-I ./solaris #INCDIRS=-I ./windows #INCDIRS=-I ./linux : CC=gcc $(INCDIRS) ... 并取消注释你正在工作的人。 然后把你的平台特定的标题放在这些目录中: ./solaris/io.h ./windows/io.h ./linux/io.h 您甚至可以在不同的平台makefiles(如solar ...
-
停止使用“项目输出”选项。 只需使用安装项目文件系统视图将文件从任何项目(或实际上系统中的任何位置)拖动到目标文件夹中。 Stop using the Project Output option. Just use your setup project File System view to drag the files from any project (or in fact anywhere on the system) into the destination folder.
-
感谢问题评论部分中的gengisdave; 解决方案是使用ldd。 在我的情况下:ldd / dir / blablah / program_name - 这产生了如下输出: mikearmstrong@ubuntu:~/Desktop/linux_command_tool$ ldd ProntoCommandTool linux-vdso.so.1 => (0x00007ffdb25f0000) libgtk-3.so.0 => /usr/lib/x86_64-linux-gnu/li ...
-
我对Windows Installer的理解是,这种行为被抽象掉了,所以开发人员不需要担心。 也就是说,如果未设置ALLUSERS属性,则安装包将“自动”将注册表项置于HKCU而不是HKLM中。 请参阅MSDN上的文档http://msdn.microsoft.com/en-us/library/aa367559%28VS.85%29.aspx 。 因此,听起来好像您正尝试通过安装项目来重新实现此功能; 我建议根据ALLUSERS属性删除条件。 作为旁注,AlwaysCreate属性控制在什么情况下将创建注 ...
-
你最好的选择是使用subst.exe或联结点来创建一个虚拟目录。 有关交界点的信息,请参阅此处 。 Subst.exe只是创建一个虚拟驱动器号。 将所有可部署的文件放在具有定义良好的常量子路径的目录树中,并使该树的根为联结点或虚拟驱动器。 Actually what I did was setup a script.cmd to run after my project output is built to copy the dependencies to a folder that is relative ...
-
记录或创建一个宏: Option Strict Off Option Explicit Off Imports System Imports EnvDTE Imports EnvDTE80 Imports EnvDTE90 Imports System.Diagnostics Public Module RefreshDependencies Sub TemporaryMacro() DTE.ActiveWindow.Object.GetItem("Project\Setup1\S ...
-
我想出了这个与pthread兼容的互斥操作的端口: #define MUTEX_TYPE HANDLE #define MUTEX_INITIALIZER NULL #define MUTEX_SETUP(x) (x) = CreateMutex(NULL, FALSE, NULL) #define MUTEX_CLEANUP(x) (CloseHandle(x) == 0) #define MUTEX_LOCK(x) emul ...
-
WiX非常棒。 这是一篇很好的MSDN文章 。 WiX is excellent. Here is a good MSDN article on it too.