Code: Select all
Magick::Image img("test.png");
img.resize(Magick::Geometry(200, 200));
img.write("result.png");
for (col = img.columns() - 1; col >= 0; col--) { // reading right -> left
for (row = img.rows() - 1; row >= 0; row--) { // reading bottom -> top
Magick::ColorRGB rgb(img.pixelColor(col, row));
red = rgb.red() * 255;
green = rgb.green() * 255;
blue = rgb.blue() * 255;
// red, green, blue do NOT have correct values here
}
}
Code: Select all
Magick::Image img("test.png");
img.resize(Magick::Geometry(200, 200));
Magick::Image imgCopy = img; // make copy
img.write("result.png");
for (col = imgCopy.columns() - 1; col >= 0; col--) { // reading right -> left
for (row = imgCopy.rows() - 1; row >= 0; row--) { // reading bottom -> top
Magick::ColorRGB rgb(imgCopy.pixelColor(col, row));
red = rgb.red() * 255;
green = rgb.green() * 255;
blue = rgb.blue() * 255;
// red, green, blue are correct here
}
}