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. How to get access to the pixels of the image using QImage?
Forum Updated to NodeBB v4.3 + New Features

How to get access to the pixels of the image using QImage?

Scheduled Pinned Locked Moved General and Desktop
qt5.4qimagefilters
2 Posts 2 Posters 11.3k 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.
  • sosunS Offline
    sosunS Offline
    sosun
    wrote on last edited by
    #1

    I want to use Gaussian Blur filter. I wrote my 2D kernel, but to finish blurring I need to get access to pixels and change data in them. Am I able to use some operations like these within Qt library? :

    QImage image("whatever.png");
    for(int x(0); x < image.width(); x++)
        for(int y (0); y < image.height(); y++)
            image[x][y] *= convKernel[x-1][y] + convKernel[x+1][y+1] ... etc
    
    image.save();
    

    Or I will need to use external libraries? In the documentation I've only found that I can change RGB of pixels and no more. How do you handle pixels in your apps?

    1 Reply Last reply
    0
    • Y Offline
      Y Offline
      yoavmil
      wrote on last edited by
      #2

      the QImage class has a pixel(x,y) and setPixel(x,y,value) methods
      QImage::setPixel()
      you can also use QImage::bits()

      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