Updating my website examples

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
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Updating my website examples

Post by Bonzo »

I am updating my website and trying to finish off the examples. I have a list of missing ones due to not working, not tried and bad examples.

Here are a couple I can not understand why they are not working; any ideas?

No visable change to the input images ( 76,21 is a green pixel on the input image ):

Code: Select all

$cmd = " $input -green-primary 76,21 ";
exec("convert $cmd green_primary.jpg");

$cmd = "$input -channel red -threshold 50%";
exec("convert $cmd threshold.jpg");
Result was nearly completly white no matter what value I used for linear-stretch

Code: Select all

$cmd = " $input -linear-stretch 0.5 ";
exec("convert $cmd linear_stretch.jpg");
Tile-offset is a convert option and tile is a composite one. Am I using it in the wrong context?

Code: Select all

// Resize the boots image first to fit image
exec("convert $input1 -thumbnail 50x50 temp.png");
// Tile the image
$cmd = " -geometry +30+30 -tile-offset +120-120 tile:temp.png $input ";  
exec("composite $cmd tile_offset.jpg");
Has no effect on the font

Code: Select all

$cmd = "-size 213x160 -background NavajoWhite -fill black". 
" -gravity center -pointsize 30 -family Andalus -font Andalus -stretch UltraExpanded caption:\"Stretch\" "; 
exec("convert $cmd stretch.jpg ");
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Updating my website examples

Post by fmw42 »

I know nothing about -green-primary and the docs don't help. I wonder if x,y means something other than pixels coordinates.

With regard to -linear-stretch 0.5, you probably need to specify two values as the default will be Quantumrange - the one value.
You are also only stretching by 0.5 graylevels. Perhaps use %

convert rose: -linear-stretch 1,1% show:
or
convert rose: -linear-stretch 10,10% show:

In your last example, it appears that you are compositing with only one image. Though I have not tested your example. I know little about tile-offset. You probably need to change composite to convert. see http://www.imagemagick.org/Usage/canvas/#tile-offset
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Updating my website examples

Post by Bonzo »

I will check your comments out fmw42 - I posted in a hurry and the tile-offset code is the wrong one as I had been trying different options.

I had started with -tile temp.png and that did not work and found tile:temp.png on Anthony's usage section.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Updating my website examples

Post by anthony »

fmw42 wrote:I know nothing about -green-primary and the docs don't help. I wonder if x,y means something other than pixels coordinates.
I know they are normalized coordinates in a XYZ colorspace.

Never really touched them either. But the internal defaults (from "image.c") are

image->chromaticity.red_primary.x=0.6400;
image->chromaticity.red_primary.y=0.3300;
image->chromaticity.green_primary.x=0.3000;
image->chromaticity.green_primary.y=0.6000;
image->chromaticity.blue_primary.x=0.1500;
image->chromaticity.blue_primary.y=0.0600;
image->chromaticity.white_point.x=0.3127;
image->chromaticity.white_point.y=0.3290;

The settings for these (same name) are simply 'stored' as strings, then applied as floats (no scaling) directly to these values. If the second number is missing the first number is applied to both X and Y, though really not providing two numbers is non-sensical, no syntax check is made for this. I have added a note that perhaps it should!

I think they are actually used for RGB to XYZ mapping but I have not checked it to be certain.
Their is something for 'black point compensation too. but again I am not certain.

If someone does no for certain, now is a good time to say so.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Updating my website examples

Post by Bonzo »

Tile-offset is not what I was expecting as I thought it would be the distance between each tile, it is working now.

There are two or three operators that nobody seems to know how they work or what they even do.

-linear-stretch is working.

even upgrading to the latest version -stretch has no effect - does it need pango or whatever its called?
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: Updating my website examples

Post by glennrp »

green_primary.x, etc., are elements of the chromaticity matrix. For each color, x+y must be positive and less than 1.0. If you specify one you should specify all six plus the white_point x and y. "x" and "y" have nothing to do with pixel location. In fact each component has a "z" that is internally computed by the color management system from (color.x + color.y + color.z = 1.0). The default numbers that you found in image.c are from the sRGB specification.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Updating my website examples

Post by anthony »

Bonzo wrote:Tile-offset is not what I was expecting as I thought it would be the distance between each tile, it is working now.
It should be how must to 'roll' or offset the tiling pattern for the -tile and tile: operators.
There are two or three operators that nobody seems to know how they work or what they even do.
Which often are special purpose settings.
-attunate -lowlight-color -highlight-color are such settings :-)
Little used with special purposes.

Code: Select all

-linear-stretch  is working
even upgrading to the latest version -stretch has no effect - does it need pango or whatever its called?
It is a normalization type operator. -stretching the histogram from the lowest and highest values found in the image.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply