Identify the orientation and rotate only specific pages of a TIFF file

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
HariK
Posts: 5
Joined: 2017-06-09T00:24:58-07:00
Authentication code: 1151

Identify the orientation and rotate only specific pages of a TIFF file

Post by HariK »

Hi All,

I have a multi-page TIFF file in which some of the pages are rotated and some of the pages are not rotated.

I am using Magick.NET-Q16-AnyCPU dll of version 7.0.0.0 in my C# application. I tried exploring the ImageMagick API's but at least I couldn't find any API methods which does the above mentioned. Can someone please point me towards a sample example of ImageMagick with C# on --> How can we detect the orientation of any page in a TIFF file and then rotate only that specific page/s of a TIFF file ?

Thanks in Advance,
Hari
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Identify the orientation and rotate only specific pages of a TIFF file

Post by fmw42 »

Can you post an example tiff that has pages that are rotated? What angle are the rotations --- are they small or 90,180,270 deg rotations?

You can upload to some free hosting service and put the URL here.
HariK
Posts: 5
Joined: 2017-06-09T00:24:58-07:00
Authentication code: 1151

Re: Identify the orientation and rotate only specific pages of a TIFF file

Post by HariK »

@fmw42, thanks for your reply. Sorry I cannot post my tiff file. Yes, the angles of rotations are 90, 180 and 270 degrees.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Identify the orientation and rotate only specific pages of a TIFF file

Post by fmw42 »

It may be possible to detect 0 and 180 vs 90 and 270. But that will not tell you whether you have 0 or 180 and likewise 90 or 270. If you average to one row or one column, the correct one will show repeated gaps corresponding to the rows. Similarly there will be a different in orientation showing in the FFT magnitude.
Post Reply