• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

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

New Here ,
May 31, 2012 May 31, 2012

Copy link to clipboard

Copied

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

Views

819

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 01, 2012 Jun 01, 2012

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jun 01, 2012 Jun 01, 2012

Copy link to clipboard

Copied

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-with-ColdFusion-8

--Dave

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Jun 02, 2012 Jun 02, 2012

Copy link to clipboard

Copied

LATEST

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])

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation