2008.01.21 19:38 "[Tiff] How to clip an image with LibTiff", by

2008.01.25 05:52 "[Tiff] Tiffcrop and tiff2pdf", by Richard Nolde

  1. Re: TIffcrop might be called tiffextract (Andy Cave)

>> Please, note that tiffcrop is a part of libtiff for quite a some time >> (and it is part of stable branch of libtiff) and probably already is

>> being used in scripts or called from programs, so it is not harmless to >> change its name. But everything is possible with a good reason, of

>> course.
>> Best regards,
>> Andrey

> Andrey's point is well taken. I originally proposed that the code that > is now tiffcrop should replace tiffcp since it is a superset of the

> tiffcp utiltity, but Frank Warmerdam rightly noted that tiffcp was far > to important to take a change on breaking and certainly no

> functionality should be removed. I started exploring with a simple > crop option and it grew from there. I will try to check out the CVS

> version soon as I think there may be half a dozen more options that I > have added since the 3.8.2 release. A quick check of my source shows

> options for breaking pages into X columns by Y rows, or various Page > sizes, eg Letter, Legal, etc (which are useful for document processing

> but not meaningful for abstract images unless you just happen to want > to print a huge image on sheets of a given size), output orientations

> of portrait, landscape, auto, ouput margins added to pages rather than > subtracted from the original, and the ability to specify new X and Y

> resolution tags. These were not in the original release so I will have > to see if they made it into CVS before the 3.9.0 branch. One warning

> to users of the old version. In order to accomodate the new flags,

> the case of the old flags has changed in some cases so you will want > to check your scripts for compatability before upgrading.

> Anyone is free to provide a symlink with a more appropriate name for > their particular installation. Tiffcrop it shall remain.

> 3. How to clip an image with Tiffcrop (beppe costagliola)
> ----------------------------------------------------------------------

> There are actually two ways to do this. First you must specify your > units as pixels with the -U px option. Second specify your reference

> edge for the measurements -E top. Third, specify the margins you want > to subtract (clip/crop/remove) from the original that will not be

> copied to the new image. The margins MUST be specified in the > following order and separate only by commas, top, left, bottom, right.

> -m 1200,100,1804,876. This should leave an opening 1500 x 500 between > the margins but the right and bottom margins are rather a pain to

> compute and will cause problems if your images vary in size. You can > use the flags for a fixed size region, -X 1500 -Y 500 with only the

> first two margins and tiffcrop will compute the proper region and > ignore anything to the right and below the selected region if you only

> need to select a single region from each image. Note that This would > give you a command line something like this: tiffcrop -E top -U px -m 1200,100 -X 1500 -Y 500 source.tif destination.tif

Note: Units must come first to override the values found in the tiff file. Margins are calculated in the current units, eg actually pixels for px, or inches, or centimeters but the later two require that the file have a valid resolution for both dimensions. The units in which you specify the margins or any dimensions for X and Y, are independent of the units that might be stored (or defaulted) in the file. Tiffcrop converts between the internal units specified in the file to the type of units you specify on the command line before it calculates which pixels to select. Any margins not specified are assumed to be zero.

If you want to select more than one region within the cropped borders, you can use the -Z option and the regions will be computed AFTER the margins are subtracted.

Richard Nolde

> ------------------------------
> Message: 3
> Date: Thu, 24 Jan 2008 17:09:23 +0100 (CET)
> From: beppe costagliola <beppecosta@yahoo.it>
> Subject: [Tiff] How to clip an image with Tiffcrop
> To: tiff@lists.maptools.org

> Message-ID: <218112.46229.qm@web26205.mail.ukl.yahoo.com> > Content-Type: text/plain; charset=iso-8859-1

Tiffcrop seems to work fine but I don't understand the parameters that should be passed to.

For example:

I have an image with ImageWidth = 2476 and ImageLength = 3504

I would like to extract an area that is at X = 100 and

Y = 1200 giving an image of Width = 1500 and Lenght = 500.