Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. getting tiff image dimension

getting tiff image dimension

Scheduled Pinned Locked Moved C#
question
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    subai
    wrote on last edited by
    #1

    hi I'm trying to programmaticaly get a scanned tiff image's dimension like the info displayed in summary tab of properties dialog of file is there any way to get dimension directly instead of using resolution? any idea?


    I Wish the Life Had CTRL-Z

    C B 2 Replies Last reply
    0
    • S subai

      hi I'm trying to programmaticaly get a scanned tiff image's dimension like the info displayed in summary tab of properties dialog of file is there any way to get dimension directly instead of using resolution? any idea?


      I Wish the Life Had CTRL-Z

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      If you can work out what the shell is doing to get that info, you can try to p/invoke it.

      Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

      S 1 Reply Last reply
      0
      • S subai

        hi I'm trying to programmaticaly get a scanned tiff image's dimension like the info displayed in summary tab of properties dialog of file is there any way to get dimension directly instead of using resolution? any idea?


        I Wish the Life Had CTRL-Z

        B Offline
        B Offline
        Big Daddy Farang
        wrote on last edited by
        #3

        If by "dimension" you mean the width and height of the image measured in pixels, which is what I see in the summary tab, you can use this quick and dirty means.

        System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap("MyImage.tif");
        int width = bitmap.Width;
        int height = bitmap.Height;
        bitmap.Dispose();

        If you need more info, you could get a copy of the TIFF specification, read the file header, and extract what you need from those bytes. Hope that helps.

        BDF A learned fool is more a fool than an ignorant fool. -- Moliere

        S 1 Reply Last reply
        0
        • B Big Daddy Farang

          If by "dimension" you mean the width and height of the image measured in pixels, which is what I see in the summary tab, you can use this quick and dirty means.

          System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap("MyImage.tif");
          int width = bitmap.Width;
          int height = bitmap.Height;
          bitmap.Dispose();

          If you need more info, you could get a copy of the TIFF specification, read the file header, and extract what you need from those bytes. Hope that helps.

          BDF A learned fool is more a fool than an ignorant fool. -- Moliere

          S Offline
          S Offline
          subai
          wrote on last edited by
          #4

          thanks for replying i meant in MM or CM there is a Image class properties named PhysicalDimension but that is not worked in the files that i should use i wanted to avoid converting pixels to dimension by myself


          I Wish the Life Had CTRL-Z

          1 Reply Last reply
          0
          • C Christian Graus

            If you can work out what the shell is doing to get that info, you can try to p/invoke it.

            Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

            S Offline
            S Offline
            subai
            wrote on last edited by
            #5

            thanks


            I Wish the Life Had CTRL-Z

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups