    001/*
    002 * Licensed to the Apache Software Foundation (ASF) under one or more
    003 * contributor license agreements.  See the NOTICE file distributed with
    004 * this work for additional information regarding copyright ownership.
    005 * The ASF licenses this file to You under the Apache License, Version 2.0
    006 * (the "License"); you may not use this file except in compliance with
    007 * the License.  You may obtain a copy of the License at
    008 *
    009 *      http://www.apache.org/licenses/LICENSE-2.0
    010 *
    011 * Unless required by applicable law or agreed to in writing, software
    012 * distributed under the License is distributed on an "AS IS" BASIS,
    013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    014 * See the License for the specific language governing permissions and
    015 * limitations under the License.
    016 */
    017package org.apache.commons.imaging.formats.tiff.constants;
    018
    019import java.nio.ByteOrder;
    020
    021public final class TiffConstants {
    022
    023    public static final ByteOrder DEFAULT_TIFF_BYTE_ORDER = ByteOrder.LITTLE_ENDIAN;
    024
    025    public static final int TIFF_HEADER_SIZE = 8;
    026    public static final int TIFF_DIRECTORY_HEADER_LENGTH = 2;
    027    public static final int TIFF_DIRECTORY_FOOTER_LENGTH = 4;
    028    public static final int TIFF_ENTRY_LENGTH = 12;
    029    public static final int TIFF_ENTRY_MAX_VALUE_LENGTH = 4;
    030
    031    public static final int TIFF_COMPRESSION_UNCOMPRESSED_1 = 1;
    032    public static final int TIFF_COMPRESSION_UNCOMPRESSED = TIFF_COMPRESSION_UNCOMPRESSED_1;
    033    public static final int TIFF_COMPRESSION_CCITT_1D = 2;
    034    public static final int TIFF_COMPRESSION_CCITT_GROUP_3 = 3;
    035    public static final int TIFF_COMPRESSION_CCITT_GROUP_4 = 4;
    036    public static final int TIFF_COMPRESSION_LZW = 5;
    037    public static final int TIFF_COMPRESSION_JPEG = 6;
    038    public static final int TIFF_COMPRESSION_UNCOMPRESSED_2 = 32771;
    039    public static final int TIFF_COMPRESSION_PACKBITS = 32773;
    040    public static final int TIFF_COMPRESSION_DEFLATE_PKZIP = 32946;
    041    public static final int TIFF_COMPRESSION_DEFLATE_ADOBE = 8;
    042
    043    /**
    044     * Parameter key. Used in write operations to indicate the desired
    045     * T.4 options to use when using TIFF_COMPRESSION_CCITT_GROUP_3.
    046     * <p>
    047     * Valid values: any Integer containing a mixture of the
    048     * TIFF_FLAG_T4_OPTIONS_2D, TIFF_FLAG_T4_OPTIONS_UNCOMPRESSED_MODE,
    049     * and TIFF_FLAG_T4_OPTIONS_FILL flags.
    050     */
    051    public static final String PARAM_KEY_T4_OPTIONS = "T4_OPTIONS";
    052
    053    /**
    054     * Parameter key. Used in write operations to indicate the desired
    055     * T.6 options to use when using TIFF_COMPRESSION_CCITT_GROUP_4.
    056     * <p>
    057     * Valid values: any Integer containing either zero or
    058     * TIFF_FLAG_T6_OPTIONS_UNCOMPRESSED_MODE.
    059     */
    060    public static final String PARAM_KEY_T6_OPTIONS = "T6_OPTIONS";
    061
    062    public static final int TIFF_FLAG_T4_OPTIONS_2D = 1;
    063    public static final int TIFF_FLAG_T4_OPTIONS_UNCOMPRESSED_MODE = 2;
    064    public static final int TIFF_FLAG_T4_OPTIONS_FILL = 4;
    065    public static final int TIFF_FLAG_T6_OPTIONS_UNCOMPRESSED_MODE = 2;
    066
    067
    068    public static final String PARAM_KEY_SUBIMAGE_X = "SUBIMAGE_X";
    069    public static final String PARAM_KEY_SUBIMAGE_Y = "SUBIMAGE_Y";
    070    public static final String PARAM_KEY_SUBIMAGE_WIDTH = "SUBIMAGE_WIDTH";
    071    public static final String PARAM_KEY_SUBIMAGE_HEIGHT = "SUBIMAGE_HEIGHT";
    072
    073    public static final String PARAM_KEY_CUSTOM_PHOTOMETRIC_INTERPRETER
    074        = "CUSTOM_PHOTOMETRIC_INTERPRETER";
    075
    076    /**
    077     * Specifies the amount of memory in bytes to be used for a strip
    078     * or tile size when employing LZW compression.  The default is
    079     * 8000 (roughly 8K). Minimum value is 8000.
    080     */
    081    public static final String PARAM_KEY_LZW_COMPRESSION_BLOCK_SIZE =
    082            "PARAM_KEY_LZW_COMPRESSION_BLOCK_SIZE";
    083
    084    /**
    085     * Specifies a larger strip-size to be used for compression. This setting
    086     * generally produces smaller output files, but requires a slightly longer
    087     * processing time. Used in conjunction with the
    088     * PARAM_KEY_LZW_COMPRESSION_STRIP_SIZE
    089     */
    090    public static final int TIFF_LZW_COMPRESSION_BLOCK_SIZE_MEDIUM = 32768;
    091
    092    /**
    093     * Specifies a larger strip-size to be used for compression. This setting
    094     * generally produces smaller output files, but requires a slightly longer
    095     * processing time. Used in conjunction with the
    096     * PARAM_KEY_LZW_COMPRESSION_STRIP_SIZE
    097     */
    098    public static final int TIFF_LZW_COMPRESSION_BLOCK_SIZE_LARGE = 65536;
    099
    100    private TiffConstants() {
    101    }
    102}