Removing all color data from grayscale png's?

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
i73
Posts: 42
Joined: 2016-08-24T11:30:27-07:00
Authentication code: 1151

Removing all color data from grayscale png's?

Post by i73 » 2017-06-01T18:03:34-07:00

When exporting Grayscale pngs (Save to web) It still contains color data, Artists have to be in Grayscale mode in Photoshop in order for them to export actual Grayscale:
Image

I'm wondering if I am able to remove the color data with ImageMagick?

i73
Posts: 42
Joined: 2016-08-24T11:30:27-07:00
Authentication code: 1151

Re: Removing all color data from grayscale png's?

Post by i73 » 2017-06-01T18:06:45-07:00

I should Litterally do some research on my own...:

Code: Select all

convert D:\myGrayscaleImage.png -set colorspace RGB -colorspace gray D:\myNewGrayscaleImage.png
@Admin you can remove this post.. Sorry guys,

Dabrosny
Posts: 111
Joined: 2013-10-02T10:49:39-07:00
Authentication code: 6789
Location: New York, US

Re: Removing all color data from grayscale png's?

Post by Dabrosny » 2017-09-11T05:46:06-07:00

i73 wrote:
2017-06-01T18:06:45-07:00

Code: Select all

convert D:\myGrayscaleImage.png -set colorspace RGB -colorspace gray D:\myNewGrayscaleImage.png
It's not clear to me why you are including -set colorspace RGB, which is normally used when you need to change an incorrect colorspace designation on an image.
If your image is nonlinear (sRGB as most PNGs are) then it should be marked as such already by IM when it is read in. The -colorspace operation is intended to operate on the correct current colorspace, so if you have changed it to something that no longer correctly represents the data, then the resulting grayscale will not be what is normally expected from -colorspace gray.
-Dabrosny [Using IM7.0.6 or higher, Q16 HDRI x64 native executable, command line, often invoked from cygwin bash/sh (as of Aug. 2017)]

Post Reply