Make a branch to make krunner Good Enough For Aaron™.
[kdebase/uwolfer.git] / workspace / ksplash / ksplashx / utils / shade.cpp
bloba66930027cc2efca75f8c5c1b36c7f4115bc3a09
1 // This tool makes the image grayscale and transparent.
3 #include <QImage>
5 #include <kcmdlineargs.h>
6 #include <kapplication.h>
7 #include <kdebug.h>
9 int main( int argc, char* argv[] )
11 if( argc != 2 )
12 return 1;
13 QImage im( argv[ 1 ] );
14 if( im.isNull())
15 return 2;
16 for( int x = 0;
17 x < im.width();
18 ++x )
19 for( int y = 0;
20 y < im.height();
21 ++y )
23 QRgb c = im.pixel( x, y );
24 QRgb c2 = qRgba( qGray( c ), qGray( c ), qGray( c ), qAlpha( c ) / 2 );
25 im.setPixel( x, y, c2 );
27 im.save( "result.png", "PNG" );