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. Reducing size of captured images.
Forum Updated to NodeBB v4.3 + New Features

Reducing size of captured images.

Scheduled Pinned Locked Moved General and Desktop
6 Posts 4 Posters 2.1k Views 1 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.
  • S Offline
    S Offline
    sarahjohn
    wrote on last edited by
    #1

    hi,
    I am capturing the image of a webpage using the code
    @ QImage image(frame->contentsSize(), QImage::Format_ARGB32_Premultiplied);
    image.fill(Qt::transparent);

    QPainter painter(&image);
    painter.setRenderHint(QPainter::Antialiasing, true);
    painter.setRenderHint(QPainter::TextAntialiasing, true);
    painter.setRenderHint(QPainter::SmoothPixmapTransform, true);
    frame->render(&painter);
    @

    But sometimes the size of the image captured greater than 1MB.I am transfering these captured images to a remote client.How can i reduce the size of the captured images.

    1 Reply Last reply
    0
    • JohanSoloJ Offline
      JohanSoloJ Offline
      JohanSolo
      wrote on last edited by
      #2

      Well, the size depends on the resolution of the picture and on the chosen format. If you want to minimise the picture size, you'd better use jpeg format. Reducing the pixel format may also help if you don't need a 32 bits depth, for instance 24-bits colour depth seems fairly decent to me.

      `They did not know it was impossible, so they did it.'
      -- Mark Twain

      1 Reply Last reply
      0
      • S Offline
        S Offline
        sarahjohn
        wrote on last edited by
        #3

        Is there any other method to reduce the size.I tried both saving the file in jpeg and QImageFormat to 24 bits per depth but both does not significantly reduce the size.Is ther any method to reduce the resolution of the captured image?

        1 Reply Last reply
        0
        • JohanSoloJ Offline
          JohanSoloJ Offline
          JohanSolo
          wrote on last edited by JohanSolo
          #4

          Sure, you can use the QImage::scaled method to reduce the resolution once the capture has been made.

          `They did not know it was impossible, so they did it.'
          -- Mark Twain

          1 Reply Last reply
          0
          • A Offline
            A Offline
            Asperamanca
            wrote on last edited by
            #5

            You could compress the contents of the image yourself, send the compressed data stream and re-build the Image on the client side.

            You could make a QPixmap out of it, save it to a temporary file of a compressed type, and transfer that file.

            1 Reply Last reply
            0
            • N Offline
              N Offline
              need4openid
              wrote on last edited by
              #6

              Hey, you can try adjusting the resolution using the QImage::scaled method after the capture and compress the image data yourself before transferring it to the remote client. This can involve creating a QPixmap, saving it to a compressed file format, and then sending the compressed file over to the client side for reconstruction. On the other hand you can use online application for jpeg image compression such https://jpegcompressor.com/ it also compress image with supporting jpeg, svg, png, webp and etc without losing their quality.

              1 Reply Last reply
              0

              • Login

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