object Utils
Functional utilities for image processing with safe IO using Either.
All operations that involve reading or writing files return Either[String, File], where Left(errorMessage) indicates failure and Right(file) indicates success.
- Alphabetic
- By Inheritance
- Utils
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def autoCrop(inputFile: File, outputFile: File, bgColor: Option[Color] = None): Either[String, File]
Automatically crops an image, optionally using a color as the background reference, safely.
Automatically crops an image, optionally using a color as the background reference, safely.
- inputFile
the input file to crop
- outputFile
the destination file
- bgColor
optional Color used as background
- returns
Either[String, File]
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @HotSpotIntrinsicCandidate() @native()
- def convertToWebp(inputFiles: Seq[File], outputDir: File): Seq[Either[String, File]]
Convert a list of images to WebP safely.
Convert a list of images to WebP safely.
- inputFiles
list of image files
- outputDir
folder to save converted images
- returns
sequence of Either[String, File]
- def convertToWebp(inputFile: File, outputDir: File): Either[String, File]
Convert a single image to WebP safely.
Convert a single image to WebP safely.
- inputFile
the image file to convert
- outputDir
folder to save the converted image
- returns
Either an error message or the output File
- def createThumbnail(inputFiles: Seq[File], outputDir: File, thumbType: String): Seq[Either[String, File]]
Generate thumbnails for a list of images safely.
Generate thumbnails for a list of images safely.
- inputFiles
list of image files
- outputDir
folder to save thumbnails
- thumbType
"desktop" or "mobile"
- returns
sequence of Either[String, File]
- def createThumbnail(inputFile: File, outputDir: File, thumbType: String): Either[String, File]
Generate a thumbnail for a single image safely.
Generate a thumbnail for a single image safely.
- inputFile
the image file
- outputDir
folder to save thumbnail
- thumbType
"desktop" or "mobile"
- returns
Either an error message or the thumbnail File
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def generatePlaceholders(number: Int, width: Int, height: Int, fillColor: Option[Color] = None, applyBlur: Boolean = true, outputDir: File): Seq[Either[String, File]]
Generates a series of placeholder images safely.
Generates a series of placeholder images safely.
- number
the number of placeholder images to generate
- width
width of each image
- height
height of each image
- fillColor
optional Color to fill the image; if None, transparent
- applyBlur
whether to apply a blur effect
- outputDir
folder to write placeholder images
- returns
sequence of Either[String, File]
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def listImages(inputDir: File): Seq[File]
List all supported image files in a folder.
List all supported image files in a folder.
- inputDir
the folder to scan for image files
- returns
sequence of valid image files
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- def stripMetadata(inputFile: File, outputFile: File): Either[String, File]
Removes all metadata from an image and saves it as a clean PNG safely.
Removes all metadata from an image and saves it as a clean PNG safely.
- inputFile
the image file to process
- outputFile
destination file for stripped image
- returns
Either[String, File]
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- object OCR
Utility object for performing image preprocessing tasks for OCR.
Utility object for performing image preprocessing tasks for OCR.
This includes rotation correction, grayscale conversion, contrast adjustment, and optional binarization. All functions that manipulate pixels are pure and do not perform IO.
- object PaletteMaker
palette maker
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated
(Since version 9)