I'm working on a gray.jpg In the picture , It is found that the generated image color space is : GRAYColorspace

But I set it in the code :

MagickWand * mw = NewMagickWand ();
MagickReadImage (mw, "gray.jpg"); MagickSetImageType (mw, TrueColorType);
MagickSetImageColorspace (mw, sRGBColorspace); MagickSetImageFormat(mw, "JPEG");
MagickWriteImage (mw, "gray-rgb.jpg")

Why the generated image (gray-rgb.jpg), Color space or :GRAYColorspace

If you use convert.exe Can :

convert gray.jpg -type truecolor gray-rgb.jpg

Generated gray-rgb.jpg , Color space :sRGBColorspace

After half a day's training google, Basically find out why :

ImageMagick The internal encoder will be based on the current number of image colors , Intelligent optimization , If meet  GRAYColorspace, It's automatically set to GRAYColorspace, Even if it's mandatory in the code :

MagickSetImageType (mw, TrueColorType);
MagickSetImageColorspace (mw, sRGBColorspace);

It's no use !!!

I found this later :http://www.imagemagick.org/script/command-line-options.php#define

It is mentioned that through the following settings , To solve this ImageMagick Intelligent choice  GRAYColorspace The problem of :

MagickSetOption(magick_wand, "colorspace:auto-grayscale", "off");

or

MagickSetImageProperty (magick_wand, "colorspace:auto-grayscale", "off");

But I tried , It didn't work .

Maybe I used it ImageMagick The version is a little low , 6.8.9 edition .

What's mentioned on the Internet is 6.9.2+ Version may only support this function .

I went to , It's hard to do , because ImageMagick If you upgrade to the latest version , There's a lot of code that needs to be changed , I really don't want to change .

ImageMagick It's kind of unacceptable , There is no room for developers to operate on it .

ImageMagick - Intelligent gray space (GRAYColorspace) More suffocating related articles

  1. ImageMagick Use the section

    ImageMagick Is a powerful open source graphics processing software , There should be few people using it in China , It's still updating , Release the full version download link http://ftp.icm.edu.pl/packages/ImageMagick/binar ...

  2. [ turn ]AI+RPA Fusion is smarter

    In this paper, from :https://www.jianshu.com/p/cf25b3dfc0f0 I've analyzed it many times before RPA The essence of , You can refer to [ Take off your coat ], have a look RPA What is a robot ?     Which? AI Related application technology ...

  3. Gray level co-occurrence matrix GLCM analysis

    Texture analysis is based on the gray level of the image ( Thick and light ) Extraction and analysis of spatial distribution patterns . Texture analysis in remote sensing images .X Radiograph . Cell image interpretation and processing has a wide range of applications . About texture , There is no unified mathematical model yet . It originated from the concept of texture characterizing the surface properties of textiles , Sure ...

  4. 【 Reading notes 《Bootstrap actual combat 》】2. Works display site

    Let's say we've decided to build an online site for our works . As always, , Pressed for time . We need to be quick , But the effect of the work must be professional . Of course , The site has to be responsive , Be able to browse normally on various devices , Because that's what we sell to our target customers . this ...

  5. 【Bootstrap】2. Works display site

    Let's say we've decided to build an online site for our works . As always, , Pressed for time . We need to be quick , But the effect of the work must be professional . Of course , The site has to be responsive , Be able to browse normally on various devices , Because that's what we sell to our target customers . this ...

  6. opencv note 4: Template operation and common filtering operation

    time:2015 year 10 month 04 Japan Sunday 00 when 00 branch 27 second # opencv note 4: Template operation and common filtering operation This article is mainly about learning template operation , Understand the operation process and classification of various template operations , The main theoretical reference < Imager ...

  7. isp and 3a What are the connections and differences between them ?

    Willis Zen As good as water 2  People agree The problem you're talking about , Not many people can answer , I can only tell you what I know .isp yes image signal processing, For image processing , such as gamma adjustment ,d ...

  8. [ Reprint + original ]Emgu CV on C# ( Four ) —— Emgu CV on Global fixed threshold binarization

    This paper focuses on the principle of global binarization and its mathematical realization , And make use of emgucv Method programming implementation . One . Theory overview ( Reprint , If you know image processing , You can skip , Just for science popularization , Or write articles to add up words )  1. summary Image binarization is a basic technology in image processing , also ...

  9. HOG( Direction gradient histogram )

    Combined with the papers I read this week , My research on this week Histogram of oriented gradients(HOG) Talk about your understanding : HOG descriptors It is applied in the field of computer vision and image processing , For target detection ...

Random recommendation

  1. Cancel TableViewCell The appearance of the selected state changes

    tabelViewcell Use Xib When creating a custom appearance , stay tableview When it's chosen ,cell The appearance of the car will change , In defining Xib As shown in the figure below, cancel the selected appearance state There are other options as well , You can choose to control when it is selected ...

  2. Learning notes ——git

    Yes , It's a new thing Use Git There are two steps to submit a file to the version Library : First step : It's using git add Add files to , It's actually adding files to the staging area . The second step : Use git commit Submit changes , In fact, it's just a temporary storage area ...

  3. Frame set (Framesets)

    1.Frameset Use The so-called frame is divided into several frame windows , Get multiple at the same time URL. only want <FRAMESET> <FRAME> that will do , And all frame markers It's going to be put in a place where it's going to work htm ...

  4. Loader for loading embedded assemblies z

    using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Ref ...

  5. [ Roof placement ] Programmers must know ( 3、 ... and ): One minute URI code (encodeURI)

    Because browsers use special characters for specific meanings , So if there are these special characters on the content to be transmitted , It needs to be escaped to transmit correctly , For example, the following characters are the keywords when sending , Special characters ;/?:@&=+$,# therefore ...

  6. STL set Containers add structures and sort

    #include <iostream> #include <string> #include <cstring> //strcpy #include <cst ...

  7. Java note : Inner class

    1. Put one class inside another to define , The class defined in other classes is called inner class , Classes that contain inner classes are called outer classes . Internal class members can directly access private data of external classes , But the outer class cannot access the implementation details of the inner class . 2. Non static inner class ( No, st ...

  8. AngularJS Advanced ( twenty )HTML5 Achieve access to geographic information and positioning function

    HTML5 Achieve access to geographic information and positioning function notes : Please click here to charge ! Preface This article mainly introduces HTML5 Achieve access to geographic information and positioning function , This article explains the original HTML5. Baidu Maps . Google maps and other three ways to get location information and ...

  9. Android Use Picasso Load the network image and zoom in and out

    Doing it android When the picture loads , Because the screen is limited , When a lot of big pictures are loaded , We're going to require equal scaling , For example, according to a fixed width , Scale the height equally , So that the size of the picture is scaled accordingly , But the picture doesn't deform . Obviously according to andro ...

  10. P1836 【 Page number _NOI Guide 2011 Improve (04)】

    P1836 Page number _NOI Guide 2011 Improve (04) Title Description The page number of a book is from 1—n Consecutive integer of number :1,2,3,…,n. Please find the sum of all the individual numbers in all the pages , For example 123 page , Its sum is 1+2+3=6. ...