Hi!
I am new to this. I have searched exemples of scrips to understand it all, but i need to figure out 2 things.
The idea is to make multiple copy of the same (white) word, centered on a black background.
But i would like to use all the fonts in my font folder in windows.
A different font for each image every time till i used all fonts available.
The i need to save the files with different names so the don't overwrite each other.
(To include the font name in the saved file would be awsome but not mandatory)
So, i'm only looking for the code to say *all fonts available*. Like a wildcard when you make a search (*.*) ; Instead of writing the font name itself.
Thanks for the help!
Peace to all!
Ethernety
How to save to multiple copy but changing font each time?
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: How to save to multiple copy but changing font each time?
As far as I know, Imagemagick has no way to do that natively. You can write a script to loop over the type.xml file (or your font directory) to find all the font names or font files and then write a loop over your text image processing to substitute each font.So, i'm only looking for the code to say *all fonts available*. Like a wildcard when you make a search (*.*) ; Instead of writing the font name itself.
Re: How to save to multiple copy but changing font each time?
Thanks a lot for the fast reply!!
I'll try that!! My nose is bleeding already!
Peace!!
I'll try that!! My nose is bleeding already!
Peace!!
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: How to save to multiple copy but changing font each time?
Where do you want to save it? As part of the image underneath or in the meta data, which can be saved as a comment or label. You can also write the output filename as the font name.(To include the font name in the saved file would be awsome but not mandatory)
See
http://www.imagemagick.org/Usage/annotating/#anno_below
http://www.imagemagick.org/Usage/basics/#attributes
http://www.imagemagick.org/Usage/basics/#set
Re: How to save to multiple copy but changing font each time?
I have some php code if you can use a localhost on this page - it is quite old but should still work. If you can not use the php you might be able to modify it into a batch script or similar.
I believe Anthony has a version on his website somewhere which will not be php: http://www.imagemagick.org/Usage
I believe Anthony has a version on his website somewhere which will not be php: http://www.imagemagick.org/Usage
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: How to save to multiple copy but changing font each time?
Anthony has a show_fonts script at http://www.imagemagick.org/Usage/scripts/show_fonts, but it is a Unix shell script and so won't work on Windows without Cygwin.
- GeeMack
- Posts: 718
- Joined: 2015-12-01T22:09:46-07:00
- Authentication code: 1151
- Location: Central Illinois, USA
Re: How to save to multiple copy but changing font each time?
ImageMagick will list all the fonts it sees currently installed on your Windows system with this command...
A very small batch file run from a Windows cmd.exe prompt can parse that list, use just the font names, and make a set of small JPG files, each with your word in white on black. The images are saved with a file name that is the same as the font name. I made a batch file named fontjpgs.bat in a temp directory on my Windows 7 64, then I ran it to create the images in that directory. This is what the batch program looks like...
It will miss any fonts that ImageMagick can't see or use. A couple of my fonts made images with little squares instead of the font characters. I also don't know how it might handle any font names that might have characters that aren't legal for making file names. Maybe something like this will get you started.
Code: Select all
convert -list font
Code: Select all
@echo off
setlocal
set WORD=Your word here.
for /F "tokens=1,2 delims=: " %%I in ( 'convert -list font' ) do (
if %%I == Font (
convert ^
-background black ^
-bordercolor black ^
-fill white ^
-gravity center ^
-font "%%J" ^
-pointsize 36 ^
label:"%WORD%" ^
-border 36x36 ^
-quality 100 ^
"%%J.jpg"
)
)
Last edited by GeeMack on 2015-12-17T21:41:12-07:00, edited 1 time in total.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: How to save to multiple copy but changing font each time?
You can edit the type.xml file to add any allowed fonts to the file so that the above command will list those fonts as well.