ImageLoader: convert images always to 8-bit depth as expected by Shark.cpp (i.e. 16-bit images can be loaded now) v_0
authorFrantišek Kučera <franta-hg@frantovo.cz>
Sun, 03 Dec 2023 00:57:54 +0100
branchv_0
changeset 13 82bb4fe2fd4a
parent 12 076e3b2d97ac
child 14 ceeb36fad818
ImageLoader: convert images always to 8-bit depth as expected by Shark.cpp (i.e. 16-bit images can be loaded now)
ImageLoader.cpp
--- a/ImageLoader.cpp	Sun Dec 03 00:17:48 2023 +0100
+++ b/ImageLoader.cpp	Sun Dec 03 00:57:54 2023 +0100
@@ -25,12 +25,18 @@
 ImageLoader::ImageBuffer* ImageLoader::loadImage(const Buffer& input) {
 	Magick::Blob inputBlob(input.getData(), input.getSize());
 	Magick::Image image(inputBlob);
+	// Magick::Image image("magick:LOGO");
+	// Magick::Image image("magick:WIZARD");
+	// Magick::Image image("https://.../remote-image.png");
+	// Magick::Image image("x:root"); // whole desktop
+	// Magick::Image image("x:0x6a0001c"); // single window, use e.g. xwininfo
 
 	// Magick::PixelPacket* parsedPixels = parsedImage.getPixels(
 	//     0, 0, parsedImage.size().width(), parsedImage.size().height());
 	
 	Magick::Blob outputBlob;
 	image.magick("RGBA");
+	image.depth(8); // TODO: pass more bits to OpenGL?
 	image.write(&outputBlob);
 
 	ImageBuffer* outputBuffer = new ImageBuffer(