The following works ok:
Code: Select all
Magick::Image image;
image.read("file.tiff[3]");
Code: Select all
int level;
// Determine what level to use...
image.read("file.tiff", level);
Code: Select all
Magick::Image image;
image.read("file.tiff[3]");
Code: Select all
int level;
// Determine what level to use...
image.read("file.tiff", level);
Code: Select all
Magick::Image image;
image.subImage(3);
image.subRange(1);
image.read("file.tiff");
Code: Select all
int main(int argc,char * argv)
{
InitializeMagick(argv);
std::string path("C:\\Tests\\vid.mpg");
/** Passing [0] in the file name itself **/
Image *image1=new Image();
image1->read(path+"[0]");
image1->write("C:\\Tests\\SceneInName.jpeg");
delete(image1);
cout<<"Copying from image done.";
/** Asking to retrieve only first frame by using subRange **/
ifstream fl(path.c_str(), ios::in | IOS_IN_BINARY );
fl.seekg(0, ios::end );
size_t blobLen = fl.tellg();
unsigned char* blobData = new unsigned char[blobLen];
char* c=reinterpret_cast<char *>(blobData);
fl.seekg(0,ios::beg);
fl.read(c, blobLen);
fl.close();
// Construct Magick++ Blob
Blob blob(static_cast<const unsigned char*>(blobData), blobLen);
delete [] blobData;
image1=new Magick::Image();
image1->subImage(3);
image1->subRange(1);
image1->magick("MPG");
image1->read( blob);
image1->write("C:\\Tests\\SceneInSubRange.jpeg");
delete(image1);
cout<<"Copying from Bytes done.";
}