0

I am getting error as below.

Fatal error: Uncaught exception 'ImagickException' with message 'unable to open file `/var/www/vhosts/websites/example.com/temp/1465979640_1.png' @ error/png.c/ReadPNGImage/3639'

My convert command is as below.

convert -background none -font /var/www/vhosts/websites/example.com/fonts/arial.ttf -fill 'rgb(86, 0, 109)' -pointsize 100 label:"Test" /var/www/vhosts/websites/example.com/temp/1465979640_1.png

Where output image is not there. I want to create new image using font and text.

Can anyone help me with it?

emcconville
  • 23,800
  • 4
  • 50
  • 66
  • Try removing the font and pointsize, and setting the fill to `yellow` and writing in the local directory and see what happens... I am suggesting you simplify your command to something like `convert -background blue -fill yellow -pointsize 100 label:"test" a.png` – Mark Setchell Jun 15 '16 at 08:47
  • @MarkSetchell I tried to simplify the command. But no luck. Getting same error. –  Jun 15 '16 at 10:52
  • Mmmm.. try `convert -size 100x100 xc:red a.png` – Mark Setchell Jun 15 '16 at 10:54
  • @MarkSetchell First of all, Thank you for your answers. When I use your command it is generating red box of 100x100. But can you tell me what is wrong with my command? If I add xc:red in my command it is generating red box also. –  Jun 15 '16 at 12:07
  • I don't know what is wrong with your command/environment. Something is wrong, so I suggest you start with a simple command and gradually add parts of your own till it goes wrong. – Mark Setchell Jun 15 '16 at 12:15
  • Is the destination directory writeable? It may be owned by the HTTPD user. – emcconville Jun 15 '16 at 13:38
  • @emcconville I wondered that, but it is actually failing to *read* not write... – Mark Setchell Jun 15 '16 at 13:57
  • @MarkSetchell The error is in reading image because I am resizing the created image. Actually I am creating image from the text and font but image is not getting created. –  Jun 16 '16 at 08:13
  • What version are your running? `identify -version` – Mark Setchell Jun 16 '16 at 08:40
  • Try removing the `-font`, the `-fill` and the `-pointsize` from your command and writing the result in the current directory. If that works, start adding back in the other aspects of your command unit it fails then look carefully at the last thing you added back. – Mark Setchell Jun 16 '16 at 08:42
  • @MarkSetchell convert -size 100x100 xc:red /path/to/my/file.png - Working convert -size 100x100 /path/to/my/file.png - Not working Can you tell me what is wrong here? Why I have to include xc: to my command to make it work? –  Jun 17 '16 at 11:49
  • I suggested you remove the `-pointsize`, `-font` and `-fill` **not** the `xc:`. The `xc:` creates a canvas for you to draw on or colour in, if you don't have that, you don't have an image and there is nothing to write to your image file. Likewise, `label:` creates a piece of canvas with letters on it, so you need one or the other. You didn't tell me your version. – Mark Setchell Jun 17 '16 at 12:09
  • @MarkSetchell I have to remove label and replace it with -draw. Not it is working. Many thanks for all your help and emcconville yours too. –  Jun 18 '16 at 10:24
  • @MarkSetchell Actually it was damn new policies that blocked the use of "label" in command. –  Jun 23 '16 at 07:17
  • Policies seem to be causing many problems... http://stackoverflow.com/a/37962008/2836621 – Mark Setchell Jun 23 '16 at 08:35

0 Answers0