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 041 /** 042 * Parameter key. Used in write operations to indicate the desired 043 * T.4 options to use when using TIFF_COMPRESSION_CCITT_GROUP_3. 044 * <p> 045 * Valid values: any Integer containing a mixture of the 046 * TIFF_FLAG_T4_OPTIONS_2D, TIFF_FLAG_T4_OPTIONS_UNCOMPRESSED_MODE, 047 * and TIFF_FLAG_T4_OPTIONS_FILL flags. 048 */ 049 public static final String PARAM_KEY_T4_OPTIONS = "T4_OPTIONS"; 050 051 /** 052 * Parameter key. Used in write operations to indicate the desired 053 * T.6 options to use when using TIFF_COMPRESSION_CCITT_GROUP_4. 054 * <p> 055 * Valid values: any Integer containing either zero or 056 * TIFF_FLAG_T6_OPTIONS_UNCOMPRESSED_MODE. 057 */ 058 public static final String PARAM_KEY_T6_OPTIONS = "T6_OPTIONS"; 059 060 public static final int TIFF_FLAG_T4_OPTIONS_2D = 1; 061 public static final int TIFF_FLAG_T4_OPTIONS_UNCOMPRESSED_MODE = 2; 062 public static final int TIFF_FLAG_T4_OPTIONS_FILL = 4; 063 public static final int TIFF_FLAG_T6_OPTIONS_UNCOMPRESSED_MODE = 2; 064 065 066 public static final String PARAM_KEY_SUBIMAGE_X = "SUBIMAGE_X"; 067 public static final String PARAM_KEY_SUBIMAGE_Y = "SUBIMAGE_Y"; 068 public static final String PARAM_KEY_SUBIMAGE_WIDTH = "SUBIMAGE_WIDTH"; 069 public static final String PARAM_KEY_SUBIMAGE_HEIGHT = "SUBIMAGE_HEIGHT"; 070 071 /** 072 * Specifies the amount of memory in bytes to be used for a strip 073 * or tile size when employing LZW compression. The default is 074 * 8000 (roughly 8K). Minimum value is 8000. 075 */ 076 public static final String PARAM_KEY_LZW_COMPRESSION_BLOCK_SIZE = 077 "PARAM_KEY_LZW_COMPRESSION_BLOCK_SIZE"; 078 079 /** 080 * Specifies a larger strip-size to be used for compression. This setting 081 * generally produces smaller output files, but requires a slightly longer 082 * processing time. Used in conjunction with the 083 * PARAM_KEY_LZW_COMPRESSION_STRIP_SIZE 084 */ 085 public static final int TIFF_LZW_COMPRESSION_BLOCK_SIZE_MEDIUM = 32768; 086 087 /** 088 * Specifies a larger strip-size to be used for compression. This setting 089 * generally produces smaller output files, but requires a slightly longer 090 * processing time. Used in conjunction with the 091 * PARAM_KEY_LZW_COMPRESSION_STRIP_SIZE 092 */ 093 public static final int TIFF_LZW_COMPRESSION_BLOCK_SIZE_LARGE = 65536; 094 095 private TiffConstants() { 096 } 097}