Results 1 to 10 of 10

Thread: Read DPI of QPixmap is it possible?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Boston, MA
    Posts
    40
    Thanks
    1
    Thanked 6 Times in 6 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Read DPI of QPixmap is it possible?

    What I meant is dpi is not properties of pixmap, but rather device you work with.

  2. #2
    Join Date
    Oct 2009
    Posts
    3
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Read DPI of QPixmap is it possible?

    Thank you fanat9 and Gravis!

    I totally agree with you both, but (I always have a but, hehe) some image formats, like PNG (I think that tiff and jpeg too) store a byte with the image DPI (I know it's not a real image property, because it depends on the device).

    For example, if you do a PNG image with Fireworks, it store the dpi you choose for that image in the image file. So, when Fireworks, open the file again, can "translate" pixels to, for example, inches.

    I agree that it all depends on the device, and not on the image, but I know some image format has that information embedded. I think the best would be to open the file, as binary, read that information from the image file.

    Thank you again for the answers!! (and of course, you time)

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Read DPI of QPixmap is it possible?

    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  4. #4
    Join Date
    Dec 2012
    Posts
    7
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Read DPI of QPixmap is it possible?

    @wysota:
    This doesn't contain anything for a regular JPEG.

    @orlando:
    You have been misunderstood. The DPI you need is the information from acquiring the image. If you scan a ruler and want it printed out in the same scale, you need to know the DPI of the scanner / camera and the printer.
    The information probably is stored in the metadata of your image file (EXIF or similar).
    I know of no Qt function to retrieve this information.

  5. #5
    Join Date
    Jan 2006
    Location
    Sta. Eugènia de Berga (Vic - Barcelona - Spain)
    Posts
    869
    Thanks
    70
    Thanked 59 Times in 57 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Read DPI of QPixmap is it possible?

    Have you looked how old is this post?
    Òscar Llarch i Galán

  6. #6
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,324
    Thanks
    316
    Thanked 871 Times in 858 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Read DPI of QPixmap is it possible?

    It's probably a good thing that the poster averages only about 2 posts a year.

Similar Threads

  1. Position in a QPixMap created from a QGraphicsScene
    By stevel in forum Qt Programming
    Replies: 8
    Last Post: 8th April 2009, 22:39
  2. External Lib read from QBuffer on Calback problem
    By patrik08 in forum Qt Programming
    Replies: 2
    Last Post: 2nd June 2008, 19:43
  3. How to read CD with read?
    By vishal.chauhan in forum Qt Programming
    Replies: 6
    Last Post: 29th June 2007, 08:20
  4. QIODevice read()
    By ShaChris23 in forum Newbie
    Replies: 1
    Last Post: 3rd May 2007, 00:29
  5. QPixmap and HBITMAP
    By ToddAtWSU in forum Qt Programming
    Replies: 1
    Last Post: 21st June 2006, 16:24

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.