[SOLVED] How to Create an Image from UTF8 Text via Command-line

As the title points out, I'm trying to create an image from unicode text via command line. I tried...
convert -pointsize 48 -size 400 caption:测试用 text.png
But that results in question marks for the Chinese characters. So searching around online I discovered that I needed to specify a font which could display the characters. The characters show up just fine in Firefox, KDE, Kate, Terminal, etc so I know I have a font which can render them. I thought it might be DejaVu but this also resulted in question marks...
convert -font /usr/share/fonts/TTF/DejaVuSerif.ttf -pointsize 48 -size 400 caption:测试用 text.png
Any ideas?
Last edited by tony5429 (2011-01-31 23:17:41)

DejaVu doesn't contain those Chinese glyphs at all, so please don't blame ImageMagick for not rendering them.
So, Firefox, Kate, Terminal and the others you stated to use DejaVu, if encounter these characters, fall back to some other fonts to render them. These fonts are, however, not vector, but bitmap fonts. (This can be seen if you increase text size (Ctrl++ in Firefox): the Chinese characters don't change, they remain of their inherent size.)
Actually, e.g. /usr/share/fonts/misc/18x18ko.pcf.gz definitely contains the three example characters, so the mentioned apps may use this font as fall back.
Apparently ImageMagick doesn't handle bitmap fonts (I'm not sure), so you won't be able to hit your original target. Anyway, since you tried to parse "-pointsize 48", you wouldn't be satisfied with the font size.
Your only choice seems to be using the above mentioned CJK-approved TTFs.
EDIT: typo
Last edited by barto (2011-01-28 21:52:33)

