C++ (Qt)QImage im; im.load(filename); im = im.scaled(icoWidth, icoHeight, Qt::KeepAspectRatio, Qt::SmoothTransformation); im.save( filename_s, "JPG", 95);
C++ (Qt) QImage im; QIcon ico; QSize size(200, 200); ico.addFile(MainWindow::currentDir + MainWindow::listImage.at(i), size); im = ico.pixmap(size).toImage(); im.save( MainWindow::currentDir + ".prev/" + MainWindow::listName.at(i), "JPG", 95);
C++ (Qt)class MyThread : public QThread{public: MyThread() { } void run() { QDir curDir; curDir.setPath(MainWindow::currentDir); if ( !curDir.exists(".prev/") && MainWindow::listImage_Cout > 0 ) { curDir.mkdir(".prev/"); } #ifdef WINDOWS QString path(MainWindow::currentDir + ".prev/"); std::wstring wpath = path.toStdWString(); const wchar_t * temp= wpath.c_str(); SetFileAttributes(temp,FILE_ATTRIBUTE_HIDDEN); #endif for (int i=0; (i<MainWindow::listImage_Cout) && !MainWindow::stop_thread; ++i) { if (!QFile::exists( MainWindow::currentDir + ".prev/" + MainWindow::listName.at(i) )) { QImage im; QIcon ico; QSize size(200, 200); ico.addFile(MainWindow::currentDir + MainWindow::listImage.at(i), size); im = ico.pixmap(size).toImage(); im.save( MainWindow::currentDir + ".prev/" + MainWindow::listName.at(i), "JPG", 95); } } } };