#include <Magick++.h>
using namespace std;
using namespace Magick;
int main(int argc,char **argv)
{
InitializeMagick(*argv);
Thumbnail.read(argv[1]);
Thumbnail.resize(Geometry(50, 50));
Pixels viewThumbnail(ResizedThumbnail);
PixelPacket *ThumbnailPixels = viewThumbnail.get(0, 0, 50, 50);
}
Info:
#define MagickPackageName "ImageMagick"
#define MagickCopyright "Copyright (C) 1999-2012 ImageMagick Studio LLC"
#define MagickSVNRevision "8535"
#define MagickLibVersion 0x677
#define MagickLibVersionText "6.7.7"
#define MagickLibVersionNumber 5,0,0
#define MagickLibAddendum "-10"
#define MagickLibInterface 5
#define MagickLibMinInterface 5
#define MagickReleaseDate "2013-09-10"
#define MagickChangeDate "20120628"
#define MagickAuthoritativeURL "http://www.imagemagick.org"
g++ --version
g++ (Ubuntu/Linaro 4.7.3-1ubuntu1) 4.7.3
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
uname -r && lsb_release -rd
3.8.0-26-generic
Description: Linux Mint 15 Olivia
Release: 15
When I resize Thumbnail it makes PixelPacket return nullptr regardless of what size I chose, and using Image ResizedThumbnail = Thumbnail
does not fix the issue. Crop does not cause an issue but scale and resize do. Also if I put Thumbnail.write("test.jpg");
before Pixels viewThumbnail(...)
test.jpg is a valid jpeg image
Using the following fixes the issue:
Geometry Size = Geometry(twidth, theight);
Size.aspect(true);
Thumbnail.resize(Size);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.