General HydroStatics
Ship Stability Software
Command of the Week
(New or interesting aspects of GHS that you may not know about)

NOTE {%IMAGE(''file'')%}


If you need to insert images in a GHS report, this is the command to use.

The NOTE command (or its short-form equivalent, which is simply a backslash) is used to place textual notes in a GHS report. But with this special form, it will place the contents of a JPG or BMP file instead of the text.

\{%IMAGE("filename.jpg")%}

Below is an example of a report page produced by placing an image, three lines of text, and then a second image.

Note the text overlaying the first image. This is because the image does not advance the line counter, which makes for some interesting possibilities.



IMAGE offers six optional parameters in addition to the name of the image file. The user's manual provides the essential information about the parameters, but it is rather concise and compact. So here is a handy macro you can put in your run file. It clearly lays out the parameter options.


MACRO IMAGE
` %1: filename (colon after to imbed in print file)
` %2: inches from left or 0: current, -1: left, -2: center, -3: right
` %3: inches from top or 0 for current line
` %4: width to stretch in inches or 0 for no stretch (width=image pix/printer dpi)
` %5: height to stretch in inches or 0 for no stretch
` %6: background RGB color to replace white pixels or 0 for none
` %7: color distance for trimming margins around image,
`         0: none, 1: white, n: RGB components above 255-n
NOTE{%IMAGE("%1",%2,%3,%4,%5,%6,%7)%}
/

In the above report page, you may recognize the plan view of the vessel as resembling a DISPLAY STATUS PLAN but with some differences: it lacks the border and it does not take the entire page width. How did we do that?

Two things make this possible: 1) the DISPLAY STATUS command has a /PRINT parameter that allows you to send its output to a file rather than having it appear directly in the report; 2) the COPY command can convert a report (PF) file to a JPG file:


DISPLAY (*) STATUS PLAN:WITHSAILS /PRINT:distat.pf
COPY distat.pf distat.jpg /CONVERT /CROP: 0.95, 1.0, 6.6, 5.0

Notice that COPY can crop the image while it does the conversion. This is a handy way to trim off unwanted margins, and it can be done right in your run file without requiring any hand work.

Having done that, it only remains to bring the JPG image in via your IMAGE macro:


.IMAGE "distat.jpg:", -3, 0, 4.0, 3.0

Now let's look at the parameters that were used.

The -3 causes the image to appear on the right. Then the 0 means to leave it at the top of the page. Finally the 4.0, 3.0 specify the width and height dimensions in inches. This depends on the geometry of the vessel and the type of views being shown and may require a little experimentation to get it to look just right.

The other image on the page was placed after putting out the three NOTE lines and spacing down to clear the first image. Here are the commands that produced the entire page:



What else would look good in a GHS report?

Nothing represents the vessel as well as an actual photo. Owners are proud of their ships, and to see a nice photograph of the vessel is sure to please.

To add the photo on the next page, only the IMAGE command was needed:


page
.IMAGE "mycatphoto.jpg:"



We should point out one more thing: Images can be embedded in the report file simply by putting a colon after the file name as we have done here. That makes the report self-contained and more easily distributed. In fact the print files you get from GHS can be viewed by anyone, even if they do not have GHS. Click here for details.
Questions, comments, or requests?
Contact Creative Systems, Inc.

support@ghsport.com

USA phone: 360-385-6212 Fax: 360-385-6213
Office hours: 7:00 am - 4:00 pm Pacific Time, Monday - Friday

Mailing address:
PO Box 1910
Port Townsend, WA 98368 USA

www.ghsport.com

Click here for an index to this and previous COWs