GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — quarkus-quickstarts/awt-graphics-rest-quickstart at main · JavaGreenHands/quarkus-quickstarts

Expand file tree

/

awt-graphics-rest-quickstart

/
Copy path

Directory actions

More options

More options

Directory actions

More options

More options

Latest commit

 

History

History
History
 
 
/

awt-graphics-rest-quickstart

/
Copy path

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
.mvn/wrapper
.mvn/wrapper
 
 
doc
doc
 
 
src
src
 
 
.dockerignore
.dockerignore
 
 
.gitignore
.gitignore
 
 
README.md
README.md
 
 
mvnw
mvnw
 
 
mvnw.cmd
mvnw.cmd
 
 
pom.xml
pom.xml
 
 

README.md

Outline

Web service to watermark images

This quickstart demonstrates a use case for Quarkus AWT extension.

There is a single POST endpoint that consumes a multipart form data and returns an octet stream with a watermarked PNG image. For the sake of brevity, regardless of the image type posted, the service always returns a PNG image.

Quarkus AWT extension enables a set of ImageIO and AWT functionality in Quarkus Native images. See the extension documentation and tests to learn the available scope. Given the nature of native libraries in JDK implementing various image processing algorithms, venturing outside the tested scope might result in native image build time or runtime failure.

Additional system dependencies

Note microdnf command installing fontconfig library in Dockerfile.jvm and Dockerfile.legacy-jar to support jvm mode. Both freetype and fontconfig libraries are needed for native mode in Dockerfile.native.

Usage with curl

e.g.

curl -F "image=@/tmp/my_image.jpg"  http://localhost:8080/watermark --output /tmp/result.png

Watermarks the given image with some text in the top left corner and a Quarkus icon in the right bottom corner.

Usage with a client code

See ImageResourceTest.java. The test is executed in native mode with:

./mvnw clean verify -Pnative

To run native tests locally, a JDK 11.0.13+ with Mandrel (or GraalVM) 21.3+ is required. Additionally, freetype-devel and fontconfig libraries must be installed.

What the result looks like

This is an example of what this quick start does to an image:

Alt text

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.