locked
How to show a scanned image in its original dimensions RRS feed

  • Question

  • Hi Guys,

    I'm creating a system which scan images by image scanner and shows them later in MVC application.  According the requirements the images have to be shown in the dimension of the original paper.  Would you please give me some guidance or quick code sample?

    Best Regards,

    Rosen Rusev


    • Edited by rrossenbg Friday, April 10, 2015 3:30 PM syntax
    Friday, April 10, 2015 3:28 PM

Answers

  • If you know the original dimensions (in millimeters, for example), and it is a Web application (which is usually associated with "MVC"), then try specifying the sizes explicitly, for example:

        <img style="width: 210mm; height: 297mm;" …


    • Edited by Viorel_MVP Friday, April 10, 2015 6:37 PM
    • Marked as answer by rrossenbg Saturday, April 11, 2015 2:54 PM
    Friday, April 10, 2015 6:36 PM

All replies

  • Hi,

    since pixels are usually dimensionless this is not easy to do. If the ppi of the monitor to show the images is a correct number (concerning its inch-width) you can either:

    - scan the images with the same dpi as the monitor has (as ppi)

    - scan the images at a higher dpi level and resample them by dividing - factor: monitor_ppi/scanned_dpi, both as doubles.

    Regards,

      Thorsten


    Friday, April 10, 2015 5:34 PM
  • If you know the original dimensions (in millimeters, for example), and it is a Web application (which is usually associated with "MVC"), then try specifying the sizes explicitly, for example:

        <img style="width: 210mm; height: 297mm;" …


    • Edited by Viorel_MVP Friday, April 10, 2015 6:37 PM
    • Marked as answer by rrossenbg Saturday, April 11, 2015 2:54 PM
    Friday, April 10, 2015 6:36 PM
  • The original dimensions of images could be any but I know the dpi of the scanner. I also can get width and height of the result image in pixels and therefore compute the original dimensions in millimetres then I'll set width and height of img tag and the browser will take care of showing image correctly on the user's monitor. This solution seems to me easy to realize.

    Thank you guys!

    • Edited by rrossenbg Saturday, April 11, 2015 3:10 PM
    Saturday, April 11, 2015 3:04 PM