Brian Dunning's FileMaker Custom Functions

DrawImage ( width ; height ; colors ; pixelData ; options )

Generates a dynamic image (BMP format) using a color list and a list of pixel values.

  Be the first to rate this function Log in to vote

Joe Rovang   Joe Rovang - Show more from this author

Share on Facebook Share on Twitter

  Sample input:
DrawImage ( 50; 1; "880000¶00DD00"; "11111111111111111111111111111100000000000000000000"; "" )
  Sample output:
BMP image 50px wide, 1px tall, with green bar occupying leftmost 30px, dark red in rightmost 20px

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

This function is a single, portable function that can create a custom BMP image for a calculated container field. This image could be used to generate a custom color swatch, a progress bar, a Gantt chart, or a much more complicated image as desired.

The image is built using a list of hex colors you provide, and a string of letters and numbers representing which color each pixel should be (in the default color depth, you can use 0-9 and A-F for a total of sixteen possible colors, but see the in-calc documentation for how to use different color depths for additional colors).

A simple two-color progress bar would only require you to feed the calculation a string of zeroes and ones to indicate which pixels should be the first defined color (0) and which should be the second defined color (1). You determine which color number each pixel should use, and the function draws the image.

FileMaker 18 is required.

 

Comments

Jonn Howell   Jonn Howell, DataExperience, Inc.
Mar 30, 2020
Joe,

This is a wonderful custom function. I have employed it in a system with FileMaker Pro Advanced 18. It turns out that the same client is mostly still on FMP-16. Is there anyway to get this CF without the While function (else it crashes the application)? - This is way to complex for me to reverse engineer. Thanks! ~Jonn
 
Joe Rovang   Joe Rovang
Mar 30, 2020
Hi John, I'm glad you've found a good use for it. The While function could theoretically be replaced with recursive functions, but because it's used in four different logical loops here, it would require an enormous rewrite and multiple sub-functions to pull off. I think about the best you could do is somehow get the FM18 machine(s) to store the images that the FM16 users need to see. Any chance they have Server 18 and the FM16 clients could call Perform Script on Server?
 

Log in to post comments.

 

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

Support this website.

This library has been a free commmunity resource for FileMaker users and developers for 20 years. It receives no funding and has no advertisements. If it has helped you out, I'd really appreciate it if you could contribute whatever you think it's worth: