You've already forked libopenshot
mirror of
https://github.com/OpenShot/libopenshot.git
synced 2026-03-02 08:53:52 -08:00
Add backwards-compatible Imagemagick 7 support (#252)
* Add ImageMagick 7 compatibility A new header, `imclude/MagickUtilities.h`, is created to hold the compatibility `#define`s. The image-conversion code in `src/Frame.cpp` received the only major changes — instead of doing the export by hand (and having to account for changes in the underlying API), it uses the `MagickCore::ExportImagePixels()` function which does basically the same work, but accounts for all of the API changes for us. The API of that function is _unchanged_ from IM6 to IM7. TODO: `MagickCore::ExportImagePixels()` will return an `exception` struct if it encounters any problems. Currently the code ignores that, which it should not. * Add ImageMagick 7 compatibility A new header, `imclude/MagickUtilities.h`, is created to hold the compatibility `#define`s. The image-conversion code in `src/Frame.cpp` received the only major changes — instead of doing the export by hand (and having to account for changes in the underlying API), it uses the `MagickCore::ExportImagePixels()` function which does basically the same work, but accounts for all of the API changes for us. The API of that function is _unchanged_ from IM6 to IM7. TODO: `MagickCore::ExportImagePixels()` will return an `exception` struct if it encounters any problems. Currently the code ignores that, which it should not. Thanks @ferdnyc
This commit is contained in:
committed by
Jonathan Thomas
parent
faa3a34420
commit
a47d5b58fd
@@ -25,6 +25,9 @@
|
||||
* along with OpenShot Library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// Require ImageMagick support
|
||||
#ifdef USE_IMAGEMAGICK
|
||||
|
||||
#include "../include/ImageReader.h"
|
||||
|
||||
using namespace openshot;
|
||||
@@ -59,7 +62,7 @@ void ImageReader::Open()
|
||||
|
||||
// Give image a transparent background color
|
||||
image->backgroundColor(Magick::Color("none"));
|
||||
image->matte(true);
|
||||
MAGICK_IMAGE_ALPHA(image, true);
|
||||
}
|
||||
catch (Magick::Exception e) {
|
||||
// raise exception
|
||||
@@ -192,3 +195,5 @@ void ImageReader::SetJsonValue(Json::Value root) {
|
||||
Open();
|
||||
}
|
||||
}
|
||||
|
||||
#endif //USE_IMAGEMAGICK
|
||||
|
||||
Reference in New Issue
Block a user