Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

MBS FileMaker Plugin Example Databases

SVG to PNG

All examples are included with download of MBS FileMaker Plugin.

SVG to PNG.fmp12

Overview
Tables1
Relationships0
Layouts1
Scripts2
Value Lists0
Custom Functions0
Custom Menus0
File Options
Default custom menu set[Standard FileMaker Menus]
When opening file
Minimum allowed version12.0
Login usingAccount Name; Account= Admin
Allow user to save passwordOff
Require iOS passcodeOff
Switch to layoutOff
Hide all toolbarsOff
Script triggers
OnFirstWindowOpenOff
OnLastWindowCloseOff
OnWindowOpenOff
OnWindowCloseOff
OnFileAVPlayerChangeOff
Thumbnail Settings
Generate ThumbnailsOn; Temporary

 

Tables

Table Name
Statistics
Occurrences in Relationship Graph
SVG to PNG
5 fields defined, 2 records
SVG to PNG

Fields

Table Name: SVG to PNG - 5 Fields
Field NameTypeOptionsCommentsOn LayoutsIn RelationshipsIn ScriptsIn Value Lists
InputFileNormal, BinaryAuto-Enter:
  • Allow editing
Validation:
  • Only during data entry
Storage:
  • Repetitions: 1
      OutputFileNormal, BinaryAuto-Enter:
      • Allow editing
      Validation:
      • Only during data entry
      Storage:
      • Repetitions: 1
          Target Width in PixelNormal, NumberAuto-Enter:
          • Allow editing
          Validation:
          • Only during data entry
          Storage:
          • Repetitions: 1
          • Indexing: None
          • Automatically create indexes as needed
          • Index Language: German
              Target Height in PixelNormal, NumberAuto-Enter:
              • Allow editing
              Validation:
              • Only during data entry
              Storage:
              • Repetitions: 1
              • Indexing: None
              • Automatically create indexes as needed
              • Index Language: German
                  Resolution in DPINormal, NumberAuto-Enter:
                  • Allow editing
                  Validation:
                  • Only during data entry
                  Storage:
                  • Repetitions: 1
                  • Indexing: None
                  • Automatically create indexes as needed
                  • Index Language: German

                      Layout Objects: SVG to PNG

                      Regular Fields

                      Field Name: SVG to PNG::InputFile
                      Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                      • Top: 108 pt
                      • Left: 73 pt
                      • Bottom: 521 pt
                      • Right: 501 pt
                      • Anchoring: Left, Top
                      Field Format:
                      • Edit Box
                      Field Behavior:
                      • Allow field to be entered: In Find mode, In Browse mode
                      • Touch keyboard type: Default for Data Type
                      • Go to next field using: Tab key
                      No

                      Field Name: SVG to PNG::OutputFile
                      Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                      • Top: 108 pt
                      • Left: 576 pt
                      • Bottom: 521 pt
                      • Right: 1004 pt
                      • Anchoring: Left, Top
                      Field Format:
                      • Edit Box
                      Field Behavior:
                      • Allow field to be entered: In Find mode, In Browse mode
                      • Touch keyboard type: Default for Data Type
                      • Go to next field using: Tab key
                      No

                      Field Name: SVG to PNG::Target Width in Pixel
                      Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                      • Top: 529 pt
                      • Left: 422 pt
                      • Bottom: 550 pt
                      • Right: 501 pt
                      • Anchoring: Left, Top
                      Field Format:
                      • Edit Box
                      Field Behavior:
                      • Allow field to be entered: In Find mode, In Browse mode
                      • Touch keyboard type: Default for Data Type
                      • Go to next field using: Tab key
                      Yes

                      Field Name: SVG to PNG::Target Height in Pixel
                      Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                      • Top: 552 pt
                      • Left: 422 pt
                      • Bottom: 573 pt
                      • Right: 501 pt
                      • Anchoring: Left, Top
                      Field Format:
                      • Edit Box
                      Field Behavior:
                      • Allow field to be entered: In Find mode, In Browse mode
                      • Touch keyboard type: Default for Data Type
                      • Go to next field using: Tab key
                      Yes

                      Field Name: SVG to PNG::Resolution in DPI
                      Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                      • Top: 575 pt
                      • Left: 422 pt
                      • Bottom: 596 pt
                      • Right: 501 pt
                      • Anchoring: Left, Top
                      Field Format:
                      • Edit Box
                      Field Behavior:
                      • Allow field to be entered: In Find mode, In Browse mode
                      • Touch keyboard type: Default for Data Type
                      • Go to next field using: Tab key
                      Yes

                      Buttons

                      Button PropertiesCoordinatesScript/Script Step
                        Type:
                      • Text: Convert
                      • Top: 529 pt
                      • Left: 885 pt
                      • Bottom: 560 pt
                      • Right: 1004 pt
                      • Anchoring: Left, Top
                      Perform Script [ “Convert” ]

                      Scripts:


                      Script Hierarchy

                      Convert
                      Convert old

                      Next Script: [Convert old]
                      Script NameConvert
                      Run script with full access privilegesOff
                      Include In MenuYes
                      Layouts that use this script
                      Scripts that use this script
                        Script Definition
                        Script Steps
                        • #Convert a SVG image to PNG
                        • #Load image from container
                        • Set Variable [ $size; Value:"500x500" ]
                        • If [ SVG to PNG::Target Width in Pixel > 0 and SVG to PNG::Target Height in Pixel > 0 ]
                        • Set Variable [ $size; Value:SVG to PNG::Target Width in Pixel & "x" & SVG to PNG::Target Height in Pixel ]
                        • End If
                        • Set Variable [ $image; Value:MBS( "GMImage.New"; $Size; "transparent" ) ]
                        • If [ 1 // transparent background? ]
                        • #RGBA
                        • Set Variable [ $r; Value:MBS( "GMImage.SetType"; $image; 7 ) ]
                        • #let's draw on transparent
                        • Set Variable [ $r; Value:MBS( "GMImage.SetBackgroundColor"; $image; "transparent" ) ]
                        • Else
                        • #RGB
                        • Set Variable [ $r; Value:MBS( "GMImage.SetType"; $image; 6 ) ]
                        • #let's draw on white
                        • Set Variable [ $r; Value:MBS( "GMImage.SetBackgroundColor"; $image; "white" ) ]
                        • End If
                        • #load into image
                        • Set Variable [ $r; Value:MBS( "GMImage.ReadFromContainer"; $image; SVG to PNG::InputFile; $size; 0; "SVG" ) ]
                        • If [ MBS ("ISError") ]
                        • Show Custom Dialog [ Title: "Failed to load image"; Message: $r; Default Button: “OK”, Commit: “Yes” ]
                        • Exit Script [ ]
                        • End If
                        • #If a resolution is defined, put it in
                        • If [ SVG to PNG::Resolution in DPI > 0 ]
                        • Set Variable [ $r; Value:MBS( "GMImage.SetResolutionUnits"; $image; 1 /* pixel per inch */ ) ]
                        • Set Variable [ $r; Value:MBS( "GMImage.SetDensity"; $image; SVG to PNG::Resolution in DPI & "x" & SVG to PNG::Resolution in DPI) ]
                        • End If
                        • #Output to container and release image
                        • Set Field [ SVG to PNG::OutputFile; MBS( "GMImage.WriteToPNGContainer"; $image; "test.png") ]
                        • Set Variable [ $r; Value:MBS("GMImage.Free"; $image) ]
                        Fields used in this script
                        Scripts used in this script
                          Layouts used in this script
                            Tables used in this script
                            Table occurrences used by this script
                            Custom Functions used by this script
                              Custom menu set used by this script

                                Previous Script: [Convert]
                                Script NameConvert old
                                Run script with full access privilegesOff
                                Include In MenuYes
                                Layouts that use this script
                                  Scripts that use this script
                                    Script Definition
                                    Script Steps
                                    • #Convert a SVG image to PNG
                                    • #Load image from container
                                    • Set Variable [ $image; Value:MBS( "GMImage.NewFromContainer"; SVG to PNG::InputFile ) ]
                                    • #query the file name
                                    • Set Variable [ $name; Value:MBS( "Files.FileName"; GetAsText(SVG to PNG::InputFile) ) ]
                                    • #Scale if parameters are filled in fields
                                    • If [ IsEmpty ( SVG to PNG::Target Width in Pixel ) ]
                                    • If [ IsEmpty ( SVG to PNG::Target Height in Pixel ) ]
                                    • #both empty, do nothing
                                    • Else
                                    • #Resize to this heigth if the image is greater than the geometry specification
                                    • Set Variable [ $r; Value:MBS( "GMImage.Scale"; $image; "99999x" & SVG to PNG::Target Height in Pixel & ">") ]
                                    • End If
                                    • Else
                                    • If [ IsEmpty ( SVG to PNG::Target Height in Pixel ) ]
                                    • #Scale with given width and empty height
                                    • Set Variable [ $r; Value:MBS( "GMImage.Scale"; $image; SVG to PNG::Target Width in Pixel& ">" ) ]
                                    • Else
                                    • #both set
                                    • Set Variable [ $r; Value:MBS( "GMImage.Scale"; // function $image; // pass in picture SVG to PNG::Target Width in Pixel & // width "x" & // by SVG to PNG::Target Height in Pixel & // height ">" // scale only if it will get smaller ) ]
                                    • End If
                                    • End If
                                    • #If a resolution is defined, put it in
                                    • If [ not IsEmpty ( SVG to PNG::Resolution in DPI ) ]
                                    • Set Variable [ $r; Value:MBS( "GMImage.SetResolutionUnits"; $image; 1 /* pixel per inch */ ) ]
                                    • Set Variable [ $r; Value:MBS( "GMImage.SetDensity"; $image; SVG to PNG::Resolution in DPI & "x" & SVG to PNG::Resolution in DPI) ]
                                    • End If
                                    • #Output to container and release image
                                    • Set Field [ SVG to PNG::OutputFile; MBS( "GMImage.WriteToPNGContainer"; $image; $name & ".png") ]
                                    • Set Variable [ $r; Value:MBS("GMImage.Free"; $image) ]
                                    Fields used in this script
                                    Scripts used in this script
                                      Layouts used in this script
                                        Tables used in this script
                                        Table occurrences used by this script
                                        Custom Functions used by this script
                                          Custom menu set used by this script

                                            Download example: SVG to PNG

                                            Used functions: