[Qt-interest] Getting number of pixels in a QImage
Keshava Krishna
keshavkrishna88 at gmail.com
Tue Apr 7 08:45:17 CEST 2009
no, it is not a simplified version...
anyways i don't need that thing now in my application...
thank you for putting your efforts into it...
Regards,
Keshava.
On Tue, Apr 7, 2009 at 12:01 PM, Rainer Wiesenfarth <
Rainer.Wiesenfarth at inpho.de> wrote:
>
> Upps! Forget what I wrote, I mixed the x, y order with the order we use in
> our software which usually does row, column ...
>
> So, the reason is different. What do you get for width() and height() and
> which size is the image? Is this the original code "as is" or a simplified
> version?
>
> From: qt-interest-bounces at trolltech.com
> > From: Keshava Krishna [mailto:keshavkrishna88 at gmail.com]
> > > @Rainer,
> > >
> > > have a look at the code...
> > >
> > > QColor *pixelColor;
> > > int c;
> > > image=new QImage(imageFileName);
> > > for(int i=0;i<image->width();i++)
> > > {
> > > for(int j=0;j<image->height();j++)
> > > {
> > >
> > > pixelColor = new QColor(image->pixel(i,j));
> > > pixelColor->setAlphaF(0.3);
> > > c = pixelColor->rgba();
> > > image->setPixel(i,j,c);
> > > }
> > > }
> > > [...]
> >
> > You swapped row and column of the image. So either i should
> > run from 0 to
> > height() and j from 0 to width(), or the calls should be
> > pixel(j,i) and
> > setPixel(j,i,c).
> >
> > See what a code snippet can do to solve your problem? ;-)
>
> Best Regards / Mit freundlichen Grüßen
> Rainer Wiesenfarth
>
> --
> INPHO GmbH * Smaragdweg 1 * 70174 Stuttgart * Germany
> phone: +49 711 2288 10 * fax: +49 711 2288 111 * web: www.inpho.de
> place of business: Stuttgart * managing director: Johannes Saile
> commercial register: Stuttgart, HRB 9586
> Leader in Photogrammetry and Digital Surface Modelling
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090407/fd4437ef/attachment.html
More information about the Qt-interest-old
mailing list