Skip to main content

Adding a Stroke around text ...



  • Malcolm Hendeson

    Further to my post above, for anyone having the same issues ...

    I managed to add the 'stroke' parameter to my PHP file. You need to add "stroke"=>"stroke" to turn it on and the stroke size and colour is determined by a border setting, such as "border"=>"25px_solid_black".

    Here is the complete section of PHP code from my post, with the stroke and border elements added -

    "overlay"=>array("font_family"=>"Victorian.ttf", "font_size"=>160, "text"=>"\n".$eventTxt, "stroke"=>"stroke"), "y"=>340, "x"=>200, "w"=>1100, "h"=>150, "color"=>$colTxt, "border"=>"25px_solid_black"),


    A further issue is that text is cropped very closely to a transparent bounding box. No worries for plain text, but when you try to add a stroke it's cut off in parts by the bounding box. My solution to this was to start the text one line down, hence the "\n" escaped newline in my code. The stroke can then be fully rendered around the text.

    Hope this helps anyone else struggling with this.

  • Raz Ziv

    Hey Malcolm,

    I'm happy to see that you've already managed to find the solution for your use case.

    We truly appreciate you sharing your example here for any other members reaching this thread with the same question. Thank you for your contribution :)

    If you have any other questions, please do not hesitate to let us know.

    Kind regards,

  • Malcolm Hendeson

    Thank you Raz. Everything is working fine now.

    I use Cloudinary to produce product mockups that usually require image distortion transformations, or displacements, and Cloudinary has saved me hours (days, weeks!) of Photoshop work by allowing me to automate the process.


    I now have my own web apps that I can run anywhere without ever requiring Photoshop.

  • Erwin Lukas

    Hi Malcolm,

    I'm glad it works for you now and happy to hear it saved you a lot of hours :)

    Erwin Lukas


Post is closed for comments.