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

2008.01.25 09:25 "Re: [Tiff] Tiffcrop and tiff2pdf", by beppe costagliola

Hi Richard,

thanks for your suggestions.

I've tried in both ways.

-m 1200,100,1804,876 gives a cropped image (no problem in calculating the -m values at runtime, because we already do this)

-m 1200,100 -X 1500 -Y 500 produces a distorted image with a size double of the original!

I will keep on trying the first option.

At present we use Imagemagick (convert -crop) but because it runs on a iSeries platform the command is executed via a rs/6000 interpreter.

While I can run tifflib with their tools (including tiffcrop) in C native mode.

Note that we have to run this command more than 150,000 times per day and the performance is a real issue.

PS. Do you know of a barcode reader available in open source?




--- Richard Nolde <nrichard8@qwest.net> ha scritto:

   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 wou