image.resize returning 0 bytes
Posted: 2016-02-19T15:45:56-07:00
Hi,
I've hit a problem I'm unsure how to debug further, I have the below code which reads in an image, resizes it and returns it. This worked fine until my C drive filled up with tmp files and the program died. I cleared the magick tmp files out so the C drive has lots of free room now, but when I run my code again, image.fileSize() returns 0 after the image.resize(). So with the code below, File1 filesize will be 570639, File2 will be 570639, but File3 & File4 will be 0
I tried starting a new Visual Studio project, I've moved code around, tried variations etc, I'm stuck as to what could be the problem, any tips on what might be wrong?
Thanks
I've hit a problem I'm unsure how to debug further, I have the below code which reads in an image, resizes it and returns it. This worked fine until my C drive filled up with tmp files and the program died. I cleared the magick tmp files out so the C drive has lots of free room now, but when I run my code again, image.fileSize() returns 0 after the image.resize(). So with the code below, File1 filesize will be 570639, File2 will be 570639, but File3 & File4 will be 0
Code: Select all
Image myResizeImage(string imgPath, int width, int height) {
Image image;
try {
image.read(imgPath);
cout << "File1: " << imgPath << " : " << image.fileSize() << '\n';
} catch (WarningCoder &warning) {
cout << "Coder Warning: " << warning.what() << '\n';
} catch (Warning &warning) {
cout << "Warning: " << warning.what() << '\n';
} catch (ErrorFileOpen &error) {
cout << "Error: " << error.what() << '\n';
return image;
} catch (ErrorCorruptImage &error) {
cout << "Error: " << error.what() << '\n';
return image;
}
Geometry newSize = Geometry(width, height);
newSize.aspect(false);
cout << "File2: " << imgPath << " : " << image.fileSize() << '\n';
image.resize(newSize);
cout << "File3: " << imgPath << " : " << image.fileSize() << '\n';
image.type(GrayscaleType);
//image.resize(newSize);
cout << "File4: " << imgPath << " : " << image.fileSize() << '\n';
return image;
}
Thanks