/* $Id: tiffcrop.c,v 1.20 2010-12-14 02:03:24 faxguy Exp $ */
/* tiffcrop.c -- a port of tiffcp.c extended to include manipulations of
* the image data through additional options listed below
*
* Original code:
* Copyright (c) 1988-1997 Sam Leffler
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
* Additions (c) Richard Nolde 2006-2010
*
* Permission to use, copy, modify, distribute, and sell this software and
* its documentation for any purpose is hereby granted without fee, provided
* that (i) the above copyright notices and this permission notice appear in
* all copies of the software and related documentation, and (ii) the names of
* Sam Leffler and Silicon Graphics may not be used in any advertising or
* publicity relating to the software without the specific, prior written
* permission of Sam Leffler and Silicon Graphics.
*
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
*
* IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS OR ANY OTHER COPYRIGHT
* HOLDERS BE LIABLE FOR ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL
* DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND
* ON ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE
* OR PERFORMANCE OF THIS SOFTWARE.
*
* Some portions of the current code are derived from tiffcp, primarly in
* the areas of lowlevel reading and writing of TAGS, scanlines and tiles though
* some of the original functions have been extended to support arbitrary bit
* depths. These functions are presented at the top of this file.
*
* Add support for the options below to extract sections of image(s)
* and to modify the whole image or selected portions of each image by
* rotations, mirroring, and colorscale/colormap inversion of selected
* types of TIFF images when appropriate. Some color model dependent
* functions are restricted to bilevel or 8 bit per sample data.
* See the man page for the full explanations.
*
* New Options:
* -h Display the syntax guide.
* -v Report the version and last build date for tiffcrop and libtiff.
* -z x1,y1,x2,y2:x3,y3,x4,y4:..xN,yN,xN + 1, yN + 1
* Specify a series of coordinates to define rectangular
* regions by the top left and lower right corners.
* -e c|d|i|m|s export mode for images and selections from input images
* combined All images and selections are written to a single file (default)
* with multiple selections from one image combined into a single image
* divided All images and selections are written to a single file
* with each selection from one image written to a new image
* image Each input image is written to a new file (numeric filename sequence)
* with multiple selections from the image combined into one image
* multiple Each input image is written to a new file (numeric filename sequence)
* with each selection from the image written to a new image
* separated Individual selections from each image are written to separate files
* -U units [in, cm, px ] inches, centimeters or pixels
* -H # Set horizontal resolution of output images to #
* -V # Set vertical resolution of output images to #
* -J # Horizontal margin of output page to # expressed in current
* units when sectioning image into columns x rows
* using the -S cols:rows option.
* -K # Vertical margin of output page to # expressed in current
* units when sectioning image into columns x rows
* using the -S cols:rows option.
* -X # Horizontal dimension of region to extract expressed in current
* units
* -Y # Vertical dimension of region to extract expressed in current
* units
* -O orient Orientation for output image, portrait, landscape, auto
* -P page Page size for output image segments, eg letter, legal, tabloid,
* etc.
* -S cols:rows Divide the image into equal sized segments using cols across
* and rows down
* -E t|l|r|b Edge to use as origin
* -m #,#,#,# Margins from edges for selection: top, left, bottom, right
* (commas separated)
* -Z #:#,#:# Zones of the image designated as zone X of Y,
* eg 1:3 would be first of three equal portions measured
* from reference edge
* -N odd|even|#,#-#,#|last
* Select sequences and/or ranges of images within file
* to process. The words odd or even may be used to specify
* all odd or even numbered images the word last may be used
* in place of a number in the sequence to indicate the final
* image in the file without knowing how many images there are.
* -R # Rotate image or crop selection by 90,180,or 270 degrees
* clockwise
* -F h|v Flip (mirror) image or crop selection horizontally
* or vertically
* -I [black|white|data|both]
* Invert color space, eg dark to light for bilevel and grayscale images
* If argument is white or black, set the PHOTOMETRIC_INTERPRETATION
* tag to MinIsBlack or MinIsWhite without altering the image data
* If the argument is data or both, the image data are modified:
* both inverts the data and the PHOTOMETRIC_INTERPRETATION tag,
* data inverts the data but not the PHOTOMETRIC_INTERPRETATION tag
* -D input:<filename1>,output:<filename2>,format:<raw|txt>,level:N,debug:N
* Dump raw data for input and/or output images to individual files
* in raw (binary) format or text (ASCII) representing binary data
* as strings of 1s and 0s. The filename arguments are used as stems
* from which individual files are created for each image. Text format
* includes annotations for image parameters and scanline info. Level
* selects which functions dump data, with higher numbers selecting
* lower level, scanline level routines. Debug reports a limited set
* of messages to monitor progess without enabling dump logs.
*/
static char tiffcrop_version_id[] = "2.4";
static char tiffcrop_rev_date[] = "12-13-2010";
#include "tif_config.h"
#include "tiffiop.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <ctype.h>
#include <limits.h>
#include <sys/stat.h>
#include <assert.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#ifdef HAVE_STDINT_H
# include <stdint.h>
#endif
#ifndef HAVE_GETOPT
extern int getopt(int, char**, char*);
#endif
#ifdef NEED_LIBPORT
# include "libport.h"
#endif
#include "tiffio.h"
#if defined(VMS)
# define unlink delete
#endif
#ifndef PATH_MAX
#define PATH_MAX 1024
#endif
#ifndef streq
#define streq(a,b) (strcmp((a),(b)) == 0)
#endif
#define strneq(a,b,n) (strncmp((a),(b),(n)) == 0)
#define TRUE 1
#define FALSE 0
#ifndef TIFFhowmany
#define TIFFhowmany(x, y) ((((uint32)(x))+(((uint32)(y))-1))/((uint32)(y)))
#define TIFFhowmany8(x) (((x)&0x07)?((uint32)(x)>>3)+1:(uint32)(x)>>3)
#endif
/*
* Definitions and data structures required to support cropping and image
* manipulations.
*/
#define EDGE_TOP 1
#define EDGE_LEFT 2
#define EDGE_BOTTOM 3
#define EDGE_RIGHT 4
#define EDGE_CENTER 5
#define MIRROR_HORIZ 1
#define MIRROR_VERT 2
#define MIRROR_BOTH 3
#define ROTATECW_90 8
#define ROTATECW_180 16
#define ROTATECW_270 32
#define ROTATE_ANY ROTATECW_90 || ROTATE
没有合适的资源?快使用搜索试试~ 我知道了~
tiff-4.0.3.zip
共534个文件
html:123个
c:103个
sh:77个
5星 · 超过95%的资源 需积分: 19 64 下载量 113 浏览量
2012-12-11
21:49:48
上传
评论
收藏 2.33MB ZIP 举报
温馨提示
此代码是C/C++源码,可以在windows和linux下面编译,具体有什么用户,可以百度下。 使用vc6编译的方法: 解压压缩包,进入源码目录,输入下面命令: C:\tiff-4.0.3>nmake /f Makefile.vc all 注意,前提是安装了VS6.0
资源推荐
资源详情
资源评论
收起资源包目录
tiff-4.0.3.zip (534个子文件)
tiffcrop.1 22KB
tiffcp.1 9KB
fax2tiff.1 8KB
tiff2ps.1 7KB
tiff2pdf.1 7KB
tiffgt.1 7KB
raw2tiff.1 5KB
fax2ps.1 5KB
tiffsv.1 4KB
tiffdither.1 4KB
tiff2rgba.1 3KB
tiffmedian.1 3KB
pal2rgb.1 3KB
rgb2ycbcr.1 3KB
ras2tiff.1 3KB
ppm2tiff.1 3KB
thumbnail.1 3KB
tiffdump.1 3KB
tiffcmp.1 3KB
sgi2tiff.1 3KB
tiff2bw.1 3KB
bmp2tiff.1 3KB
tiffset.1 3KB
tiffinfo.1 3KB
gif2tiff.1 3KB
tiffsplit.1 2KB
libtiff.3tiff 18KB
TIFFOpen.3tiff 9KB
TIFFRGBAImage.3tiff 9KB
TIFFGetField.3tiff 8KB
TIFFcolor.3tiff 8KB
TIFFSetField.3tiff 7KB
TIFFReadRGBAImage.3tiff 7KB
TIFFReadDirectory.3tiff 6KB
TIFFReadRGBATile.3tiff 6KB
TIFFReadRGBAStrip.3tiff 6KB
TIFFWriteScanline.3tiff 6KB
TIFFWriteDirectory.3tiff 5KB
TIFFquery.3tiff 4KB
TIFFtile.3tiff 4KB
TIFFReadScanline.3tiff 4KB
TIFFstrip.3tiff 4KB
TIFFWriteEncodedStrip.3tiff 4KB
TIFFWriteEncodedTile.3tiff 3KB
TIFFbuffer.3tiff 3KB
TIFFWriteRawStrip.3tiff 3KB
TIFFReadTile.3tiff 3KB
TIFFcodec.3tiff 3KB
TIFFReadEncodedStrip.3tiff 3KB
TIFFReadEncodedTile.3tiff 3KB
TIFFWriteRawTile.3tiff 3KB
TIFFmemory.3tiff 3KB
TIFFswab.3tiff 3KB
TIFFSetDirectory.3tiff 3KB
TIFFFieldWriteCount.3tiff 3KB
TIFFWriteTile.3tiff 3KB
TIFFWarning.3tiff 3KB
TIFFError.3tiff 3KB
TIFFReadRawTile.3tiff 3KB
TIFFPrintDirectory.3tiff 3KB
TIFFFieldReadCount.3tiff 2KB
TIFFFlush.3tiff 2KB
TIFFReadRawStrip.3tiff 2KB
TIFFFieldPassCount.3tiff 2KB
TIFFsize.3tiff 2KB
TIFFDataWidth.3tiff 2KB
TIFFClose.3tiff 2KB
TIFFFieldTag.3tiff 2KB
TIFFFieldDataType.3tiff 2KB
TIFFFieldName.3tiff 2KB
configure.ac 35KB
Makefile.am 9KB
Makefile.am 4KB
Makefile.am 4KB
Makefile.am 4KB
Makefile.am 3KB
Makefile.am 2KB
Makefile.am 2KB
Makefile.am 2KB
Makefile.am 2KB
Makefile.am 2KB
Makefile.am 1KB
Makefile.am 1KB
Makefile.am 1KB
Makefile.am 1KB
Makefile.am 1KB
Makefile.am 1KB
Makefile.am 1KB
Makefile.am 1KB
Makefile.am 1KB
Makefile.am 1KB
Makefile.am 1KB
rgb-3c-8b.bmp 70KB
palette-1c-8b.bmp 24KB
tiffcrop.c 292KB
tiff2pdf.c 156KB
tif_dirread.c 137KB
tif_fax3sm.c 102KB
tiff2ps.c 97KB
tif_dirwrite.c 86KB
共 534 条
- 1
- 2
- 3
- 4
- 5
- 6
renee12321
- 粉丝: 0
- 资源: 6
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
前往页