Search found 5 matches

by sir8472
2018-12-17T15:50:19-07:00
Forum: MagickWand for PHP
Topic: force greyscale image to sRGB
Replies: 6
Views: 139760

Re: force greyscale image to sRGB

For completeness and to any lost coder who needs to do something similar, this is what I've ended up with in PHP:


$img = new Imagick();
$img->readImage('in.png');

// Convert the image to a TIF file
$img->setImageFormat('tiff');

// Set the image type to TrueColour Matte (transparency should be ...
by sir8472
2018-12-13T04:31:09-07:00
Forum: MagickWand for PHP
Topic: force greyscale image to sRGB
Replies: 6
Views: 139760

Re: force greyscale image to sRGB

Well, in the absence of a PHP solution, and a need to get sRGB TIF files through I have created the following script which may be useful to someone else in the future as a starting point.


#!/bin/bash
############################################
# convertGreyscaleTosRGB
# Transform images from ...
by sir8472
2018-12-13T02:56:15-07:00
Forum: MagickWand for PHP
Topic: force greyscale image to sRGB
Replies: 6
Views: 139760

Re: force greyscale image to sRGB

The imagick object is actually handed off to a storage class to write to disk. Live code doesn't actually "file_put_contents", but I bet it doesn't use writeImage either, which is why I didn't include it here. If it makes you feel any better I can use writeImage in the example, file output is the ...
by sir8472
2018-12-13T02:12:55-07:00
Forum: MagickWand for PHP
Topic: force greyscale image to sRGB
Replies: 6
Views: 139760

Re: force greyscale image to sRGB

From various searches on Stack Overflow and this forum, I had assumed "type" needed to be used with the "colorspace" option, though I admit my interpretation is coloured (pun) by lack of knowledge in this area.

$img->setoption("colorspace:auto-grayscale", "off"); Is another option I've found ...
by sir8472
2018-12-13T00:53:28-07:00
Forum: MagickWand for PHP
Topic: force greyscale image to sRGB
Replies: 6
Views: 139760

force greyscale image to sRGB

I am hoping someone can help, as I'm a little bit stuck with some code.

From the command line, I can take an input PNG file, convert it to TIF and force it to sRGB using the following:

convert in.png -colorspace srgb -type truecolor out.tif

and it outputs a TIF file with:
colorspace:13 (Imagick ...