Linear Colorspace
Sam Wilson <[email protected]>
| Newsgroups | gmane.comp.video.graphicsmagick.help |
|---|---|
| Message-ID | <[email protected]> |
Hey graphicsmagick-help,
I need your assistance! I'm trying to resize an image
(http://www.4p8.com/eric.brasseur/gamma_dalai_lama_gray.jpg) using a
linear colorspace. I can't seem to get GraphicsMagick to actually do the
conversion. I'm probably making a really dumb mistake, but any input
would be hugely appreciated. The code below seems to work with
ImageMagick 6.9.2-7, but not with GraphicsMagick 1.3.23 (obviously
change MagickCore to MagickLib.)
Here's my program:
#include <Magick++.h>
#include <vector>
using namespace Magick;
int main(int, char** argv)
{
InitializeMagick(argv[0]);
std::vector<Image> images;
readImages(&images, "gamma_dalai_lama_gray.jpg");
Geometry geom(129, 111);
std::for_each(images.begin(), images.end(), [&geom] (Image& img) {
img.quality(80);
MagickCore::ImageInfo* info = img.imageInfo();
MagickCore::CloneString(&info->sampling_factor, "1x1,1x1,1x1");
img.colorSpace(ColorspaceType::RGBColorspace);
img.scale(geom);
img.colorSpace(ColorspaceType::sRGBColorspace);
});
writeImages(images.begin(), images.end(),
"gamma_dalai_lama_gray_half.jpg");
}
Compile with: g++ main.cpp -std=c++11 `pkg-config --cflags --libs
GraphicsMagick GraphicsMagick++` -Wall
Thanks,
Sam
------------------------------------------------------------------------------
Go from Idea to Many App Stores Faster with Intel(R) XDK
Give your users amazing mobile app experiences with Intel(R) XDK.
Use one codebase in this all-in-one HTML5 development environment.
Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs.
http://pubads.g.doubleclick.net/gampad/clk?id=254741911&iu=/4140