0

Imagine when you open my png image a picture opens that looks like

                  /88888888888888888888888888\
                  |88888888888888888888888888/
                   |~~____~~~~~~~~~"""""""""|
                  / \_________/"""""""""""""\
                 /  |              \         \
                /   |  88    88     \         \
               /    |  88    88      \         \
              /    /                  \        |
             /     |   ________        \       |
             \     |   \______/        /       |
  /"\         \     \____________     /        |
  | |__________\_        |  |        /        /
/""""\           \_------'  '-------/       --
\____/,___________\                 -------/
------*            |                    \
  ||               |                     \
  ||               |                 ^    \
  ||               |                | \    \
  ||               |                |  \    \
  ||               |                |   \    \
  \|              /                /"""\/    /
     -------------                |    |    /
     |\--_                        \____/___/
     |   |\-_                       |
     |   |   \_                     |
     |   |     \                    |
     |   |      \_                  |
     |   |        ----___           |
     |   |               \----------|
     /   |                     |     ----------""\
/"\--"--_|                     |               |  \
|_______/                      \______________/    )
                                              \___/

I want a unix commmand like

addText "Some\nInserted\nText" picture.png

That will make the picture like

                  /88888888888888888888888888\
 Some             |88888888888888888888888888/
 Inserted          |~~____~~~~~~~~~"""""""""|
 Text             / \_________/"""""""""""""\
                 /  |              \         \
                /   |  88    88     \         \
               /    |  88    88      \         \
              /    /                  \        |
             /     |   ________        \       |
             \     |   \______/        /       |
  /"\         \     \____________     /        |
  | |__________\_        |  |        /        /
/""""\           \_------'  '-------/       --
\____/,___________\                 -------/
------*            |                    \
  ||               |                     \
  ||               |                 ^    \
  ||               |                | \    \
  ||               |                |  \    \
  ||               |                |   \    \
  \|              /                /"""\/    /
     -------------                |    |    /
     |\--_                        \____/___/
     |   |\-_                       |
     |   |   \_                     |
     |   |     \                    |
     |   |      \_                  |
     |   |        ----___           |
     |   |               \----------|
     /   |                     |     ----------""\
/"\--"--_|                     |               |  \
|_______/                      \______________/    )
                                              \___/

I tried using convert form image magyk but it seems likes it's immensely complicated and like I would pretty much have to learn a language in order to do just this one command I would like to do

Alex
  • 15
  • 6
  • You could go and learn C. There are lots of libraries available to both read and write PNGs, and to render arbitrary texts in arbitrary fonts. – Jongware Jul 06 '16 at 15:45
  • Which ones. I do know C. @RadLexus – Alex Jul 06 '16 at 16:01
  • I would rather just be able to do it in shell if possible though, because I make a lot of png's in a shell script and would like to just be able to use a command within the script to add stuff – Alex Jul 06 '16 at 16:04
  • Did you install ImageMagick with homebrew too? – Mark Setchell Jul 12 '16 at 10:29

1 Answers1

0

You can just do this in the shell at the commandline:

convert image.png -fill blue -pointsize 36 -annotate +25+50 'Some\nfunky\ntext' result.png

enter image description here

Mark Setchell
  • 191,897
  • 31
  • 273
  • 432
  • Thank-you, I get this when I run the command though convert: no decode delegate for this image format `PNG' @ error/constitute.c/ReadImage/508. convert: no images defined `result.png' @ error/convert.c/ConvertImageCommand/3235. – Alex Jul 06 '16 at 15:36
  • You haven't got `libpng` installed, I suspect. Either install it, or use GIF or JPEG or some other format. – Mark Setchell Jul 06 '16 at 17:31
  • I tried install it by the instructions on this website, http://mac-dev-env.patrickbougie.com/libpng/ , and got the exact same error message, I didn't have an src folder though so I made an src folder and did the instructions in there as well as just usr/local and got the exact same error messages both times. – Alex Jul 07 '16 at 23:36
  • Please have a look at the following and don't choose the *"Life of Agony"* method. `homebrew` is your **very best friend** on OSX if you are a software developer. Want **ImageMagick**? `brew install imagemagick`. Want **GNU Parallel**? `brew install parallel`. Want **PHP**? Want YouTube downloader? Want **tmux**? Want **wget**? Want to find a database? `brew search sql`. Want **libpng**? `brew install libpng`.... http://stackoverflow.com/a/34530109/2836621 – Mark Setchell Jul 08 '16 at 07:05
  • That didn't help me at step 2 I got xcode-select --install xcode-select: error: command line tools are already installed, use "Software Update" to install updates I feel like I keep looking up different solutions and nothings working for me, I've tried about 5-10 different ways of trying to install this and getting nothing – Alex Jul 09 '16 at 00:34
  • Also when I do brew install libpng I get uofs-10-228-1-17:jul8 Sam$ brew install libpng Warning: libpng-1.6.21 already installed And I still get the same error when entering the convert command as I got before – Alex Jul 09 '16 at 00:36
  • Did you install **ImageMagick** with **homebrew** too? – Mark Setchell Jul 10 '16 at 21:49