public class MediaUtils
| Type Params | Return Type | Name and description |
|---|---|---|
|
public static boolean |
isImageFile(File file) |
|
public static void |
optimizeImage(File source, File dest) |
|
public static String |
sniffImageMimeType(File file)Sniffs the actual image format from file content (magic bytes), not the file name/extension - an attachment path is a generic "interesting artifact" string set by the underlying logging layer (only videos get their own, separately-typed field), so it can legitimately point at a screenshot, a .ktrace file, a .har capture, or anything else a keyword decided to attach. |
|
public static void |
to8Bit(File source, File dest) |
|
public static BufferedImage |
to8Bit(BufferedImage image) |
Sniffs the actual image format from file content (magic bytes), not the file name/extension - an
attachment path is a generic "interesting artifact" string set by the underlying logging layer
(only videos get their own, separately-typed field), so it can legitimately point at a screenshot,
a .ktrace file, a .har capture, or anything else a keyword decided to attach. Returns null
for anything that isn't a recognized image format, so callers can skip image-specific handling
(optimization, embedding as a data URL) instead of failing deep inside ImageIO.