top of page

Moji5 Knowledgebase

Open, Save, Close, Resize, Auto Resize, Write Image onto an Image and Write Text onto an Image

M5 have specifically function regarding an image such as open, save, close, resize, auto resize, write image onto an image and write text onto an image.


How to Open, Save, Close, Resize, Auto Resize, Write Image onto an Image and Write Text onto an Image


Create a new behavior. Put the appropriate caption. Click Action wizard.


Click Create an action.


Click Other Scribe Functions.


To open image, select Open Image in Other Scribe Functions dropdown. Click OK.

To save image, select Save Image in Other Scribe Functions dropdown. Click OK.

To close image, select Close Image in Other Scribe Functions dropdown. Click OK.

To resize image, select Resize Image in Other Scribe Functions dropdown. Click OK.

To auto resize image, select Autoresize File Upload Image in Other Scribe Functions dropdown. Click OK.

To write image onto an image, select Write Image onto an Image in Other Scribe Functions dropdown. Click OK.


To write text onto an image, select Write Text onto an Image in Other Scribe Functions dropdown. Click OK.


Click Save changes.


Click Create now.


These are examples of implementation of Open, Save, Close, Resize, Auto Resize, Write Image onto an Image and Write Text onto an Image.


1) Resize Image

Function to re-size an image.


How to resize image


Create a new behavior. Put the appropriate caption. Click Action wizard.


Click Create an action.


Click Other Scribe Functions.


Select Resize Image in Other Scribe Functions dropdown. Click OK.


Click Save changes.


Click View code. Set your desire width and height. Specify your source and destination file path. Check syntax, if no error then click Save and close.


Click Create now.


Run your application. Verify the size of the image is changed.


Before:


After:


2) Write Image onto an Image

Function to write an image onto another image.


How to write image onto an image


Create a new behavior. Put the appropriate caption. Click Action wizard.


Click Create an action.


Click Other Scribe Functions.


Select Write Image onto an Image in Other Scribe Functions dropdown. Click OK.


Click Save changes.


In View code mode, define your image path. Click Check Syntax. If no error then click Save and close.


'Open image
Dim _filetag397489 As String = Data("Image")
If Data("Image") <> ""
    scribe.OpenImage(_filetag397489)

    Dim _positionX814710 As Integer = 0
    Dim _positionY814710 As Integer = 0
    Dim _imagepath814710 As String="C:\Moji\M5\ZukamiPortal\Example\image.png"
    scribe.WriteImageToImage(_positionX814710,_positionY814710, _imagepath814710)

    _filetag397489 = Scribe.SaveImage()
    Scribe.CloseImage()

    'get uploaded file path
    Dim _filepath513075 As String = scribe.GetUploadedFilepath(_filetag397489)

    'set full path
    Dim path As String = "http:\\appsmoji.com\M5\"
    Dim fullPath As String = path & _filepath513075

    'display modified image in Open Image field
    Data("Openimage") = "<img src='" & fullPath & "'>"
End If

Click Create now.


Run your application. Verify that image being embedded into another image.


Before (original image):


After:


3) Write Text onto an Image

Function to write text onto an image.


How to Write Text onto an Image

Create a new behavior. Put the appropriate caption. Click Action wizard.


Click Create an action.


Click Other Scribe Functions.


Select Write Text onto an Image in Other Scribe Functions dropdown. Click OK.


Click Save changes.


In View code mode, specify your text, X position, Y position, font name and size accordingly. Click Check Syntax. If no error then click Save and close.


'Open image
Dim _filetag397489 As String = Data("Image")
If Data("Image") <> ""
    scribe.OpenImage(_filetag397489)

    Dim _texttowrite660505 As String = "Your Text Here"
    Dim _positionX660505 As Integer = 0
    Dim _positionY660505 As Integer = 0
    Dim _fontname660505 As String="Verdana"
    Dim _fontsize660505 As Integer=15
    Dim _error660505 As String = scribe.WriteTextToImage(_positionX660505,_positionY660505, _texttowrite660505, _fontname660505, _fontsize660505)

    _filetag397489 = Scribe.SaveImage()
    Scribe.CloseImage()

    'get uploaded file path
    Dim _filepath513075 As String = scribe.GetUploadedFilepath(_filetag397489)

    'set full path
    Dim path As String = "http:\\appsmoji.com\M5\"
    Dim fullPath As String = path & _filepath513075

    'display modified image in Open Image field
    Data("Openimage") = "<img src='" & fullPath & "'>"
End If

Click Create now.


Run your application. Verify that text being wrote into an image.


Before:


After:







bottom of page