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
Forum Updated to NodeBB v4.3 + New Features

Different Bytes Count of QImage

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 2 Posters 448 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.
  • B Offline
    B Offline
    beecksche
    wrote on 25 Jul 2019, 08:39 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 25 Jul 2019, 09:26 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

      1/2

      25 Jul 2019, 08:39

      • Login

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