B4J Library [Source code] ImageScaler

Introduction:
I don't know if there is any library exist to resize image in B4J non-UI app.
I thought such library will be useful to process images for web server in building REST API for e-commerce or e-learning web apps.
I found an example on web and chose the third method, from an old project call ImgScalr.
I done some experiments and manage to get it work in B4J using Inline Java.
Then I tried to compile the project as a library. boop! Done. It is so easy and I have my .jar and .xml files ready to use.

Supported file types:
  • JPG
  • JPEG
  • PNG
  • BMP
  • WBMP
Note: GIF is not supported

Additional Jar: imgscalr-lib-4.2.jar



ImageScaler
Author:
Aeric Poon
Version: 1.00
  • ImageScaler
    • Functions:
      • Initialize As String
      • IsInitialized As Boolean
      • Resizeimage (InputDir As String, OutputDir As String, Filename As String, Width As Int, Height As Int, Mode As String) As String
        Mode: AUTOMATIC, FIT_EXACT, FIT_TO_HEIGHT and FIT_TO_WIDTH
        Reference: https://www.baeldung.com/java-resize-image

        Example: Private img As ImageScaler
        img.Initialize
        img.ResizeImage(File.DirApp, File.DirApp, "sonic.jpg", 200, 200, "AUTOMATIC")
 

Attachments

  • ImageScaler.jar
    2.8 KB · Views: 122
  • ImageScaler.xml
    1.8 KB · Views: 127
  • imgscalr-lib-4.2.jar
    27.2 KB · Views: 124
  • Source.zip
    1.9 KB · Views: 120
Last edited:
Top