本文整理汇总了Java中org.apache.sanselan.ImageInfo.COMPRESSION_ALGORITHM_NONE属性的典型用法代码示例。如果您正苦于以下问题:Java ImageInfo.COMPRESSION_ALGORITHM_NONE属性的具体用法?Java ImageInfo.COMPRESSION_ALGORITHM_NONE怎么用?Java ImageInfo.COMPRESSION_ALGORITHM_NONE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.apache.sanselan.ImageInfo
的用法示例。
在下文中一共展示了ImageInfo.COMPRESSION_ALGORITHM_NONE属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getImageInfo
public ImageInfo getImageInfo(ByteSource byteSource, Map params)
throws ImageReadException, IOException
{
FileInfo info = readHeader(byteSource);
if (info == null)
throw new ImageReadException("PNM: Couldn't read Header");
ArrayList Comments = new ArrayList();
int BitsPerPixel = info.getBitDepth() * info.getNumComponents();
ImageFormat Format = info.getImageType();
String FormatName = info.getImageTypeDescription();
String MimeType = info.getMIMEType();
int NumberOfImages = 1;
boolean isProgressive = false;
// boolean isProgressive = (fPNGChunkIHDR.InterlaceMethod != 0);
//
int PhysicalWidthDpi = 72;
float PhysicalWidthInch = (float) ((double) info.width / (double) PhysicalWidthDpi);
int PhysicalHeightDpi = 72;
float PhysicalHeightInch = (float) ((double) info.height / (double) PhysicalHeightDpi);
String FormatDetails = info.getImageTypeDescription();
boolean isTransparent = false;
boolean usesPalette = false;
int ColorType = info.getColorType();
String compressionAlgorithm = ImageInfo.COMPRESSION_ALGORITHM_NONE;
ImageInfo result = new ImageInfo(FormatDetails, BitsPerPixel, Comments,
Format, FormatName, info.height, MimeType, NumberOfImages,
PhysicalHeightDpi, PhysicalHeightInch, PhysicalWidthDpi,
PhysicalWidthInch, info.width, isProgressive, isTransparent,
usesPalette, ColorType, compressionAlgorithm);
return result;
}
示例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;
}