[SOLVED]Writing a white image: after a certain size it gives me a "pixels are not authentic" error
Posted: 2017-08-03T04:21:59-07:00
I'm playing around with Magick++ prior to a uni project I've to do in C++.
In particular, as of now, I'm implementing some kernel image processing. Long story short, after certain operations (i.e. exporting, doing the convolution on the 2D std::vectors, etc.) I want to set the pixel of a completely white image to those i calculated with the convolution, so I do the following:
However, after the 0th iteration of the outer for-loop and 479th iteration of the inner for-loop it throws me the following error:
, so a white image of the specified dimensions (I do display and it shows correctly).
However it seems like the library, at a certain point, considers this image as a 480x480, in fact, if I do the for(s), both using the height it works (obviously it only shows me a square of the processed image and a white bar on the right (the remaining 640-480 not set pixels)).
I also tried to manually set one pixel in the outer range (e.g. pixel(1,500)) and it gives me the same error..
I'm sure it's a simple error.. however I'm not getting it..
In particular, as of now, I'm implementing some kernel image processing. Long story short, after certain operations (i.e. exporting, doing the convolution on the 2D std::vectors, etc.) I want to set the pixel of a completely white image to those i calculated with the convolution, so I do the following:
Code: Select all
for(unsigned int i = 0; i < elaboratedImage.size().height()-1; i++){
for(unsigned int j = 0; j < elaboratedImage.size().width()-1; j++){
elaboratedImage.pixelColor(i,j, Color(reds.at(i).at(j), greens.at(i).at(j), blues.at(i).at(j), 0));
//std::cout << "i = " << i << "\tj = " << j << std::endl;
}
}
The image is 640x480, that I created usingterminate called after throwing an instance of 'Magick::ErrorCache'
what(): ImMagPlayground: pixels are not authentic `#FFFFFF' @ error/cache.c/QueueAuthenticPixelCacheNexus/3961
Code: Select all
Image elaboratedImage(Geometry(640,480), Color(QuantumRange, QuantumRange, QuantumRange));
However it seems like the library, at a certain point, considers this image as a 480x480, in fact, if I do the for(s), both using the height it works (obviously it only shows me a square of the processed image and a white bar on the right (the remaining 640-480 not set pixels)).
I also tried to manually set one pixel in the outer range (e.g. pixel(1,500)) and it gives me the same error..
I'm sure it's a simple error.. however I'm not getting it..