Package org.apache.sanselan

Examples of org.apache.sanselan.ImageFormat


{

  private static boolean isGif(File file) throws IOException,
      ImageReadException
  {
    ImageFormat format = Sanselan.guessFormat(file);
    return format == ImageFormat.IMAGE_FORMAT_GIF;
  }
View Full Code Here


{

  private static boolean isBmp(File file) throws IOException,
      ImageReadException
  {
    ImageFormat format = Sanselan.guessFormat(file);
    return format == ImageFormat.IMAGE_FORMAT_BMP;
  }
View Full Code Here

          "@broken"))
        checkGetImageInfo(imageFile, imageFileBytes);

      checkGetImageSize(imageFile, imageFileBytes);

      ImageFormat imageFormat = Sanselan.guessFormat(imageFile);
      if (ImageFormat.IMAGE_FORMAT_JPEG == imageFormat
          || ImageFormat.IMAGE_FORMAT_UNKNOWN == imageFormat)
        ;
      else
        checkGetBufferedImage(imageFile, imageFileBytes);
View Full Code Here

  public void checkGuessFormat(File imageFile, byte[] imageFileBytes)
      throws IOException, ImageReadException
  {
    // check guessFormat()
    ImageFormat imageFormatFile = Sanselan.guessFormat(imageFile);
    assertTrue(imageFormatFile != null);
    assertTrue(imageFormatFile != ImageFormat.IMAGE_FORMAT_UNKNOWN);
    // Debug.debug("imageFormatFile", imageFormatFile);

    ImageFormat imageFormatBytes = Sanselan.guessFormat(imageFileBytes);
    assertTrue(imageFormatBytes != null);
    assertTrue(imageFormatBytes != ImageFormat.IMAGE_FORMAT_UNKNOWN);
    // Debug.debug("imageFormatBytes", imageFormatBytes);

    assertTrue(imageFormatBytes == imageFormatFile);
View Full Code Here

      throws IOException, ImageReadException, IllegalAccessException,
      IllegalArgumentException, InvocationTargetException
  {
    Map params = new HashMap();
    boolean ignoreImageData = isPhilHarveyTestImage(imageFile);
    ImageFormat imageFormat = Sanselan.guessFormat(imageFile);
    if (imageFormat.equals(ImageFormat.IMAGE_FORMAT_TIFF)
        || imageFormat.equals(ImageFormat.IMAGE_FORMAT_JPEG))
      params
          .put(PARAM_KEY_READ_THUMBNAILS, new Boolean(
              !ignoreImageData));

    ImageInfo imageInfoFile = Sanselan.getImageInfo(imageFile, params);
View Full Code Here

{

  private static boolean isTiff(File file) throws IOException,
      ImageReadException
  {
    ImageFormat format = Sanselan.guessFormat(file);
    return format == ImageFormat.IMAGE_FORMAT_TIFF;
  }
View Full Code Here

{

  private static boolean isPng(File file) throws IOException,
      ImageReadException
  {
    ImageFormat format = Sanselan.guessFormat(file);
    return format == ImageFormat.IMAGE_FORMAT_PNG;
  }
View Full Code Here

          !isUsableParameter(resizeQuality)) {
        return;
      }

      // Content header checking is fast so this is fine to do for every response.
      ImageFormat imageFormat = Sanselan
          .guessFormat(new ByteSourceInputStream(response.getContentBytes(), uri.getPath()));

      if (imageFormat == ImageFormat.IMAGE_FORMAT_UNKNOWN) {
        enforceUnreadableImageRestrictions(uri, response);
        return;
View Full Code Here

    try {
      String contentType = resp.getHeader("Content-Type");
      if (contentType == null || contentType.toLowerCase().startsWith("image/")) {
        // Unspecified or unknown image mime type.
        try {
          ImageFormat imageFormat = Sanselan
              .guessFormat(new ByteSourceInputStream(resp.getContentBytes(),
                  request.getUri().getPath()));
          if (imageFormat == ImageFormat.IMAGE_FORMAT_UNKNOWN) {
            LOG.log(Level.INFO, "Unable to sanitize unknown image type "
                + request.getUri().toString());
View Full Code Here

    public static byte[] imageWriteExample(File file)
            throws ImageReadException, ImageWriteException, IOException {
        // read image
        BufferedImage image = Sanselan.getBufferedImage(file);

        ImageFormat format = ImageFormat.IMAGE_FORMAT_TIFF;
        Map<String,Integer> params = new HashMap<String,Integer>();

        // set optional parameters if you like
        params.put(SanselanConstants.PARAM_KEY_COMPRESSION, Integer.valueOf(
                TiffConstants.TIFF_COMPRESSION_UNCOMPRESSED));
View Full Code Here

TOP

Related Classes of org.apache.sanselan.ImageFormat

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.