本文整理汇总了C++中magick::Image::compressType方法的典型用法代码示例。如果您正苦于以下问题:C++ Image::compressType方法的具体用法?C++ Image::compressType怎么用?C++ Image::compressType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类magick::Image
的用法示例。
在下文中一共展示了Image::compressType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onInput
void WriteFrame::onInput(InputImageInfo info, Magick::Image img) {
QString framePath = outputDir.path() + QDir::separator()
+ leadingZeros(info.frame, FRAME_FILE_LEADING_ZEROS) + QString(".jpeg");
*verboseOutput << "Write frame " << framePath << endl;
if (!dryRun) {
img.compressType(Magick::JPEGCompression);
img.magick( "JPEG" );
img.write(framePath.toStdString());
}
// update image location & emit signal
info.file = QFileInfo(framePath);
emit input(info, img);
}
示例2: imageCaptured
void TimeLapseCapture::imageCaptured(QString format, Magick::Blob blob, Magick::Geometry sizeHint) {
bool readRawFromFile = false;
QString framePath = output.path() + QDir::separator()
+ leadingZeros(capturedCnt, FRAME_FILE_LEADING_ZEROS) + "_" + leadingZeros(capturedSubsequence, 2);
if (format == "RGB") {
if (storeRawImages) {
// store RAW RGB data in PPM format
QString pgmHeader = QString("P6\n%1 %2\n255\n").arg(sizeHint.width()).arg(sizeHint.height());
std::string headerStr = pgmHeader.toStdString();
const char *headerBytes = headerStr.c_str();
size_t headerLen = strlen(headerBytes);
if (shutterSpdAlg != NULL && capturedSubsequence == 0) {
Magick::Image capturedImage;
capturedImage.read(blob, sizeHint, 8, "RGB");
shutterSpdAlg->update(capturedImage);
}
framePath += ".ppm";
QFile file(framePath);
file.open(QIODevice::WriteOnly);
file.write(headerBytes, headerLen);
file.write((char*) blob.data(), blob.length());
file.close();
} else {
// convert RGB data to JPEG
Magick::Image capturedImage;
capturedImage.read(blob, sizeHint, 8, "RGB");
if (shutterSpdAlg != NULL && capturedSubsequence == 0) {
shutterSpdAlg->update(capturedImage);
}
QDateTime now = QDateTime::currentDateTime();
QString exifDateTime = now.toString("yyyy:MM:dd HH:mm:ss");\
// ImageMagick don't support writing of exif data
// TODO: setup exif timestamp correctly
capturedImage.attribute("EXIF:DateTime", exifDateTime.toStdString());
//capturedImage.defineValue("EXIF", "DateTime", exifDateTime.toStdString());
capturedImage.compressType(Magick::JPEGCompression);
capturedImage.magick("JPEG");
framePath += ".jpeg";
capturedImage.write(framePath.toStdString());
}
} else {
if (shutterSpdAlg != NULL && capturedSubsequence == 0) {
try {
Magick::Image capturedImage;
capturedImage.read(blob, format.toStdString());
shutterSpdAlg->update(capturedImage);
} catch (const std::exception &e) {
err << "Failed to decode captured image (" << format << "): " << QString::fromUtf8(e.what()) << endl;
readRawFromFile = true;
}
}
// store other formats in device specific format
framePath += "." + format;
QFile file(framePath);
file.open(QIODevice::WriteOnly);
file.write((char*) blob.data(), blob.length());
file.close();
if (readRawFromFile && shutterSpdAlg != NULL && capturedSubsequence == 0) {
/* I don't understand ImageMagick correctly, but it fails with reading RAW files
* from memory blob, but reading from file works (sometimes).
* Maybe, it don't support delegating (dcraw, ufraw...) with memory data...
*/
try {
Magick::Image capturedImage;
capturedImage.read(framePath.toStdString());
shutterSpdAlg->update(capturedImage);
} catch (const std::exception &e) {
err << "Failed to decode captured image (" << framePath << "): " << QString::fromUtf8(e.what()) << endl;
}
}
}
verboseOutput << "Captured frame saved to " << framePath << endl;
capturedSubsequence++;
}
示例3:
void Magick::compressTypeImage::operator()( Magick::Image &image_ ) const
{
image_.compressType( _compressType );
}