img.Width and img.Height wrong for some jpg files RRS feed

  • Question

  • User1230255772 posted

     I'm using the usual:

    System.Drawing.Image myPic = System.Drawing.Image.FromFile("filename");

    to check myPic.Width and Height but for some files in jpg it gives thw rong result! For example this pic: http://www.reeswe.com/je0265%20(17).JPG

    width is not 677 it is 510! argh!


     Any ideas?


    Tuesday, June 16, 2009 8:55 AM

All replies

  • User-1418772296 posted

    why dont u write how you give widht and height ?

    write that line pls

    Tuesday, June 16, 2009 10:11 AM
  • User1230255772 posted
    Simply: System.Drawing.Image myPic = System.Drawing.Image.FromFile("filename.jpg"); int w = myPic.Width;
    Tuesday, June 16, 2009 10:58 AM
  • User-1418772296 posted


    i use codes in below code. My pictures be displayed how i want as widht and height. there is no problem. But maybe you have to use image1. it dispay your images how you want as widht and height.


    Tuesday, June 16, 2009 11:01 AM
  • User1230255772 posted
    That piece of code is to resize... my prob is that I get a wrong width/height when read image information. Thanks anyway, P
    Wednesday, June 17, 2009 2:28 AM