AnsweredAssumed Answered

convert image with transformImage and draw watermark

Question asked by awilczew on Sep 3, 2012
Latest reply on Apr 1, 2014 by christopheradams
We have a script which will resize  images and watermark it with a text.

Our command for transformation is:

width = 120;
height = 120;
Bfontsize =  16;
var thumbImage = n.transformImage( "image/tiff", '-resize '+ width +'x'+ height +'-quality 95 -font Helvetica -pointsize '+ Bfontsize +' -draw "gravity southeast fill silver text 0,12 \'Watermark\'" ',GtargetFolderNeu );

In the version 4.0.c this command will do the job. But after upgrade to 4.0.e  we get a error.

If we just use:

var thumbImage = n.transformImage( "image/tiff", '-resize '+ width +'x'+ height +'-quality 95 ',GtargetFolderNeu );

it will work fine, but if we axpand with watermarking the error will arise. I think in the 3.4 Version it was a similar error. Maybe the quotation marks from the -draw param will not be parsed. Can anyone help me.

Here is the error:

2012-09-03 08:29:32,154  DEBUG [content.transform.TransformerDebug] [http-8080-31] 118         store://2012/8/31/16/1/b2681636-48b1-48a6-9798-87d53d3efa5c.bin
2012-09-03 08:29:32,154  DEBUG [content.transform.TransformerDebug] [http-8080-31] 118         jpg  jpg  95K transformer.ImageMagick<<Proxy>>
2012-09-03 08:29:32,154  TRACE [content.transform.TransformerDebug] [http-8080-31] 118         image/jpeg image/jpeg
2012-09-03 08:29:32,280  DEBUG [content.transform.TransformerDebug] [http-8080-31] 118         Failed 08033070 Failed to perform ImageMagick transformation:
Execution result:
   os:         Linux
   command:    [/opt/alfresco-4.0.e/common/bin/convert, /opt/alfresco-4.0.e/tomcat/temp/Alfresco/ImageMagickContentTransformerWorker_source_3037866582266022043.jpg[0], -resize, 100x100, -quality, 95, -font, Helvetica, -pointsize, 30, -draw, gravity southeast fill silver text 0,12 'Watermark', -auto-orien, /opt/alfresco-4.0.e/tomcat/temp/Alfresco/ImageMagickContentTransformerWorker_target_5942017631833632530.jpg]
   succeeded:  false
   exit code:  1
   err:        .convert.bin: unrecognized option `-auto-orien' @ convert.c/ConvertImageCommand/680.

2012-09-03 08:29:32,280  DEBUG [content.transform.TransformerDebug] [http-8080-31] 118         Finished in 126 ms

2012-09-03 08:29:45,434  DEBUG [content.transform.ContentTransformerRegistry] [http-8443-5] Searched for transformer:
   source mimetype: image/jpeg
   target mimetype: text/plain
   transformers: []
2012-09-03 08:29:45,469  DEBUG [content.transform.TransformerDebug] [http-8443-5] 119         jpg  txt  0K ContentService.getTransformer(…) NO transformers
2012-09-03 08:29:45,469  TRACE [content.transform.TransformerDebug] [http-8443-5] 119         image/jpeg text/plain
2012-09-03 08:29:45,469  DEBUG [content.transform.TransformerDebug] [http-8443-5] 119         Finished in 36 ms Transformer NOT called