|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.hd.d.pg2k.svrCore.ImageUtils
public final class ImageUtils
Basic image-handling utilities.
| Constructor Summary | |
|---|---|
private |
ImageUtils()
Prevent instantiation. |
| Method Summary | |
|---|---|
static boolean |
canBeOwnThumbnail(ExhibitStaticAttr esa)
Returns true if exhibit might be used as own thumbnail (in an HTML page for example). |
static boolean |
canInlineInHTMLPageSimple(ExhibitMIME.ExhibitTypeParameters exhibitType)
Returns true if the given MIME-type can always be inlined in an HTML page. |
private static int |
computeIndexBitsForByteIndexColorMap(int paletteSize)
Compute the number of bits to store the pixel of an indexed image given the size of the palette; strictly positive power of two up to 8. |
static java.awt.image.BufferedImage |
convertRenderedImageToBufferedImage(java.awt.image.RenderedImage ri)
Method to convert a RenderedImage to a BufferedImage. |
static java.awt.image.BufferedImage |
convertToTrueColourARGB(java.awt.image.BufferedImage src,
boolean forceCopy)
Return true-colour ARGB format image if src is indexed, else return original. |
static int |
countDistinct24BitRGBColours(java.awt.image.BufferedImage im)
Count distinct colours in 24-bit RGB colour space. |
static java.awt.image.ColorModel |
extractColorModelOrRGB(java.awt.image.BufferedImage imageIn)
Extract the ColorModel of the inpuit image, or return the default RGB model; never null. |
static java.awt.image.BufferedImage |
makeColourReducedBufferedImage(java.awt.image.BufferedImage in,
int maxColours,
boolean forceByteIndexModel)
Create colour reduced image; never null A new image is created that is potentially colour-reduced from the original; no new colours should be introduced unless during the conversion to or from the RGB colour space in which reduction is done. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
private ImageUtils()
| Method Detail |
|---|
public static int countDistinct24BitRGBColours(java.awt.image.BufferedImage im)
If the source image is not in RGB format then colour conversion will take place.
Is slow but tries to be reasonably memory efficient.
The input image is not altered.
public static java.awt.image.BufferedImage convertRenderedImageToBufferedImage(java.awt.image.RenderedImage ri)
ri - the image to be converted
(if already a BufferedImage then it is returned intact);
must not be null
public static java.awt.image.BufferedImage makeColourReducedBufferedImage(java.awt.image.BufferedImage in,
int maxColours,
boolean forceByteIndexModel)
By default the new image is returned in the same ColorModel as the original, but forcing the result to an indexed (palette-based) model such as used by GIF can requested, in which case the palette size is capped appropriately, and the bits-per-pixel may be chosen to be 1, 2, 4, or 8 depending on the palette size.
Any input image that can be converted to RGB should be acceptable.
If no colour reduction is achieved and no ColorModel change is requested then the original image is returned; in no case is the original image altered.
This may return a single-colour image if the input image is too tricky and the maximum number of colours it can return is too small, but that will be avoided if possible.
in - the original image; must not be nullmaxColours - maximum number of distinct colours allowed in the
result image (as measured in a 24-bit (8,8,8) sRGB colour space);
must be at least 2 and will be capped to 256 if an indexed model
is forced for the resultforceByteIndexModel - if true, force the result to be a
byte-indexed palette-based color model (maximum 256 colours)
that may be (a) suitable for formats such as GIF and
(b) more compressable
private static int computeIndexBitsForByteIndexColorMap(int paletteSize)
public static java.awt.image.BufferedImage convertToTrueColourARGB(java.awt.image.BufferedImage src,
boolean forceCopy)
The src image is not altered.
src - input image, is not altered; must not be null
public static java.awt.image.ColorModel extractColorModelOrRGB(java.awt.image.BufferedImage imageIn)
imageIn - input image from which to extract the ColorModel;
must not be null
public static boolean canBeOwnThumbnail(ExhibitStaticAttr esa)
An exhibit is potentially inlinable if:
esa - the exhibit details; never null
public static boolean canInlineInHTMLPageSimple(ExhibitMIME.ExhibitTypeParameters exhibitType)
This does not dynamically test the capabilities of the user agent that content is to be shown to.
If the exhibitType argument is null, this returns false.
|
DHD Multimedia Gallery V1.57.21 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||