Similar Messages

  • How to Create Test Sequence Document in HTML using command line

    How to Create Test Sequence Document  in HTML using command line
    I have lot of sequences and I want to create Test Sequence Documentation in HTML format using Command Line automatically, is there a way to automate this task using .bat file or using   C#  .Net

    If you aren't able to figure out how to call a C++ DLL in .net then there may be another option.  Unfortunately I don't know how to do this off the top of my head and I don't have an example.
    The other option would be to change docgen.seq a little bit to the dialog doesn't display and you just hardcode the options.  Then you can use a command line to call testexec.exe: http://zone.ni.com/reference/en-XX/help/370052K-01/tsfundamentals/infotopics/startup_opt/
    Hope this helps,
    jigg
    CTA, CLA
    teststandhelp.com
    ~Will work for kudos and/or BBQ~

  • How to create an image from another one with midp1.0 as in midp 2.0

    hi:
    we can create an image from part of another one in midp2.0 width the following method
    createImage(Image image, int x,int y,int width,int height,int transform)
    but have to work with midp1.0, then how?
    regards

    but i have six icons in one picture, (tow row ,three column, each size 14*14)
    it's ok to get the top-left icon with the following code
    Image image = Image.createImage("/myicon.png");
    Image tmp = Image.createImage(14, 14);
    Graphics g = tmp.getGraphics();
    g.drawImage(image, 0, 0, Graphics.TOP|Graphics.LEFT);
    but how to get other icon?
    regards

  • Create Quicktime reference from still sequence in command line

    Hello,
    I need to create a Quicktime Reference file from a still images sequences. But with command line.
    I've tried with Qt-Tools and Qt-Coffee but i don't find an answer...
    Thank yhou for your help!

    enka wrote:
    Please read the question...
    I can read
    I can speak english
    I can reason an argument
    but i don't find an answer...
    you got an answer

  • How do I remove Lotus Notes PDFMaker plugin via command line?

    How do I remove the lotus notes PDFMaker plugin via command line?  I originally deployed Adobe Acrobat 10 as a complete install to many computers.  I see how to remove this specific feature through the GUI in Windows 7 by going to control panel / programs and features / Adobe Acrobat X / change / modify / create adobe PDF / acrobat PDFMaker / Lotus Notes, but this would be a tedious task to do manually at each computer.  I've experimented with a few msiexec commands after removing Acrobat such as:
    msiexec /i "\\path to msi" remove=pdfmakerforlotusnotes
    msiexec /i "\\path to msi" disable_pdfmaker=yes
    Both still install acrobat as a complete install.  Any help and suggestions would be appreciated.  Thank you!

    Thank you Sabian, that did the trick.  Here is the command line I used for anyone else having a similar issue:
    msiexec /i "\\path to msi" REMOVE=PDFMakerForLotusNotes /qn
    I did this on a test machine with a complete Acrobat installed.  I ran the above command and it removed the Lotus Notes PDFMaker plugin.  I should also note that it didn't downgrade my version of Acrobat and all of my custom settings within the application are still there.

  • IPhone SDK: How to create an image from raw data

    Creating a UIImage from some form of bitmap file format is easy, whether you let UIImage load the file itself or create it with an NSData. But what if you have raw bitmap data in memory and you want to create an image?
    In Cocoa NSBitmapImageRep can be created by passing it a pointer to a block of memory and the relevant heigh, width, bit depth etc. information. From that you can easily create an NSImage. There doesn't seem to be anything equivalent on the iPhone. CGImage can be created but it looks like you have to write a CGImageProvider. CGBitmapContextCreate takes a void * to a block of memory. Does it clear that block?
    Is there a good way to do this?

    ElNono wrote:
    You can't do RGB565 on a CGImageRef/CGContextRef. The only 5bpp modes supported are 1555 ARGB or 5551 RGBA. If you just need to display the image, use OpenGL. One of the supported texture formats is RGB565. If you need to save the image then you're going to have to pre-convert it to RGB888.
    hi ElNono , i have test the RGB888 data now , the image can show , but another problem is the image just like serveral picture over lap together , also is blurred , my code is here:
    const size_t width = 1024;
    const size_t height = 768;
    const size_t bitsPerComponent = 8;
    const size_t bitsPerPixel = 32;
    const size_t bytesPerRow = (bitsPerPixel * width)/8;
    CGBitmapInfo bitmapInfo = kCGImageAlphaPremultipliedLast;
    CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
    NSString *imagePath = [[NSBundle mainBundle] pathForResource: @"Test" ofType: @"rgb"];
    NSFileHandle* file = [NSFileHandle fileHandleForReadingAtPath:imagePath];
    NSData* imageData = [file readDataToEndOfFile];
    CGContextRef context = CGBitmapContextCreate((void*)[imageData bytes], width, height, bitsPerComponent, bytesPerRow, colorSpace, bitmapInfo);
    CGImageRef imageRef = CGBitmapContextCreateImage (context);
    UIImage*rawImage = [UIImage imageWithCGImage:imageRef];
    CGColorSpaceRelease(colorSpace);
    CGContextRelease(context);
    CGImageRelease(imageRef);

  • How to create and use library JAR files with command-line tools?

    Development Tools -> General Questions:
    I am trying to figure out how to put utility classes into JAR files and then compile and run applications against those JAR files using the command-line javac, jar, and java tools. I am using jdk1.7.0_17 on Debian GNU/Linux 6.0.7.
    I have posted a simple example with one utility class, one console application class, and a Makefile:
    http://holgerdanske.com/users/dpchrist/java/examples/jar-20130520-2134.tar.gz
    Here is a console session:
    2013-05-20 21:39:01 dpchrist@desktop ~/sandbox/java/jar
    $ cat src/com/example/util/Hello.java
    package com.example.util;
    public class Hello {
        public static void hello(String arg) {
         System.out.println("hello, " + arg);
    2013-05-20 21:39:12 dpchrist@desktop ~/sandbox/java/jar
    $ cat src/com/example/hello/HelloConsole.java
    package com.example.hello;
    import static com.example.util.Hello.hello;
    public class HelloConsole {
        public static void main(String [] args) {
         hello("world!");
    2013-05-20 21:39:21 dpchrist@desktop ~/sandbox/java/jar
    $ make
    rm -f hello
    find . -name '*.class' -delete
    javac src/com/example/util/Hello.java
    javac -cp src src/com/example/hello/HelloConsole.java
    echo "java -cp src com.example.hello.HelloConsole" > hello
    chmod +x hello
    2013-05-20 21:39:28 dpchrist@desktop ~/sandbox/java/jar
    $ ./hello
    hello, world!I believe I am looking for:
    1. Command-line invocation of "jar" to put the utility class bytecode file (Hello.class) into a JAR?
    2. Command-line invocation of "javac" to compile the application (HelloConsole.java) against the JAR file?
    3. Command-line invocation of "java" to run the application (HelloConsole.class) against the JAR file?
    I already know how t compile the utility class file.
    Any suggestions?
    TIA,
    David

    I finally figured it out:
    1. All name spaces must match -- identifiers, packages, file system, JAR contents, etc..
    2. Tools must be invoked from specific working directories with specific option arguments, all according to the project name space.
    My key discovery was that if the code says
    import com.example.util.Hello;then the JAR must contain
    com/example/util/Hello.classand I must invoke the compiler and interpreter with an -classpath argument that is the full path to the JAR file
    -classpath ext/com/example/util.jarThe code is here:
    http://holgerdanske.com/users/dpchrist/java/examples/jar-20130525-1301.tar.gz
    Here is a console session that demonstrates building and running the code two ways:
    1. Compiling the utility class into bytecode, compiling the application class against the utility bytecode, and running the application bytecode against the utility bytecode.
    2. Putting the (previously compiled) utility bytecode into a JAR and running the application bytecode against the JAR. (Note that recompiling the application against the JAR was unnecessary.)
    (If you don't know Make, understand that the working directory is reset to the initial working directory prior to each and every command issued by Make):
    2013-05-25 14:02:47 dpchrist@desktop ~/sandbox/java/jar
    $ cat apps/com/example/hello/Console.java
    package com.example.hello;
    import com.example.util.Hello;
    public class Console {
        public static void main(String [] args) {
         Hello.hello("world!");
    2013-05-25 14:02:55 dpchrist@desktop ~/sandbox/java/jar
    $ cat libs/com/example/util/Hello.java
    package com.example.util;
    public class Hello {
        public static void hello(String arg) {
         System.out.println("hello, " + arg);
    2013-05-25 14:03:03 dpchrist@desktop ~/sandbox/java/jar
    $ make
    rm -rf bin ext obj
    mkdir obj
    cd libs; javac -d ../obj com/example/util/Hello.java
    mkdir bin
    cd apps; javac -d ../bin -cp ../obj com/example/hello/Console.java
    cd bin; java -cp .:../obj com.example.hello.Console
    hello, world!
    mkdir -p ext/com/example
    cd obj; jar cvf ../ext/com/example/util.jar com/example/util/Hello.class
    added manifest
    adding: com/example/util/Hello.class(in = 566) (out= 357)(deflated 36%)
    cd bin; java -cp .:../ext/com/example/util.jar com.example.hello.Console
    hello, world!
    2013-05-25 14:03:11 dpchrist@desktop ~/sandbox/java/jar
    $ tree -I CVS .
    |-- Makefile
    |-- apps
    |   `-- com
    |       `-- example
    |           `-- hello
    |               `-- Console.java
    |-- bin
    |   `-- com
    |       `-- example
    |           `-- hello
    |               `-- Console.class
    |-- ext
    |   `-- com
    |       `-- example
    |           `-- util.jar
    |-- libs
    |   `-- com
    |       `-- example
    |           `-- util
    |               `-- Hello.java
    `-- obj
        `-- com
            `-- example
                `-- util
                    `-- Hello.class
    19 directories, 6 filesHTH,
    David

  • How to create a new user and group on command line?

    Hi,
    I am trying to install INN, the news server on OS X.4.8 (non-server), but it requires me to create a user and group, both called 'news'.
    I know this has something to do with using Netinfo to create them, but I am logged in remotely via ssh and I can't use Netinfo Manager.
    How do I create new users and groups via the command line.
    Thanks for any help.
    PowerMac G5 2x2.7GHz   Mac OS X (10.4.8)  

    I've put some shell scripts that do this here,
    and descriptions
    add_user
    addgroup

  • Initiate Application Installation from App Catalog via Command Line / PowerShell

    Hey Guys - 
    We have a single, fairly extensive OSD task sequence which covers systems for all departments.  Due to it being a single TS for all, PC Lab techs must manually install some apps after it finishes via the Application Catalog.  In past environments,
    I've used MDT's UDI Wizard to create a frontend where techs could select additional software they wanted installed during the TS and it worked great!  I'm trying to get something like that approved now, but in the meantime told the techs I'd come up with
    a temporary solution to make their job easier.
    Enter WPI (Windows Post Installer.)  Back in the days before I used SCCM OSD and relied in Acronis images (yuck), I used a the WPI tool which only ran once - at the first login - even before the desktop
    loaded.  It's highly customizable and basically shows a single window which lists any applications or scripts (in groups) which you have configured.  You place a checkmark beside each one you want to install, click the "Install" button,
    then watch it's installer frontend install each of the selected apps.  Once done, it either restarts the PC or exists to the desktop.  For each application I can add, I'm provided with a few options to
    install it.  Obviously, an installation command line string field, but also a few more like installation order, requirements, and dependencies. 
    My Question
    Each of the applications I've listed are in our Application Catalog and are advertised to All Users.  Even though I could simply point the installer string to the app's source path and use the same string that the SCCM Application uses, I've been asked
    to do something different.  Instead, I'm trying to find a command line string which when run would perform the same action as if a user had selected to install an Application from the Application Catalog.
    My thoughts are that if this is possible, it would probably be in the form of a PowerShell string - not just a basic command line one.  Since WPI has a frontend which shows the progress of each app's installation progress as well as overall progress,
    it's designed for the installation strings to install the app silently.  Therefore, I would much prefer my solution run silently as well if possible.
    So... does anyone have any idea for how I can make this happen? Thanks!
    In case it makes a difference or answers any questions, below are two screenshots showing most of the fields and options which may be used to configure how an application installs in WPI.  I couldn't include the Dependencies one since I could only
    attach two images to my post.  Also, the manual for WPI is embedded in the application's
    download (ZIP) and not a page on their site.  For the examples below, I used Google Chrome, but didn't configure anything besides the application's name:
    Application Detail Options
    Application Command Options
    Ben K.

    From what I'm reading, you are working towards MDT but it's not approved yet, so the goal is to:
    Deploy a "bundle" of applications as painlessly as possible without using UDI to make customizations quick.
    Lets talk options then.
    Option 1:  If machines types are in a unique OU or security group, create a collection for that and set these applications to mandatory install.  After initial deployment, the provisioner can drop the computer in the proper OU or group and you're
    good to go.  Downside:  collections refresh plus client check-in makes this less than instant.
    Option 2:  Orchestrator.  You can write a runbook that will approve and push apps.  You can then use the Orch console front end or a more friendly sharepoint/SM portal to push things out like a Manager would approve apps.  Downside:  if
    not already deployed, there's no way they would approve that infrastructure if they are hesitant about MDT/UDI :)
    Option 3:  PowerShell and WMI.  This should be doable ... but I've never tried it.  It looks like you're headed down the right path ... but i guess my question is:  if you can't have UDI when do get to pick the app?  Are you planning
    to write a full multi-box for them to check their apps after the fact?  In that case ... just have the appcontroller URL pop up on first login ... might be easier than reinventing the wheel.

  • Removing Mail from a MailBox via Command Line

    Hi,
    I have a mailBox with > 10,000 (Mailing List Bounce).
    I'd like to be able to delete all the mail from the command line.
    Is that possible?
    Thanks,

    Hi BriGy,
    Base on my search, if you want to remove these service account permission, you need to remove from organizational level, not mailbox level.
    Please refer to the following thread, it may give you some hints:
    Deny permissions for Domain Admins on mailboxes
    Best regards,
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact [email protected]
    Niko Cheng
    TechNet Community Support

  • How can I mount an external hard drive via command line

    I have an external hard drive that's been formatted as "Mac OS Extended (Journaled)" (the default option from Disk Utility). I'm in single-user mode and want to mount the drive. I noticed that when I plug in the drive to the USB port I get some new items in the /dev/ directory, namely:
    disk3, disk3s1, disk3s2, rdisk3, rdisk3s1, rdisk3s2
    I imagine I'm only interested in the disk3*, but I'm not sure which one (or what the differences are, there's only 1 partition on the drive).
    Also, I'm not sure which mount command to use, there are several in the /sbin/ directory. I tried the "mount" command and got a message that noted: "Incorrect super block." Any ideas?

    /usr/sbin/diskutil mount /dev/disk3

  • Create an Image from a Component

    Can anybody tell me how to create an Image from a Component?
    I intend to create an Image from a JTable now but I want to have a more generic solution of course to be able to create an Image from any Java / Swing component (Applet, JList, JButton, ...).
    Thank you,
    Dirk

    2 ways:
    1) java.awt.Toolkit.createScreenCapture(Rectangle bounds)
    2) This:
         public static BufferedImage grabByPaint(Component comp) {
              boolean visible = comp.isVisible();
              // if not visible, need to make visible to make sure sizes are correct. 
              if(!visible) {
                   comp.setVisible(true);
              Dimension size = comp.getSize();
              BufferedImage bi = new BufferedImage(size.width, size.height, BufferedImage.TYPE_INT_ARGB);
              Graphics2D g2d = bi.createGraphics();
              comp.paintAll(g2d);
              if(!visible) {
                   comp.setVisible(false);
              g2d.dispose();
              return bi;
         }

  • How I can load images from Creative Cloud storage in photoshop plugin, created in Extension Builder 3 with use html5/css/js?

    How I can load images from Creative Cloud storage in photoshop plugin, created in Extension Builder 3 with use html5/css/js ?

    At this point there is no API for accessing the cloud storage outside Adobe's own closed loop.
    Mylenium

  • How do I remove images from Notes app?

    How do I remove images from Notes app?
    I sometimes find that, when cutting and pasting text from the web, an image is also copied (pretty much at all times I try and avoid this, but sometimes the selection process doesn't allow for fine enough control - e.g. a whole block of content may be selected, rather than just the few words I'm trying to copy).
    I then find, once it's part of my note, that I cannot select the unwanted image and remove it. Can anyone tell me if this is something that can be done, and if so... how?
    Thanks, Sebastain

    Hi Drew & Kilgore*
    Thanks for your replies. I also have and use Simplenote, although I went off it for a while, when it started crashing all the time on me. It seems to be more stable again now, so I'll start using it more regularly again, perhaps.
    I am, obviously, disappointed that one can't simply select ANY object within a Notes document and choose to delete it. As I rather suspected, the only solution is an annoying workaround. Apple stuff seems to get more like this as time goes by. At least in my experience.
    I solved the issue my own way in the end, but I guess it was close to your 1st idea DR, and your 2nd option, KT: I basically cut and pasted everything above, and then everything below, the image, and pasted both chunks of text into a new note. So it took two passes, and left me with the original note just displaying the image, which I then trashed.
    Tapping to the right of the image followed by deletion was what I hoped & expected would work. But instead the image stayed put and the text below the cursor would simply slide along the right hand side, moving upwards as I deleted! Most bizarre, to my mind at least.
    Anyway thanks for the feedback. But, for anyone else that might want to know how to do this, the answer is: NO, you can't select and delete an image once it's in one of your notes!
    * I quite recently watched the rather strange Bruce Willis / Nick Nolte 'Breakfast of Champions' movie... I think I still prefer the book to the film!

  • How can I import images from iphoto with the albums and folders?

    How can I import images from iphoto without losing the albums and folders I already created?

    In Organizer, you can choose File>get Photos and Videos>From iPhoto.
    Importing from iPhoto'09: If in iPhoto, you organize your media using photo references, that is, the media actually does not reside inside iPhoto library package, and are referenced through original locations, Organizer does not create new copies of those media and just refer to the original location. but if your iPhoto media reside inside iPhoto library, Organizer creates a copy all media in your pictures folder, also imports albums and tags and other metadata.
    Importing from iPhoto'011: In this case, Organizer always creates a copy of your photos in your pictures folder which resides inside iPohto package. It does not import the albums and other metadata like star rating, caption etc.
    Hope this information helps!
    regards,
    vaishali

Maybe you are looking for

  • IPod not being read, iPod Updater will not work HELP!!

    needing help on a problem i've been trying to solve on my own for a day or so. My iPod will not be read by iTunes anymore, and iPod Updater will not Restore it to factory settings.. need some help here, need to know anything else? just ask. thanks fo

  • How to tell Front Row to look for movies on a USB drive?

    I'm working on getting all my dvd's on two 500gb usb drives - using Handbrake to encode everything. This is much faster with a new 2.4ghz 24" iMac by the way (6-8hrs on my 1.8ghz athlon vs 1-2 with the iMac...woohoo). What I'm trying to do is get the

  • Email Attachment is not Working for xml file

    Hi All, if any one has any answer to this below Query, Your help will be highly appreciated. 1- while configuring the email for attachment i am getting the selection failure Error in Content Encoding line where i am setting the base64 for encoding. P

  • HOW TO SECURE THE URL

    Hi when i logon to the portal to the backend system to retrieve the forms/reports.   The url which was store in temporary internet files directory is used to open the backend system directly. without logon to the portal.   Even though when i was logo

  • Wrapping In Internet Explorer 10

    My label in All browsers appear as " Select Input Name " but in Internet Explorer 10 appears as Select Input Name Can you tell me why is there wrapping in IE 10? How do I correct this issue? Thanks in advance