本文整理汇总了Java中org.apache.sanselan.ImageInfo.COMPRESSION_ALGORITHM_UNKNOWN属性的典型用法代码示例。如果您正苦于以下问题:Java ImageInfo.COMPRESSION_ALGORITHM_UNKNOWN属性的具体用法?Java ImageInfo.COMPRESSION_ALGORITHM_UNKNOWN怎么用?Java ImageInfo.COMPRESSION_ALGORITHM_UNKNOWN使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.apache.sanselan.ImageInfo
的用法示例。
在下文中一共展示了ImageInfo.COMPRESSION_ALGORITHM_UNKNOWN属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getImageInfo
public ImageInfo getImageInfo(ByteSource byteSource, Map params)
throws ImageReadException, IOException
{
// make copy of params; we'll clear keys as we consume them.
params = (params == null) ? new HashMap() : new HashMap(params);
boolean verbose = ParamMap.getParamBoolean(params, PARAM_KEY_VERBOSE,
false);
if (params.containsKey(PARAM_KEY_VERBOSE))
params.remove(PARAM_KEY_VERBOSE);
if (params.size() > 0)
{
Object firstKey = params.keySet().iterator().next();
throw new ImageReadException("Unknown parameter: " + firstKey);
}
IcnsContents contents = readImage(byteSource);
ArrayList images = IcnsDecoder.decodeAllImages(contents.icnsElements);
if (images.isEmpty())
throw new ImageReadException("No icons in ICNS file");
BufferedImage image0 = (BufferedImage) images.get(0);
return new ImageInfo("Icns", 32, new ArrayList(), ImageFormat.IMAGE_FORMAT_ICNS,
"ICNS Apple Icon Image", image0.getHeight(), "image/x-icns", images.size(),
0, 0, 0, 0, image0.getWidth(), false, true, false, ImageInfo.COLOR_TYPE_RGB,
ImageInfo.COMPRESSION_ALGORITHM_UNKNOWN);
}
示例2: getImageInfo
public ImageInfo getImageInfo(ByteSource byteSource, Map params)
throws ImageReadException, IOException
{
ImageContents imageContents = readImageContents(byteSource);
// ImageContents imageContents = readImage(byteSource, false);
if (imageContents == null)
throw new ImageReadException("PSD: Couldn't read blocks");
PSDHeaderInfo header = imageContents.header;
if (header == null)
throw new ImageReadException("PSD: Couldn't read Header");
int Width = header.Columns;
int Height = header.Rows;
ArrayList Comments = new ArrayList();
// TODO: comments...
int BitsPerPixel = header.Depth * getChannelsPerMode(header.Mode);
// System.out.println("header.Depth: " + header.Depth);
// System.out.println("header.Mode: " + header.Mode);
// System.out.println("getChannelsPerMode(header.Mode): " +
// getChannelsPerMode(header.Mode));
if (BitsPerPixel < 0)
BitsPerPixel = 0;
ImageFormat Format = ImageFormat.IMAGE_FORMAT_PSD;
String FormatName = "Photoshop";
String MimeType = "image/x-photoshop";
// we ought to count images, but don't yet.
int NumberOfImages = -1;
// not accurate ... only reflects first
boolean isProgressive = false;
int PhysicalWidthDpi = 72;
float PhysicalWidthInch = (float) ((double) Width / (double) PhysicalWidthDpi);
int PhysicalHeightDpi = 72;
float PhysicalHeightInch = (float) ((double) Height / (double) PhysicalHeightDpi);
String FormatDetails = "Psd";
boolean isTransparent = false; // TODO: inaccurate.
boolean usesPalette = header.Mode == COLOR_MODE_INDEXED;
int ColorType = ImageInfo.COLOR_TYPE_UNKNOWN;
String compressionAlgorithm;
switch (imageContents.Compression)
{
case 0:
compressionAlgorithm = ImageInfo.COMPRESSION_ALGORITHM_NONE;
break;
case 1:
compressionAlgorithm = ImageInfo.COMPRESSION_ALGORITHM_PSD;
break;
default:
compressionAlgorithm = ImageInfo.COMPRESSION_ALGORITHM_UNKNOWN;
}
ImageInfo result = new ImageInfo(FormatDetails, BitsPerPixel, Comments,
Format, FormatName, Height, MimeType, NumberOfImages,
PhysicalHeightDpi, PhysicalHeightInch, PhysicalWidthDpi,
PhysicalWidthInch, Width, isProgressive, isTransparent,
usesPalette, ColorType, compressionAlgorithm);
return result;
}