12 #ifdef USE_IMAGEMAGICK
20 std::shared_ptr<Magick::Image>
24 if (!image || image->isNull())
28 const QRgb *tmpBits = (
const QRgb*)image->constBits();
31 auto magick_image = std::make_shared<Magick::Image>(
32 image->width(), image->height(),
33 "RGBA", Magick::CharPixel, tmpBits);
36 magick_image->backgroundColor(Magick::Color(
"none"));
37 magick_image->virtualPixelMethod(
38 Magick::TransparentVirtualPixelMethod);
45 std::shared_ptr<QImage>
52 const std::size_t size = image->columns() * image->rows() * BPP;
54 auto* qbuffer =
new unsigned char[size]();
56 MagickCore::ExceptionInfo exception;
58 MagickCore::ExportImagePixels(
59 image->constImage(), 0, 0,
60 image->columns(), image->rows(),
61 "RGBA", Magick::CharPixel,
64 auto qimage = std::make_shared<QImage>(
65 qbuffer, image->columns(), image->rows(),
66 image->columns() * BPP,
67 QImage::Format_RGBA8888_Premultiplied,
68 (QImageCleanupFunction) &openshot::cleanUpBuffer,
73 #endif // USE_IMAGEMAGICK