Announcing PL/IMAGE: Native Image Manipulation and Processing for Oracle PL/SQL

We’re excited to announce PL/IMAGE, a native PL/SQL package for decoding, editing, and re-encoding PNG and JPEG images entirely inside the Oracle database — no external Java, no OS-level image libraries, and no DIRECTORY objects to manage.

Why native image processing in PL/SQL?

In many Oracle environments — especially Oracle Cloud Infrastructure and Autonomous Database — Java stored procedures, native (C) compilation, and filesystem access simply aren’t available, or aren’t something you want to depend on. Traditionally, even a simple edit like generating a thumbnail, correcting EXIF orientation, or stitching a watermark onto a photo meant shipping bytes out to another tier and back. PL/IMAGE removes that round trip: the whole load–edit–save cycle happens in PL/SQL, working directly on BLOBs.

A simple lifecycle

Every operation follows the same shape: load an image from a BLOB, apply one or more edits, save it back out.

load_image → one or more image operations → save_image

LOAD_IMAGE returns an independent, session-local image reference; the caller may release the source BLOB right after. SAVE_IMAGE encodes the current pixels, releases that reference automatically, and hands back a fresh output BLOB the caller owns.

What PL/IMAGE can do today

Loading, saving & introspection

  • LOAD_IMAGE decodes a PNG or JPEG BLOB into a fresh, independent image context.
  • SAVE_IMAGE encodes the current pixels back to PNG (default) or baseline JPEG, with quality, compression level, and filter control, then releases the context.
  • GET_INFO reports format, MIME type, dimensions, bit depth, color model, alpha, and any pending EXIF orientation — without altering or releasing anything.
  • GET_VERSION reports the package version.

Geometry

  • CROP extracts an exact pixel rectangle.
  • RESIZE scales to explicit dimensions, a single dimension with proportional scaling, or a scale factor — with AUTO, NEAREST, BILINEAR, or AREA filtering.
  • THUMBNAIL fits an image into a target box with CONTAIN or COVER behavior, optional upscale control, and alignment.
  • ROTATE turns an image 90, 180, or 270 degrees; FLIP mirrors it horizontally, vertically, or both.
  • PAD extends the canvas with a solid background; BORDER draws one inside the existing canvas.
  • NORMALIZE_ORIENTATION applies and consumes pending EXIF orientation before other geometric edits run.

Color & alpha

  • GRAYSCALE converts to luminance while preserving alpha exactly.
  • INVERT flips every color sample; alpha is left untouched.
  • THRESHOLD produces pure black-and-white output at a chosen brightness cutoff.
  • FLATTEN composites the whole image over an opaque background, removing transparency — the explicit step before JPEG output.

Compositing & stitching

  • OVERLAY composites one image over another with source-over blending and adjustable opacity; multiple overlays apply in call order.
  • STITCH combines several images into a single canvas, horizontally or vertically, with alignment, gap, and background control.

A quick example

Loading a photo, correcting its orientation, generating a 400×400 thumbnail, and re-encoding it as JPEG takes four calls:

l_src   pl_image.t_image_ref;
l_out   blob;
begin
  l_src := pl_image.load_image(p_source_blob);
  pl_image.normalize_orientation(l_src);
  pl_image.thumbnail(l_src, p_width => 400, p_height => 400);
  l_out := pl_image.save_image(l_src, p_format => 'JPEG', p_jpeg_quality => 85);
end;

What’s next

The current specification covers loading, saving, geometry, color, compositing, and stitching. REMOVE_COLOR, DRAW_TEXT, and GET_METADATA are already scoped as the next additions to the API.

We’d love to hear what you’d build with a fully native, in-database image pipeline — drop your questions or use cases in the comments.

PLslash
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.