Skip navigation
CFGadget
Currently Being Moderated

Is it possible to set a background color attribute when using ImageDrawText?

May 31, 2012 9:55 AM

It's not obvious as to how to set a background color which is by default, black.

 
Replies
  • Currently Being Moderated
    Jun 1, 2012 4:52 AM   in reply to CFGadget

    Err... no it ain't.  There's no "default" because text written with imageDrawText() doesn't have any background colour.  It just writes the text over the top of whatever is there.

     

    Can you provide a repro case that demonstrates what you're seeing.  Also attach "before" and "after" examples of images having been processed by your repro case.

     

    Also: what version of CF are you on, what JVM version, and what OS.

     

    --
    Adam

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 1, 2012 1:46 PM   in reply to CFGadget

    This actually is possible. Here is a link to a blog post I did a while back about creating a pure text image.  You can then, in theory, place the result of that image onto a colored box.

     

    http://blog.dkferguson.com/index.cfm/2009/8/25/Creating-text-image-wit h-ColdFusion-8

     

     

     

    --Dave

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 2, 2012 8:50 PM   in reply to CFGadget

    CFGadget wrote:

     

    It's not obvious as to how to set a background color which is by default, black.

     

    Assuming you mean set the background color of a new image, just set the desired canvas color using hex or a named color ie "red", "white", ...

     

                    ImageNew([source, width, height, imageType, canvasColor])

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points