Skip to content

Commit cf4e7b6

Browse files
author
Bim Overbohm
committed
Do not copy image, but get channel directly
1 parent 0c993a7 commit cf4e7b6

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

.vscode/launch.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"--shift=128",
1414
"--tilemap",
1515
"--movecolor0=00ff00",
16-
"\"${workspaceFolder}/../Remute-Unity/Gfx_work/slides/glow1.png\"",
16+
"\"${workspaceFolder}/../Remute-Unity/gfx/glow1.png\"",
1717
"bla"
1818
],
1919
"stopAtEntry": false,

src/processing/imagehelpers.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ std::vector<uint8_t> getImageData(const Magick::Image &img)
1212
// get palette indices as unsigned chars
1313
const auto nrOfColors = img.colorMapSize();
1414
REQUIRE(nrOfColors <= 256, std::runtime_error, "Only up to 256 colors supported in color map");
15-
auto temp = img; // Currently im ImageMagick 7 channel() is non-const, so we need a copy here
16-
temp.channel(MagickCore::IndexChannel); // new in ImageMagick 7: Switch to IndexChannel
15+
// get IndexChannel from image
16+
auto temp = img.separate(MagickCore::IndexChannel);
1717
auto indices = temp.getConstPixels(0, 0, temp.columns(), temp.rows());
1818
REQUIRE(indices != nullptr, std::runtime_error, "Failed to get paletted image pixels");
1919
const auto nrOfIndices = temp.columns() * temp.rows();

0 commit comments

Comments
 (0)