About API description!!
About API description!!
About API description??
Last edited by diuming on 2011-01-19T22:46:13-07:00, edited 1 time in total.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: About API description!!
API just means "Application Programming Interface"
So the question becomes... What API are you refering to?
All the API's are listed on the offical website, though many just refer to another API for the function list.
So the question becomes... What API are you refering to?
All the API's are listed on the offical website, though many just refer to another API for the function list.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: About API description!!
Dear Master,
I know that about API.
I encountered a big problem When I using MagickCore and MagickWand's C API.
Sometimes I do not understand function and argument's descriptions (It's not clear), So I have to post a question again again again and again!!
For example, I try to compose 4 channel image (c.jpg, m.jpg, y.jpg, k.jpg) into signal file (result_cmyk.jpg), But I still not success.
.
.
MagickWand * srcImageC, * srcImageM, * srcImageY, * srcImageK, * destImage;
MagickWandGenesis();
/*
* Create the winds
*/
srcImageC = NewMagickWand();
srcImageM = NewMagickWand();
srcImageY = NewMagickWand();
srcImageK = NewMagickWand();
destImage = NewMagickWand();
MagickReadImage(srcImageC, "c.jpg");
MagickReadImage(srcImageM, "m.jpg");
MagickReadImage(srcImageY, "y.jpg");
MagickReadImage(srcImageK, "k.jpg");
MagickSetSizeOffset(destImage, columns, rows, 0);
MagickSetSize(destImage, columns, rows);
MagickSetColorspace(destImage, CMYKColorspace); // The result image file always RGB
MagickSetImageResolution(destImage, 360, 360);
MagickSetImageUnits(destImage, PixelsPerInchResolution);
MagickBooleanType status;
status = MagickCompositeImageChannel(destImage, CyanChannel , srcImageC, CopyOpacityCompositeOp , 0, 0); //false
status = MagickCompositeImageChannel(destImage, MagentaChannel , srcImageM, CopyOpacityCompositeOp , 0, 0); //false
status = MagickCompositeImageChannel(destImage, YellowChannel , srcImageY, CopyOpacityCompositeOp , 0, 0); //false
status = MagickCompositeImageChannel(destImage, BlackChannel , srcImageK, CopyOpacityCompositeOp , 0, 0); //false
//I try to use combine, but still false
NSLog(@"Status : %i", status); // always get MagickFalse
if (status == MagickFalse)
ThrowWandException(destImage);
MagickWriteImage(destImage, "result_cmyk.jpg"); ///No image output
/*
* tidy up
*/
if (srcImageC) srcImageC = DestroyMagickWand(srcImageC);
if (srcImageM) srcImageM = DestroyMagickWand(srcImageM);
if (srcImageY) srcImageY = DestroyMagickWand(srcImageY);
if (srcImageK) srcImageK = DestroyMagickWand(srcImageK);
if (destImage) destImage = DestroyMagickWand(destImage);
MagickWandTerminus();
.
.
Sorry about that, Maybe my composite concept is incorrect.
Thanks for ImageMagick provides useful image processing tool.
Thanks alot.
Diuming
I know that about API.
I encountered a big problem When I using MagickCore and MagickWand's C API.
Sometimes I do not understand function and argument's descriptions (It's not clear), So I have to post a question again again again and again!!
For example, I try to compose 4 channel image (c.jpg, m.jpg, y.jpg, k.jpg) into signal file (result_cmyk.jpg), But I still not success.
.
.
MagickWand * srcImageC, * srcImageM, * srcImageY, * srcImageK, * destImage;
MagickWandGenesis();
/*
* Create the winds
*/
srcImageC = NewMagickWand();
srcImageM = NewMagickWand();
srcImageY = NewMagickWand();
srcImageK = NewMagickWand();
destImage = NewMagickWand();
MagickReadImage(srcImageC, "c.jpg");
MagickReadImage(srcImageM, "m.jpg");
MagickReadImage(srcImageY, "y.jpg");
MagickReadImage(srcImageK, "k.jpg");
MagickSetSizeOffset(destImage, columns, rows, 0);
MagickSetSize(destImage, columns, rows);
MagickSetColorspace(destImage, CMYKColorspace); // The result image file always RGB
MagickSetImageResolution(destImage, 360, 360);
MagickSetImageUnits(destImage, PixelsPerInchResolution);
MagickBooleanType status;
status = MagickCompositeImageChannel(destImage, CyanChannel , srcImageC, CopyOpacityCompositeOp , 0, 0); //false
status = MagickCompositeImageChannel(destImage, MagentaChannel , srcImageM, CopyOpacityCompositeOp , 0, 0); //false
status = MagickCompositeImageChannel(destImage, YellowChannel , srcImageY, CopyOpacityCompositeOp , 0, 0); //false
status = MagickCompositeImageChannel(destImage, BlackChannel , srcImageK, CopyOpacityCompositeOp , 0, 0); //false
//I try to use combine, but still false
NSLog(@"Status : %i", status); // always get MagickFalse
if (status == MagickFalse)
ThrowWandException(destImage);
MagickWriteImage(destImage, "result_cmyk.jpg"); ///No image output
/*
* tidy up
*/
if (srcImageC) srcImageC = DestroyMagickWand(srcImageC);
if (srcImageM) srcImageM = DestroyMagickWand(srcImageM);
if (srcImageY) srcImageY = DestroyMagickWand(srcImageY);
if (srcImageK) srcImageK = DestroyMagickWand(srcImageK);
if (destImage) destImage = DestroyMagickWand(destImage);
MagickWandTerminus();
.
.
Sorry about that, Maybe my composite concept is incorrect.
Thanks for ImageMagick provides useful image processing tool.
Thanks alot.
Diuming
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: About API description!!
You can NOT store multiple files into a JPG file. The File format simply does not allow for it!diuming wrote:For example, I try to compose 4 channel image (c.jpg, m.jpg, y.jpg, k.jpg) into signal file (result_cmyk.jpg), But I still not success.
As such it will automatically save the image into seperate files with a number which starts with zero.
See IM Examples, File Handling, Writing a Multi-Image Sequence - Adjoin Techniques
http://www.imagemagick.org/Usage/files/#adjoin
However it appears by the code you are not wanting that, but want ot combine the images.
Lokking in the source for "wand/mogrify.c" (for command line API) I find that "combine" option calles the MagickCore library function
Code: Select all
image = CombineImages(*images,channel,exception)
as such the function is defined in "magick/image.c"
Its documentation can thus be found in the MagickCore "Image Methods"
http://www.imagemagick.org/api/image.php#CombineImages
However creating a CMYK image (or any other non-RGB colorspace image) from RGB greyscale images requires you to first set the greyscale images to the right colorspace (the "image->type" structure element in the "Image" structure, just as you would when performing the same operation from the command line API.
That is as shown in -- Combining non-RGB image channels
http://www.imagemagick.org/Usage/channe ... bine_other
The exact code I can not give you, without doing EVERYTHING. But the method and order is the same as for the command line API, and the coding sequence is clear.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: About API description!!
I got it. thanks!
Diuming
Diuming