Which function should i use to remove(strip) colorspace of a image using Imagemagick magickwand - go-imagick

I actually wanted to remove the colorspace of the image. However, which colorspace type should I use in the transformimagecolorspace method COLORSPACE_UNDEFINED or any thing else?

Related

Is it possible to convert eps to png24 that is grayscale using ghostscipt

It seems that ghostscript uses different device for PNG24 and grayscale.
Is there a way to convert an EPS file to PNG24 format that is grayscale?

imagemagick (or other) png->svg->png or svg->png

Im trying to convert either a svg to png or png to svg back to png with imagemagick and it seems like everything I try the final image is black outlined. I'm expecting it to keep all colors the same through-out the process but it doesn't seem to?
convert input.svg output.png
Even if I try the autotrace approach on the imagemagick site nothing changes. I'd prefer to just be able to have the input be PNG output to SVG (smooth borders) and then back out to PNG. Might sound silly but all of the smooth-bordering/anti-aliasing approaches mentioned on the imagemagick site seem to make all output (any colors but white) be black?

How Do I Convert Palette-Based PNG with Transparency To RGB in PIL?

I'm currently building a site in app engine that uploads images to google cloud storage and to complete basic manipulations I'm using python's PIL
I've been having problems with the following image which another stackoverflow member has mentioned is a palette-based PNG with transparency, which I've been reading may be a bit buggy in PIL
My question is really a back to basics one: What is the best way to convert this to an RGB format with transparent pixels set to #FFF? I've been able to get it to work through a combined RGBA then RGB paste but that seems redundant
However, for a direct conversion I'm getting a bad transparency mask i.e. using the solution from PIL Convert PNG or GIF with Transparency to JPG without
Also if anybody has ideas why the image degrades to terrible quality after conversion, that's entirely a bonus for me!
A way to do this is to first convert the file to jpg -- seems like a problem with the png encoding (or something related to that)
Check out this link that I used and got smooth conversion from transparent PNG to GIF:
Convert RGBA PNG to RGB with PIL
The function you are looking for is pure_pil_alpha_to_color_v2.
I also used for my image conversion tool PySmile:
https://github.com/vietlq/PySmile/blob/master/pysmile.py

How to determine image colorspace using WIC?

How can I determine the colorspace of an image using WIC? I want to know if an image is RGB, CMYK or mono(B/W). I would prefer not looking at every color format available.
Why I want to know is I want to use IWICColorContext::InitializeFromFilename method but to give it a proper profile I need to know if the image is RGB, CMYK or mono.

How to save 8-bit PNGs with ChunkyPNG or RMagick

I've been trying to save 8-bit PNGs (PNG8) using RMagick (http://rmagick.rubyforge.org/) and ChunkyPNG (https://github.com/wvanbergen/chunky_png) but have been unable to do so.
However the only time I can get it to work on RMagick is if the ImageMagick installation is based on the QuantumDepth of 8 rather than the usual 16. It is not possible to change this setting on the fly - the installation of ImageMagick has to be compiled with this setting.
Also setting the depth to 8 when creating the image or prefixing a format type when saving have no effect.
ie. img.write('PNG8:image.png')
Anyway I've had a look at ChunkyPNG and I really prefer to use this over RMagick - simply because it is pure Ruby and doesnt depend on ImageMagick. I can't save a PNG8 using that too.
I have to convert the PNG to 8bit afterwards using a graphics program -
My questions:
Is there a way of saving 8bit PNGs properly like it does on ImageMagick Q8 on a machine with ImageMagick Q16 installed?
Can anyone provide pointers as to do my own 4-bit encoder in ChunkyPNG or know of a way to save PNG8 with it?
Thanks in advance..
What exactly do you mean by PNG8? 8-bit grayscale, 8-bit indexed color, 3x8 bit RGB or 4x8 bit RGBA? All of these color modes are supported by ChunkyPNG.
By default, ChunkyPNG tries to determine the best color mode to save your image. You can overwrite it by providing an options hash to the save method:
image.save('filename.png', color_mode: ChunkyPNG::COLOR_TRUECOLOR)
# Or: ChunkyPNG::COLOR_TRUECOLOR_ALPHA
image.to_blob(color_mode: ChunkyPNG::COLOR_INDEXED, bit_depth: 8)
More info: https://github.com/wvanbergen/chunky_png/wiki

Resources