Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Different Bytes Count of QImage
Qt 6.11 is out! See what's new in the release blog

Different Bytes Count of QImage

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 2 Posters 1.1k Views 2 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.
  • beeckscheB Offline
    beeckscheB Offline
    beecksche
    wrote on last edited by
    #1

    Hi,
    Does anybody understand the size in bytes of the QImage?

    QImage image128(128, 128, QImage::Format_Grayscale8);
    image128.sizeInBytes(); // == 16384, which is 128*128  
    
    QImage image102(102, 102, QImage::Format_Grayscale8);
    image102.sizeInBytes(); // == 10608, which is NOT 102*102, but 102*104 ?!?
    

    Thanks

    1 Reply Last reply
    0
    • O Offline
      O Offline
      ollarch
      wrote on last edited by
      #2

      Hi,

      Because of 4 byte alignment (32 bit alignment):
      "The width and height must be specified in pixels, data must be 32-bit aligned, and each scanline of data in the image must also be 32-bit aligned"

      1 Reply Last reply
      5

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved