PageRenderTime 61ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 1ms

/MagickWand/magick-property.c

https://gitlab.com/ImageMagick/ImageMagick
C | 3051 lines | 1101 code | 107 blank | 1843 comment | 371 complexity | dec5cf4ccd3ce1e53af31db1f6a53539 MD5 | raw file
Possible License(s): MPL-2.0-no-copyleft-exception
  1. /*
  2. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  3. % %
  4. % %
  5. % %
  6. % M M AAA GGGG IIIII CCCC K K %
  7. % MM MM A A G I C K K %
  8. % M M M AAAAA G GGG I C KKK %
  9. % M M A A G G I C K K %
  10. % M M A A GGGG IIIII CCCC K K %
  11. % %
  12. % PPPP RRRR OOO PPPP EEEEE RRRR TTTTT Y Y %
  13. % P P R R O O P P E R R T Y Y %
  14. % PPPP RRRR O O PPPP EEE RRRR T Y %
  15. % P R R O O P E R R T Y %
  16. % P R R OOO P EEEEE R R T Y %
  17. % %
  18. % %
  19. % Set or Get MagickWand Properties, Options, or Profiles %
  20. % %
  21. % Software Design %
  22. % Cristy %
  23. % August 2003 %
  24. % %
  25. % %
  26. % Copyright 1999-2019 ImageMagick Studio LLC, a non-profit organization %
  27. % dedicated to making software imaging solutions freely available. %
  28. % %
  29. % You may not use this file except in compliance with the License. You may %
  30. % obtain a copy of the License at %
  31. % %
  32. % https://imagemagick.org/script/license.php %
  33. % %
  34. % Unless required by applicable law or agreed to in writing, software %
  35. % distributed under the License is distributed on an "AS IS" BASIS, %
  36. % WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. %
  37. % See the License for the specific language governing permissions and %
  38. % limitations under the License. %
  39. % %
  40. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  41. %
  42. %
  43. %
  44. */
  45. /*
  46. Include declarations.
  47. */
  48. #include "MagickWand/studio.h"
  49. #include "MagickWand/MagickWand.h"
  50. #include "MagickWand/magick-wand-private.h"
  51. #include "MagickWand/wand.h"
  52. #include "MagickCore/string-private.h"
  53. /*
  54. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  55. % %
  56. % %
  57. % %
  58. % M a g i c k D e l e t e I m a g e A r t i f a c t %
  59. % %
  60. % %
  61. % %
  62. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  63. %
  64. % MagickDeleteImageArtifact() deletes a wand artifact.
  65. %
  66. % The format of the MagickDeleteImageArtifact method is:
  67. %
  68. % MagickBooleanType MagickDeleteImageArtifact(MagickWand *wand,
  69. % const char *artifact)
  70. %
  71. % A description of each parameter follows:
  72. %
  73. % o image: the image.
  74. %
  75. % o artifact: the image artifact.
  76. %
  77. */
  78. WandExport MagickBooleanType MagickDeleteImageArtifact(MagickWand *wand,
  79. const char *artifact)
  80. {
  81. assert(wand != (MagickWand *) NULL);
  82. assert(wand->signature == MagickWandSignature);
  83. if (wand->debug != MagickFalse)
  84. (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
  85. if (wand->images == (Image *) NULL)
  86. {
  87. (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
  88. "ContainsNoImages","`%s'",wand->name);
  89. return(MagickFalse);
  90. }
  91. return(DeleteImageArtifact(wand->images,artifact));
  92. }
  93. /*
  94. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  95. % %
  96. % %
  97. % %
  98. % M a g i c k D e l e t e I m a g e P r o p e r t y %
  99. % %
  100. % %
  101. % %
  102. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  103. %
  104. % MagickDeleteImageProperty() deletes a wand property.
  105. %
  106. % The format of the MagickDeleteImageProperty method is:
  107. %
  108. % MagickBooleanType MagickDeleteImageProperty(MagickWand *wand,
  109. % const char *property)
  110. %
  111. % A description of each parameter follows:
  112. %
  113. % o image: the image.
  114. %
  115. % o property: the image property.
  116. %
  117. */
  118. WandExport MagickBooleanType MagickDeleteImageProperty(MagickWand *wand,
  119. const char *property)
  120. {
  121. assert(wand != (MagickWand *) NULL);
  122. assert(wand->signature == MagickWandSignature);
  123. if (wand->debug != MagickFalse)
  124. (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
  125. if (wand->images == (Image *) NULL)
  126. {
  127. (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
  128. "ContainsNoImages","`%s'",wand->name);
  129. return(MagickFalse);
  130. }
  131. return(DeleteImageProperty(wand->images,property));
  132. }
  133. /*
  134. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  135. % %
  136. % %
  137. % %
  138. % M a g i c k D e l e t e O p t i o n %
  139. % %
  140. % %
  141. % %
  142. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  143. %
  144. % MagickDeleteOption() deletes a wand option.
  145. %
  146. % The format of the MagickDeleteOption method is:
  147. %
  148. % MagickBooleanType MagickDeleteOption(MagickWand *wand,
  149. % const char *option)
  150. %
  151. % A description of each parameter follows:
  152. %
  153. % o image: the image.
  154. %
  155. % o option: the image option.
  156. %
  157. */
  158. WandExport MagickBooleanType MagickDeleteOption(MagickWand *wand,
  159. const char *option)
  160. {
  161. assert(wand != (MagickWand *) NULL);
  162. assert(wand->signature == MagickWandSignature);
  163. if (wand->debug != MagickFalse)
  164. (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
  165. return(DeleteImageOption(wand->image_info,option));
  166. }
  167. /*
  168. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  169. % %
  170. % %
  171. % %
  172. % M a g i c k G e t A n t i a l i a s %
  173. % %
  174. % %
  175. % %
  176. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  177. %
  178. % MagickGetAntialias() returns the antialias property associated with the
  179. % wand.
  180. %
  181. % The format of the MagickGetAntialias method is:
  182. %
  183. % MagickBooleanType MagickGetAntialias(const MagickWand *wand)
  184. %
  185. % A description of each parameter follows:
  186. %
  187. % o wand: the magick wand.
  188. %
  189. */
  190. WandExport MagickBooleanType MagickGetAntialias(const MagickWand *wand)
  191. {
  192. assert(wand != (const MagickWand *) NULL);
  193. assert(wand->signature == MagickWandSignature);
  194. if (wand->debug != MagickFalse)
  195. (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
  196. return(wand->image_info->antialias);
  197. }
  198. /*
  199. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  200. % %
  201. % %
  202. % %
  203. % M a g i c k G e t B a c k g r o u n d C o l o r %
  204. % %
  205. % %
  206. % %
  207. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  208. %
  209. % MagickGetBackgroundColor() returns the wand background color.
  210. %
  211. % The format of the MagickGetBackgroundColor method is:
  212. %
  213. % PixelWand *MagickGetBackgroundColor(MagickWand *wand)
  214. %
  215. % A description of each parameter follows:
  216. %
  217. % o wand: the magick wand.
  218. %
  219. */
  220. WandExport PixelWand *MagickGetBackgroundColor(MagickWand *wand)
  221. {
  222. PixelWand
  223. *background_color;
  224. assert(wand != (MagickWand *) NULL);
  225. assert(wand->signature == MagickWandSignature);
  226. if (wand->debug != MagickFalse)
  227. (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
  228. background_color=NewPixelWand();
  229. PixelSetPixelColor(background_color,&wand->image_info->background_color);
  230. return(background_color);
  231. }
  232. /*
  233. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  234. % %
  235. % %
  236. % %
  237. % M a g i c k G e t C o l o r s p a c e %
  238. % %
  239. % %
  240. % %
  241. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  242. %
  243. % MagickGetColorspace() gets the wand colorspace type.
  244. %
  245. % The format of the MagickGetColorspace method is:
  246. %
  247. % ColorspaceType MagickGetColorspace(MagickWand *wand)
  248. %
  249. % A description of each parameter follows:
  250. %
  251. % o wand: the magick wand.
  252. %
  253. */
  254. WandExport ColorspaceType MagickGetColorspace(MagickWand *wand)
  255. {
  256. assert(wand != (MagickWand *) NULL);
  257. assert(wand->signature == MagickWandSignature);
  258. if (wand->debug != MagickFalse)
  259. (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
  260. return(wand->image_info->colorspace);
  261. }
  262. /*
  263. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  264. % %
  265. % %
  266. % %
  267. % M a g i c k G e t C o m p r e s s i o n %
  268. % %
  269. % %
  270. % %
  271. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  272. %
  273. % MagickGetCompression() gets the wand compression type.
  274. %
  275. % The format of the MagickGetCompression method is:
  276. %
  277. % CompressionType MagickGetCompression(MagickWand *wand)
  278. %
  279. % A description of each parameter follows:
  280. %
  281. % o wand: the magick wand.
  282. %
  283. */
  284. WandExport CompressionType MagickGetCompression(MagickWand *wand)
  285. {
  286. assert(wand != (MagickWand *) NULL);
  287. assert(wand->signature == MagickWandSignature);
  288. if (wand->debug != MagickFalse)
  289. (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
  290. return(wand->image_info->compression);
  291. }
  292. /*
  293. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  294. % %
  295. % %
  296. % %
  297. % M a g i c k G e t C o m p r e s s i o n Q u a l i t y %
  298. % %
  299. % %
  300. % %
  301. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  302. %
  303. % MagickGetCompressionQuality() gets the wand compression quality.
  304. %
  305. % The format of the MagickGetCompressionQuality method is:
  306. %
  307. % size_t MagickGetCompressionQuality(MagickWand *wand)
  308. %
  309. % A description of each parameter follows:
  310. %
  311. % o wand: the magick wand.
  312. %
  313. */
  314. WandExport size_t MagickGetCompressionQuality(MagickWand *wand)
  315. {
  316. assert(wand != (MagickWand *) NULL);
  317. assert(wand->signature == MagickWandSignature);
  318. if (wand->debug != MagickFalse)
  319. (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
  320. return(wand->image_info->quality);
  321. }
  322. /*
  323. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  324. % %
  325. % %
  326. % %
  327. % M a g i c k G e t C o p y r i g h t %
  328. % %
  329. % %
  330. % %
  331. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  332. %
  333. % MagickGetCopyright() returns the ImageMagick API copyright as a string
  334. % constant.
  335. %
  336. % The format of the MagickGetCopyright method is:
  337. %
  338. % const char *MagickGetCopyright(void)
  339. %
  340. */
  341. WandExport const char *MagickGetCopyright(void)
  342. {
  343. return(GetMagickCopyright());
  344. }
  345. /*
  346. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  347. % %
  348. % %
  349. % %
  350. % M a g i c k G e t F i l e n a m e %
  351. % %
  352. % %
  353. % %
  354. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  355. %
  356. % MagickGetFilename() returns the filename associated with an image sequence.
  357. %
  358. % The format of the MagickGetFilename method is:
  359. %
  360. % const char *MagickGetFilename(const MagickWand *wand)
  361. %
  362. % A description of each parameter follows:
  363. %
  364. % o wand: the magick wand.
  365. %
  366. */
  367. WandExport char *MagickGetFilename(const MagickWand *wand)
  368. {
  369. assert(wand != (const MagickWand *) NULL);
  370. assert(wand->signature == MagickWandSignature);
  371. if (wand->debug != MagickFalse)
  372. (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
  373. return(AcquireString(wand->image_info->filename));
  374. }
  375. /*
  376. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  377. % %
  378. % %
  379. % %
  380. % M a g i c k G e t F o n t %
  381. % %
  382. % %
  383. % %
  384. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  385. %
  386. % MagickGetFont() returns the font associated with the MagickWand.
  387. %
  388. % The format of the MagickGetFont method is:
  389. %
  390. % char *MagickGetFont(MagickWand *wand)
  391. %
  392. % A description of each parameter follows:
  393. %
  394. % o wand: the magick wand.
  395. %
  396. */
  397. WandExport char *MagickGetFont(MagickWand *wand)
  398. {
  399. assert(wand != (MagickWand *) NULL);
  400. assert(wand->signature == MagickWandSignature);
  401. if (wand->debug != MagickFalse)
  402. (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
  403. if (wand->image_info->font == (char *) NULL)
  404. return((char *) NULL);
  405. return(AcquireString(wand->image_info->font));
  406. }
  407. /*
  408. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  409. % %
  410. % %
  411. % %
  412. % M a g i c k G e t F o r m a t %
  413. % %
  414. % %
  415. % %
  416. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  417. %
  418. % MagickGetFormat() returns the format of the magick wand.
  419. %
  420. % The format of the MagickGetFormat method is:
  421. %
  422. % const char MagickGetFormat(MagickWand *wand)
  423. %
  424. % A description of each parameter follows:
  425. %
  426. % o wand: the magick wand.
  427. %
  428. */
  429. WandExport char *MagickGetFormat(MagickWand *wand)
  430. {
  431. assert(wand != (MagickWand *) NULL);
  432. assert(wand->signature == MagickWandSignature);
  433. if (wand->debug != MagickFalse)
  434. (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
  435. return(AcquireString(wand->image_info->magick));
  436. }
  437. /*
  438. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  439. % %
  440. % %
  441. % %
  442. % M a g i c k G e t G r a v i t y %
  443. % %
  444. % %
  445. % %
  446. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  447. %
  448. % MagickGetGravity() gets the wand gravity.
  449. %
  450. % The format of the MagickGetGravity method is:
  451. %
  452. % GravityType MagickGetGravity(MagickWand *wand)
  453. %
  454. % A description of each parameter follows:
  455. %
  456. % o wand: the magick wand.
  457. %
  458. */
  459. WandExport GravityType MagickGetGravity(MagickWand *wand)
  460. {
  461. const char
  462. *option;
  463. GravityType
  464. type;
  465. assert(wand != (MagickWand *) NULL);
  466. assert(wand->signature == MagickWandSignature);
  467. if (wand->debug != MagickFalse)
  468. (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
  469. option=GetImageOption(wand->image_info,"gravity");
  470. if (option == (const char *) NULL)
  471. return(UndefinedGravity);
  472. type=(GravityType) ParseCommandOption(MagickGravityOptions,MagickFalse,option);
  473. return(type);
  474. }
  475. /*
  476. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  477. % %
  478. % %
  479. % %
  480. % M a g i c k G e t H o m e U R L %
  481. % %
  482. % %
  483. % %
  484. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  485. %
  486. % MagickGetHomeURL() returns the ImageMagick home URL.
  487. %
  488. % The format of the MagickGetHomeURL method is:
  489. %
  490. % char *MagickGetHomeURL(void)
  491. %
  492. */
  493. WandExport char *MagickGetHomeURL(void)
  494. {
  495. return(GetMagickHomeURL());
  496. }
  497. /*
  498. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  499. % %
  500. % %
  501. % %
  502. % M a g i c k G e t I m a g e A r t i f a c t %
  503. % %
  504. % %
  505. % %
  506. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  507. %
  508. % MagickGetImageArtifact() returns a value associated with the specified
  509. % artifact. Use MagickRelinquishMemory() to free the value when you are
  510. % finished with it.
  511. %
  512. % The format of the MagickGetImageArtifact method is:
  513. %
  514. % char *MagickGetImageArtifact(MagickWand *wand,const char *artifact)
  515. %
  516. % A description of each parameter follows:
  517. %
  518. % o wand: the magick wand.
  519. %
  520. % o artifact: the artifact.
  521. %
  522. */
  523. WandExport char *MagickGetImageArtifact(MagickWand *wand,const char *artifact)
  524. {
  525. const char
  526. *value;
  527. assert(wand != (MagickWand *) NULL);
  528. assert(wand->signature == MagickWandSignature);
  529. if (wand->debug != MagickFalse)
  530. (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
  531. if (wand->images == (Image *) NULL)
  532. {
  533. (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
  534. "ContainsNoImages","`%s'",wand->name);
  535. return((char *) NULL);
  536. }
  537. value=GetImageArtifact(wand->images,artifact);
  538. if (value == (const char *) NULL)
  539. return((char *) NULL);
  540. return(ConstantString(value));
  541. }
  542. /*
  543. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  544. % %
  545. % %
  546. % %
  547. % M a g i c k G e t I m a g e P r o p e r t i e s %
  548. % %
  549. % %
  550. % %
  551. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  552. %
  553. % MagickGetImageArtifacts() returns all the artifact names that match the
  554. % specified pattern associated with a wand. Use MagickGetImageProperty() to
  555. % return the value of a particular artifact. Use MagickRelinquishMemory() to
  556. % free the value when you are finished with it.
  557. %
  558. % The format of the MagickGetImageArtifacts method is:
  559. %
  560. % char *MagickGetImageArtifacts(MagickWand *wand,
  561. % const char *pattern,size_t *number_artifacts)
  562. %
  563. % A description of each parameter follows:
  564. %
  565. % o wand: the magick wand.
  566. %
  567. % o pattern: Specifies a pointer to a text string containing a pattern.
  568. %
  569. % o number_artifacts: the number artifacts associated with this wand.
  570. %
  571. */
  572. WandExport char **MagickGetImageArtifacts(MagickWand *wand,
  573. const char *pattern,size_t *number_artifacts)
  574. {
  575. char
  576. **artifacts;
  577. const char
  578. *artifact;
  579. register ssize_t
  580. i;
  581. size_t
  582. length;
  583. assert(wand != (MagickWand *) NULL);
  584. assert(wand->signature == MagickWandSignature);
  585. if (wand->debug != MagickFalse)
  586. (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
  587. if (wand->images == (Image *) NULL)
  588. {
  589. (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
  590. "ContainsNoImages","`%s'",wand->name);
  591. return((char **) NULL);
  592. }
  593. (void) GetImageProperty(wand->images,"exif:*",wand->exception);
  594. length=1024;
  595. artifacts=(char **) AcquireQuantumMemory(length,sizeof(*artifacts));
  596. if (artifacts == (char **) NULL)
  597. return((char **) NULL);
  598. ResetImagePropertyIterator(wand->images);
  599. artifact=GetNextImageProperty(wand->images);
  600. for (i=0; artifact != (const char *) NULL; )
  601. {
  602. if ((*artifact != '[') &&
  603. (GlobExpression(artifact,pattern,MagickFalse) != MagickFalse))
  604. {
  605. if ((i+1) >= (ssize_t) length)
  606. {
  607. length<<=1;
  608. artifacts=(char **) ResizeQuantumMemory(artifacts,length,
  609. sizeof(*artifacts));
  610. if (artifacts == (char **) NULL)
  611. {
  612. (void) ThrowMagickException(wand->exception,GetMagickModule(),
  613. ResourceLimitError,"MemoryAllocationFailed","`%s'",
  614. wand->name);
  615. return((char **) NULL);
  616. }
  617. }
  618. artifacts[i]=ConstantString(artifact);
  619. i++;
  620. }
  621. artifact=GetNextImageProperty(wand->images);
  622. }
  623. artifacts[i]=(char *) NULL;
  624. *number_artifacts=(size_t) i;
  625. return(artifacts);
  626. }
  627. /*
  628. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  629. % %
  630. % %
  631. % %
  632. % M a g i c k G e t I m a g e P r o f i l e %
  633. % %
  634. % %
  635. % %
  636. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  637. %
  638. % MagickGetImageProfile() returns the named image profile.
  639. %
  640. % The format of the MagickGetImageProfile method is:
  641. %
  642. % unsigned char *MagickGetImageProfile(MagickWand *wand,const char *name,
  643. % size_t *length)
  644. %
  645. % A description of each parameter follows:
  646. %
  647. % o wand: the magick wand.
  648. %
  649. % o name: Name of profile to return: ICC, IPTC, or generic profile.
  650. %
  651. % o length: the length of the profile.
  652. %
  653. */
  654. WandExport unsigned char *MagickGetImageProfile(MagickWand *wand,
  655. const char *name,size_t *length)
  656. {
  657. const StringInfo
  658. *profile;
  659. unsigned char
  660. *datum;
  661. assert(wand != (MagickWand *) NULL);
  662. assert(wand->signature == MagickWandSignature);
  663. if (wand->debug != MagickFalse)
  664. (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
  665. if (wand->images == (Image *) NULL)
  666. {
  667. (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
  668. "ContainsNoImages","`%s'",wand->name);
  669. return((unsigned char *) NULL);
  670. }
  671. *length=0;
  672. if (wand->images->profiles == (SplayTreeInfo *) NULL)
  673. return((unsigned char *) NULL);
  674. profile=GetImageProfile(wand->images,name);
  675. if (profile == (StringInfo *) NULL)
  676. return((unsigned char *) NULL);
  677. datum=(unsigned char *) AcquireQuantumMemory(GetStringInfoLength(profile),
  678. sizeof(*datum));
  679. if (datum == (unsigned char *) NULL)
  680. return((unsigned char *) NULL);
  681. (void) memcpy(datum,GetStringInfoDatum(profile),
  682. GetStringInfoLength(profile));
  683. *length=(size_t) GetStringInfoLength(profile);
  684. return(datum);
  685. }
  686. /*
  687. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  688. % %
  689. % %
  690. % %
  691. % M a g i c k G e t I m a g e P r o f i l e s %
  692. % %
  693. % %
  694. % %
  695. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  696. %
  697. % MagickGetImageProfiles() returns all the profile names that match the
  698. % specified pattern associated with a wand. Use MagickGetImageProfile() to
  699. % return the value of a particular property. Use MagickRelinquishMemory() to
  700. % free the value when you are finished with it.
  701. %
  702. % The format of the MagickGetImageProfiles method is:
  703. %
  704. % char *MagickGetImageProfiles(MagickWand *wand,const char *pattern,
  705. % size_t *number_profiles)
  706. %
  707. % A description of each parameter follows:
  708. %
  709. % o wand: the magick wand.
  710. %
  711. % o pattern: Specifies a pointer to a text string containing a pattern.
  712. %
  713. % o number_profiles: the number profiles associated with this wand.
  714. %
  715. */
  716. WandExport char **MagickGetImageProfiles(MagickWand *wand,const char *pattern,
  717. size_t *number_profiles)
  718. {
  719. char
  720. **profiles;
  721. const char
  722. *property;
  723. register ssize_t
  724. i;
  725. size_t
  726. length;
  727. assert(wand != (MagickWand *) NULL);
  728. assert(wand->signature == MagickWandSignature);
  729. if (wand->debug != MagickFalse)
  730. (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
  731. if (wand->images == (Image *) NULL)
  732. {
  733. (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
  734. "ContainsNoImages","`%s'",wand->name);
  735. return((char **) NULL);
  736. }
  737. (void) GetImageProfile(wand->images,"exif:*");
  738. length=1024;
  739. profiles=(char **) AcquireQuantumMemory(length,sizeof(*profiles));
  740. if (profiles == (char **) NULL)
  741. return((char **) NULL);
  742. ResetImageProfileIterator(wand->images);
  743. property=GetNextImageProfile(wand->images);
  744. for (i=0; property != (const char *) NULL; )
  745. {
  746. if ((*property != '[') &&
  747. (GlobExpression(property,pattern,MagickFalse) != MagickFalse))
  748. {
  749. if ((i+1) >= (ssize_t) length)
  750. {
  751. length<<=1;
  752. profiles=(char **) ResizeQuantumMemory(profiles,length,
  753. sizeof(*profiles));
  754. if (profiles == (char **) NULL)
  755. {
  756. (void) ThrowMagickException(wand->exception,GetMagickModule(),
  757. ResourceLimitError,"MemoryAllocationFailed","`%s'",
  758. wand->name);
  759. return((char **) NULL);
  760. }
  761. }
  762. profiles[i]=ConstantString(property);
  763. i++;
  764. }
  765. property=GetNextImageProfile(wand->images);
  766. }
  767. profiles[i]=(char *) NULL;
  768. *number_profiles=(size_t) i;
  769. return(profiles);
  770. }
  771. /*
  772. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  773. % %
  774. % %
  775. % %
  776. % M a g i c k G e t I m a g e P r o p e r t y %
  777. % %
  778. % %
  779. % %
  780. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  781. %
  782. % MagickGetImageProperty() returns a value associated with the specified
  783. % property. Use MagickRelinquishMemory() to free the value when you are
  784. % finished with it.
  785. %
  786. % The format of the MagickGetImageProperty method is:
  787. %
  788. % char *MagickGetImageProperty(MagickWand *wand,const char *property)
  789. %
  790. % A description of each parameter follows:
  791. %
  792. % o wand: the magick wand.
  793. %
  794. % o property: the property.
  795. %
  796. */
  797. WandExport char *MagickGetImageProperty(MagickWand *wand,const char *property)
  798. {
  799. const char
  800. *value;
  801. assert(wand != (MagickWand *) NULL);
  802. assert(wand->signature == MagickWandSignature);
  803. if (wand->debug != MagickFalse)
  804. (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
  805. if (wand->images == (Image *) NULL)
  806. {
  807. (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
  808. "ContainsNoImages","`%s'",wand->name);
  809. return((char *) NULL);
  810. }
  811. value=GetImageProperty(wand->images,property,wand->exception);
  812. if (value == (const char *) NULL)
  813. return((char *) NULL);
  814. return(ConstantString(value));
  815. }
  816. /*
  817. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  818. % %
  819. % %
  820. % %
  821. % M a g i c k G e t I m a g e P r o p e r t i e s %
  822. % %
  823. % %
  824. % %
  825. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  826. %
  827. % MagickGetImageProperties() returns all the property names that match the
  828. % specified pattern associated with a wand. Use MagickGetImageProperty() to
  829. % return the value of a particular property. Use MagickRelinquishMemory() to
  830. % free the value when you are finished with it.
  831. %
  832. % The format of the MagickGetImageProperties method is:
  833. %
  834. % char *MagickGetImageProperties(MagickWand *wand,
  835. % const char *pattern,size_t *number_properties)
  836. %
  837. % A description of each parameter follows:
  838. %
  839. % o wand: the magick wand.
  840. %
  841. % o pattern: Specifies a pointer to a text string containing a pattern.
  842. %
  843. % o number_properties: the number properties associated with this wand.
  844. %
  845. */
  846. WandExport char **MagickGetImageProperties(MagickWand *wand,
  847. const char *pattern,size_t *number_properties)
  848. {
  849. char
  850. **properties;
  851. const char
  852. *property;
  853. register ssize_t
  854. i;
  855. size_t
  856. length;
  857. assert(wand != (MagickWand *) NULL);
  858. assert(wand->signature == MagickWandSignature);
  859. if (wand->debug != MagickFalse)
  860. (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
  861. if (wand->images == (Image *) NULL)
  862. {
  863. (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
  864. "ContainsNoImages","`%s'",wand->name);
  865. return((char **) NULL);
  866. }
  867. (void) GetImageProperty(wand->images,"exif:*",wand->exception);
  868. length=1024;
  869. properties=(char **) AcquireQuantumMemory(length,sizeof(*properties));
  870. if (properties == (char **) NULL)
  871. return((char **) NULL);
  872. ResetImagePropertyIterator(wand->images);
  873. property=GetNextImageProperty(wand->images);
  874. for (i=0; property != (const char *) NULL; )
  875. {
  876. if ((*property != '[') &&
  877. (GlobExpression(property,pattern,MagickFalse) != MagickFalse))
  878. {
  879. if ((i+1) >= (ssize_t) length)
  880. {
  881. length<<=1;
  882. properties=(char **) ResizeQuantumMemory(properties,length,
  883. sizeof(*properties));
  884. if (properties == (char **) NULL)
  885. {
  886. (void) ThrowMagickException(wand->exception,GetMagickModule(),
  887. ResourceLimitError,"MemoryAllocationFailed","`%s'",
  888. wand->name);
  889. return((char **) NULL);
  890. }
  891. }
  892. properties[i]=ConstantString(property);
  893. i++;
  894. }
  895. property=GetNextImageProperty(wand->images);
  896. }
  897. properties[i]=(char *) NULL;
  898. *number_properties=(size_t) i;
  899. return(properties);
  900. }
  901. /*
  902. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  903. % %
  904. % %
  905. % %
  906. % M a g i c k G e t I n t e r l a c e S c h e m e %
  907. % %
  908. % %
  909. % %
  910. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  911. %
  912. % MagickGetInterlaceScheme() gets the wand interlace scheme.
  913. %
  914. % The format of the MagickGetInterlaceScheme method is:
  915. %
  916. % InterlaceType MagickGetInterlaceScheme(MagickWand *wand)
  917. %
  918. % A description of each parameter follows:
  919. %
  920. % o wand: the magick wand.
  921. %
  922. */
  923. WandExport InterlaceType MagickGetInterlaceScheme(MagickWand *wand)
  924. {
  925. assert(wand != (MagickWand *) NULL);
  926. assert(wand->signature == MagickWandSignature);
  927. if (wand->debug != MagickFalse)
  928. (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
  929. return(wand->image_info->interlace);
  930. }
  931. /*
  932. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  933. % %
  934. % %
  935. % %
  936. % M a g i c k G e t I n t e r p o l a t e M e t h o d %
  937. % %
  938. % %
  939. % %
  940. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  941. %
  942. % MagickGetInterpolateMethod() gets the wand compression.
  943. %
  944. % The format of the MagickGetInterpolateMethod method is:
  945. %
  946. % PixelInterpolateMethod MagickGetInterpolateMethod(MagickWand *wand)
  947. %
  948. % A description of each parameter follows:
  949. %
  950. % o wand: the magick wand.
  951. %
  952. */
  953. WandExport PixelInterpolateMethod MagickGetInterpolateMethod(MagickWand *wand)
  954. {
  955. const char
  956. *option;
  957. PixelInterpolateMethod
  958. method;
  959. assert(wand != (MagickWand *) NULL);
  960. assert(wand->signature == MagickWandSignature);
  961. if (wand->debug != MagickFalse)
  962. (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
  963. option=GetImageOption(wand->image_info,"interpolate");
  964. if (option == (const char *) NULL)
  965. return(UndefinedInterpolatePixel);
  966. method=(PixelInterpolateMethod) ParseCommandOption(MagickInterpolateOptions,
  967. MagickFalse,option);
  968. return(method);
  969. }
  970. /*
  971. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  972. % %
  973. % %
  974. % %
  975. % M a g i c k G e t O p t i o n %
  976. % %
  977. % %
  978. % %
  979. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  980. %
  981. % MagickGetOption() returns a value associated with a wand and the specified
  982. % key. Use MagickRelinquishMemory() to free the value when you are finished
  983. % with it.
  984. %
  985. % The format of the MagickGetOption method is:
  986. %
  987. % char *MagickGetOption(MagickWand *wand,const char *key)
  988. %
  989. % A description of each parameter follows:
  990. %
  991. % o wand: the magick wand.
  992. %
  993. % o key: the key.
  994. %
  995. */
  996. WandExport char *MagickGetOption(MagickWand *wand,const char *key)
  997. {
  998. const char
  999. *option;
  1000. assert(wand != (MagickWand *) NULL);
  1001. assert(wand->signature == MagickWandSignature);
  1002. if (wand->debug != MagickFalse)
  1003. (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
  1004. option=GetImageOption(wand->image_info,key);
  1005. return(ConstantString(option));
  1006. }
  1007. /*
  1008. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1009. % %
  1010. % %
  1011. % %
  1012. % M a g i c k G e t O p t i o n s %
  1013. % %
  1014. % %
  1015. % %
  1016. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1017. %
  1018. % MagickGetOptions() returns all the option names that match the specified
  1019. % pattern associated with a wand. Use MagickGetOption() to return the value
  1020. % of a particular option. Use MagickRelinquishMemory() to free the value
  1021. % when you are finished with it.
  1022. %
  1023. % The format of the MagickGetOptions method is:
  1024. %
  1025. % char *MagickGetOptions(MagickWand *wand,const char *pattern,
  1026. % size_t *number_options)
  1027. %
  1028. % A description of each parameter follows:
  1029. %
  1030. % o wand: the magick wand.
  1031. %
  1032. % o pattern: Specifies a pointer to a text string containing a pattern.
  1033. %
  1034. % o number_options: the number options associated with this wand.
  1035. %
  1036. */
  1037. WandExport char **MagickGetOptions(MagickWand *wand,const char *pattern,
  1038. size_t *number_options)
  1039. {
  1040. char
  1041. **options;
  1042. const char
  1043. *option;
  1044. register ssize_t
  1045. i;
  1046. size_t
  1047. length;
  1048. assert(wand != (MagickWand *) NULL);
  1049. assert(wand->signature == MagickWandSignature);
  1050. if (wand->debug != MagickFalse)
  1051. (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
  1052. if (wand->images == (Image *) NULL)
  1053. {
  1054. (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
  1055. "ContainsNoImages","`%s'",wand->name);
  1056. return((char **) NULL);
  1057. }
  1058. length=1024;
  1059. options=(char **) AcquireQuantumMemory(length,sizeof(*options));
  1060. if (options == (char **) NULL)
  1061. return((char **) NULL);
  1062. ResetImageOptionIterator(wand->image_info);
  1063. option=GetNextImageOption(wand->image_info);
  1064. for (i=0; option != (const char *) NULL; )
  1065. {
  1066. if ((*option != '[') &&
  1067. (GlobExpression(option,pattern,MagickFalse) != MagickFalse))
  1068. {
  1069. if ((i+1) >= (ssize_t) length)
  1070. {
  1071. length<<=1;
  1072. options=(char **) ResizeQuantumMemory(options,length,
  1073. sizeof(*options));
  1074. if (options == (char **) NULL)
  1075. {
  1076. (void) ThrowMagickException(wand->exception,GetMagickModule(),
  1077. ResourceLimitError,"MemoryAllocationFailed","`%s'",
  1078. wand->name);
  1079. return((char **) NULL);
  1080. }
  1081. }
  1082. options[i]=ConstantString(option);
  1083. i++;
  1084. }
  1085. option=GetNextImageOption(wand->image_info);
  1086. }
  1087. options[i]=(char *) NULL;
  1088. *number_options=(size_t) i;
  1089. return(options);
  1090. }
  1091. /*
  1092. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1093. % %
  1094. % %
  1095. % %
  1096. % M a g i c k G e t O r i e n t a t i o n %
  1097. % %
  1098. % %
  1099. % %
  1100. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1101. %
  1102. % MagickGetOrientation() gets the wand orientation type.
  1103. %
  1104. % The format of the MagickGetOrientation method is:
  1105. %
  1106. % OrientationType MagickGetOrientation(MagickWand *wand)
  1107. %
  1108. % A description of each parameter follows:
  1109. %
  1110. % o wand: the magick wand.
  1111. %
  1112. */
  1113. WandExport OrientationType MagickGetOrientation(MagickWand *wand)
  1114. {
  1115. assert(wand != (MagickWand *) NULL);
  1116. assert(wand->signature == MagickWandSignature);
  1117. if (wand->debug != MagickFalse)
  1118. (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
  1119. return(wand->image_info->orientation);
  1120. }
  1121. /*
  1122. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1123. % %
  1124. % %
  1125. % %
  1126. % M a g i c k G e t P a c k a g e N a m e %
  1127. % %
  1128. % %
  1129. % %
  1130. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1131. %
  1132. % MagickGetPackageName() returns the ImageMagick package name as a string
  1133. % constant.
  1134. %
  1135. % The format of the MagickGetPackageName method is:
  1136. %
  1137. % const char *MagickGetPackageName(void)
  1138. %
  1139. %
  1140. */
  1141. WandExport const char *MagickGetPackageName(void)
  1142. {
  1143. return(GetMagickPackageName());
  1144. }
  1145. /*
  1146. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1147. % %
  1148. % %
  1149. % %
  1150. % M a g i c k G e t P a g e %
  1151. % %
  1152. % %
  1153. % %
  1154. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1155. %
  1156. % MagickGetPage() returns the page geometry associated with the magick wand.
  1157. %
  1158. % The format of the MagickGetPage method is:
  1159. %
  1160. % MagickBooleanType MagickGetPage(const MagickWand *wand,
  1161. % size_t *width,size_t *height,ssize_t *x,ssize_t *y)
  1162. %
  1163. % A description of each parameter follows:
  1164. %
  1165. % o wand: the magick wand.
  1166. %
  1167. % o width: the page width.
  1168. %
  1169. % o height: page height.
  1170. %
  1171. % o x: the page x-offset.
  1172. %
  1173. % o y: the page y-offset.
  1174. %
  1175. */
  1176. WandExport MagickBooleanType MagickGetPage(const MagickWand *wand,
  1177. size_t *width,size_t *height,ssize_t *x,ssize_t *y)
  1178. {
  1179. RectangleInfo
  1180. geometry;
  1181. assert(wand != (const MagickWand *) NULL);
  1182. assert(wand->signature == MagickWandSignature);
  1183. if (wand->debug != MagickFalse)
  1184. (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
  1185. (void) memset(&geometry,0,sizeof(geometry));
  1186. (void) ParseAbsoluteGeometry(wand->image_info->page,&geometry);
  1187. *width=geometry.width;
  1188. *height=geometry.height;
  1189. *x=geometry.x;
  1190. *y=geometry.y;
  1191. return(MagickTrue);
  1192. }
  1193. /*
  1194. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1195. % %
  1196. % %
  1197. % %
  1198. % M a g i c k G e t P o i n t s i z e %
  1199. % %
  1200. % %
  1201. % %
  1202. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1203. %
  1204. % MagickGetPointsize() returns the font pointsize associated with the
  1205. % MagickWand.
  1206. %
  1207. % The format of the MagickGetPointsize method is:
  1208. %
  1209. % double MagickGetPointsize(MagickWand *wand)
  1210. %
  1211. % A description of each parameter follows:
  1212. %
  1213. % o wand: the magick wand.
  1214. %
  1215. */
  1216. WandExport double MagickGetPointsize(MagickWand *wand)
  1217. {
  1218. assert(wand != (MagickWand *) NULL);
  1219. assert(wand->signature == MagickWandSignature);
  1220. if (wand->debug != MagickFalse)
  1221. (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
  1222. return(wand->image_info->pointsize);
  1223. }
  1224. /*
  1225. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1226. % %
  1227. % %
  1228. % %
  1229. % M a g i c k G e t Q u a n t u m D e p t h %
  1230. % %
  1231. % %
  1232. % %
  1233. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1234. %
  1235. % MagickGetQuantumDepth() returns the ImageMagick quantum depth as a string
  1236. % constant.
  1237. %
  1238. % The format of the MagickGetQuantumDepth method is:
  1239. %
  1240. % const char *MagickGetQuantumDepth(size_t *depth)
  1241. %
  1242. % A description of each parameter follows:
  1243. %
  1244. % o depth: the quantum depth is returned as a number.
  1245. %
  1246. */
  1247. WandExport const char *MagickGetQuantumDepth(size_t *depth)
  1248. {
  1249. return(GetMagickQuantumDepth(depth));
  1250. }
  1251. /*
  1252. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1253. % %
  1254. % %
  1255. % %
  1256. % M a g i c k G e t Q u a n t u m R a n g e %
  1257. % %
  1258. % %
  1259. % %
  1260. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1261. %
  1262. % MagickGetQuantumRange() returns the ImageMagick quantum range as a string
  1263. % constant.
  1264. %
  1265. % The format of the MagickGetQuantumRange method is:
  1266. %
  1267. % const char *MagickGetQuantumRange(size_t *range)
  1268. %
  1269. % A description of each parameter follows:
  1270. %
  1271. % o range: the quantum range is returned as a number.
  1272. %
  1273. */
  1274. WandExport const char *MagickGetQuantumRange(size_t *range)
  1275. {
  1276. return(GetMagickQuantumRange(range));
  1277. }
  1278. /*
  1279. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1280. % %
  1281. % %
  1282. % %
  1283. % M a g i c k G e t R e l e a s e D a t e %
  1284. % %
  1285. % %
  1286. % %
  1287. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1288. %
  1289. % MagickGetReleaseDate() returns the ImageMagick release date as a string
  1290. % constant.
  1291. %
  1292. % The format of the MagickGetReleaseDate method is:
  1293. %
  1294. % const char *MagickGetReleaseDate(void)
  1295. %
  1296. */
  1297. WandExport const char *MagickGetReleaseDate(void)
  1298. {
  1299. return(GetMagickReleaseDate());
  1300. }
  1301. /*
  1302. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1303. % %
  1304. % %
  1305. % %
  1306. % M a g i c k G e t R e s o l u t i o n %
  1307. % %
  1308. % %
  1309. % %
  1310. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1311. %
  1312. % MagickGetResolution() gets the image X and Y resolution.
  1313. %
  1314. % The format of the MagickGetResolution method is:
  1315. %
  1316. % MagickBooleanType MagickGetResolution(const MagickWand *wand,double *x,
  1317. % double *y)
  1318. %
  1319. % A description of each parameter follows:
  1320. %
  1321. % o wand: the magick wand.
  1322. %
  1323. % o x: the x-resolution.
  1324. %
  1325. % o y: the y-resolution.
  1326. %
  1327. */
  1328. WandExport MagickBooleanType MagickGetResolution(const MagickWand *wand,
  1329. double *x,double *y)
  1330. {
  1331. assert(wand != (MagickWand *) NULL);
  1332. assert(wand->signature == MagickWandSignature);
  1333. if (wand->debug != MagickFalse)
  1334. (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
  1335. *x=72.0;
  1336. *y=72.0;
  1337. if (wand->image_info->density != (char *) NULL)
  1338. {
  1339. GeometryInfo
  1340. geometry_info;
  1341. MagickStatusType
  1342. flags;
  1343. flags=ParseGeometry(wand->image_info->density,&geometry_info);
  1344. *x=geometry_info.rho;
  1345. *y=geometry_info.sigma;
  1346. if ((flags & SigmaValue) == 0)
  1347. *y=(*x);
  1348. }
  1349. return(MagickTrue);
  1350. }
  1351. /*
  1352. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1353. % %
  1354. % %
  1355. % %
  1356. % M a g i c k G e t R e s o u r c e %
  1357. % %
  1358. % %
  1359. % %
  1360. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1361. %
  1362. % MagickGetResource() returns the specified resource in megabytes.
  1363. %
  1364. % The format of the MagickGetResource method is:
  1365. %
  1366. % MagickSizeType MagickGetResource(const ResourceType type)
  1367. %
  1368. % A description of each parameter follows:
  1369. %
  1370. % o wand: the magick wand.
  1371. %
  1372. */
  1373. WandExport MagickSizeType MagickGetResource(const ResourceType type)
  1374. {
  1375. return(GetMagickResource(type));
  1376. }
  1377. /*
  1378. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1379. % %
  1380. % %
  1381. % %
  1382. % M a g i c k G e t R e s o u r c e L i m i t %
  1383. % %
  1384. % %
  1385. % %
  1386. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1387. %
  1388. % MagickGetResourceLimit() returns the specified resource limit in megabytes.
  1389. %
  1390. % The format of the MagickGetResourceLimit method is:
  1391. %
  1392. % MagickSizeType MagickGetResourceLimit(const ResourceType type)
  1393. %
  1394. % A description of each parameter follows:
  1395. %
  1396. % o wand: the magick wand.
  1397. %
  1398. */
  1399. WandExport MagickSizeType MagickGetResourceLimit(const ResourceType type)
  1400. {
  1401. return(GetMagickResourceLimit(type));
  1402. }
  1403. /*
  1404. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1405. % %
  1406. % %
  1407. % %
  1408. % M a g i c k G e t S a m p l i n g F a c t o r s %
  1409. % %
  1410. % %
  1411. % %
  1412. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1413. %
  1414. % MagickGetSamplingFactors() gets the horizontal and vertical sampling factor.
  1415. %
  1416. % The format of the MagickGetSamplingFactors method is:
  1417. %
  1418. % double *MagickGetSamplingFactor(MagickWand *wand,
  1419. % size_t *number_factors)
  1420. %
  1421. % A description of each parameter follows:
  1422. %
  1423. % o wand: the magick wand.
  1424. %
  1425. % o number_factors: the number of factors in the returned array.
  1426. %
  1427. */
  1428. WandExport double *MagickGetSamplingFactors(MagickWand *wand,
  1429. size_t *number_factors)
  1430. {
  1431. double
  1432. *sampling_factors;
  1433. register const char
  1434. *p;
  1435. register ssize_t
  1436. i;
  1437. assert(wand != (MagickWand *) NULL);
  1438. assert(wand->signature == MagickWandSignature);
  1439. if (wand->debug != MagickFalse)
  1440. (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
  1441. *number_factors=0;
  1442. sampling_factors=(double *) NULL;
  1443. if (wand->image_info->sampling_factor == (char *) NULL)
  1444. return(sampling_factors);
  1445. i=0;
  1446. for (p=wand->image_info->sampling_factor; p != (char *) NULL; p=strchr(p,','))
  1447. {
  1448. while (((int) *p != 0) && ((isspace((int) ((unsigned char) *p)) != 0) ||
  1449. (*p == ',')))
  1450. p++;
  1451. i++;
  1452. }
  1453. sampling_factors=(double *) AcquireQuantumMemory((size_t) i+1,
  1454. sizeof(*sampling_factors));
  1455. if (sampling_factors == (double *) NULL)
  1456. ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed",
  1457. wand->image_info->filename);
  1458. i=0;
  1459. for (p=wand->image_info->sampling_factor; p != (char *) NULL; p=strchr(p,','))
  1460. {
  1461. while (((int) *p != 0) && ((isspace((int) ((unsigned char) *p)) != 0) ||
  1462. (*p == ',')))
  1463. p++;
  1464. sampling_factors[i]=StringToDouble(p,(char **) NULL);
  1465. i++;
  1466. }
  1467. *number_factors=(size_t) i;
  1468. return(sampling_factors);
  1469. }
  1470. /*
  1471. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1472. % %
  1473. % %
  1474. % %
  1475. % M a g i c k G e t S i z e %
  1476. % %
  1477. % %
  1478. % %
  1479. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1480. %
  1481. % MagickGetSize() returns the size associated with the magick wand.
  1482. %
  1483. % The format of the MagickGetSize method is:
  1484. %
  1485. % MagickBooleanType MagickGetSize(const MagickWand *wand,
  1486. % size_t *columns,size_t *rows)
  1487. %
  1488. % A description of each parameter follows:
  1489. %
  1490. % o wand: the magick wand.
  1491. %
  1492. % o columns: the width in pixels.
  1493. %
  1494. % o height: the height in pixels.
  1495. %
  1496. */
  1497. WandExport MagickBooleanType MagickGetSize(const MagickWand *wand,
  1498. size_t *columns,size_t *rows)
  1499. {
  1500. RectangleInfo
  1501. geometry;
  1502. assert(wand != (const MagickWand *) NULL);
  1503. assert(wand->signature == MagickWandSignature);
  1504. if (wand->debug != MagickFalse)
  1505. (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
  1506. (void) memset(&geometry,0,sizeof(geometry));
  1507. (void) ParseAbsoluteGeometry(wand->image_info->size,&geometry);
  1508. *columns=geometry.width;
  1509. *rows=geometry.height;
  1510. return(MagickTrue);
  1511. }
  1512. /*
  1513. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1514. % %
  1515. % %
  1516. % %
  1517. % M a g i c k G e t S i z e O f f s e t %
  1518. % %
  1519. % %
  1520. % %
  1521. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1522. %
  1523. % MagickGetSizeOffset() returns the size offset associated with the magick
  1524. % wand.
  1525. %
  1526. % The format of the MagickGetSizeOffset method is:
  1527. %
  1528. % MagickBooleanType MagickGetSizeOffset(const MagickWand *wand,
  1529. % ssize_t *offset)
  1530. %
  1531. % A description of each parameter follows:
  1532. %
  1533. % o wand: the magick wand.
  1534. %
  1535. % o offset: the image offset.
  1536. %
  1537. */
  1538. WandExport MagickBooleanType MagickGetSizeOffset(const MagickWand *wand,
  1539. ssize_t *offset)
  1540. {
  1541. RectangleInfo
  1542. geometry;
  1543. assert(wand != (const MagickWand *) NULL);
  1544. assert(wand->signature == MagickWandSignature);
  1545. if (wand->debug != MagickFalse)
  1546. (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
  1547. (void) memset(&geometry,0,sizeof(geometry));
  1548. (void) ParseAbsoluteGeometry(wand->image_info->size,&geometry);
  1549. *offset=geometry.x;
  1550. return(MagickTrue);
  1551. }
  1552. /*
  1553. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1554. % %
  1555. % %
  1556. % %
  1557. % M a g i c k G e t T y p e %
  1558. % %
  1559. % %
  1560. % %
  1561. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1562. %
  1563. % MagickGetType() returns the wand type.
  1564. %
  1565. % The format of the MagickGetType method is:
  1566. %
  1567. % ImageType MagickGetType(MagickWand *wand)
  1568. %
  1569. % A description of each parameter follows:
  1570. %
  1571. % o wand: the magick wand.
  1572. %
  1573. */
  1574. WandExport ImageType MagickGetType(MagickWand *wand)
  1575. {
  1576. assert(wand != (MagickWand *) NULL);
  1577. assert(wand->signature == MagickWandSignature);
  1578. if (wand->debug != MagickFalse)
  1579. (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
  1580. return(wand->image_info->type);
  1581. }
  1582. /*
  1583. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1584. % %
  1585. % %
  1586. % %
  1587. % M a g i c k G e t V e r s i o n %
  1588. % %
  1589. % %
  1590. % %
  1591. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1592. %
  1593. % MagickGetVersion() returns the ImageMagick API version as a string constant
  1594. % and as a number.
  1595. %
  1596. % The format of the MagickGetVersion method is:
  1597. %
  1598. % const char *MagickGetVersion(size_t *version)
  1599. %
  1600. % A description of each parameter follows:
  1601. %
  1602. % o version: the ImageMagick version is returned as a number.
  1603. %
  1604. */
  1605. WandExport const char *MagickGetVersion(size_t *version)
  1606. {
  1607. return(GetMagickVersion(version));
  1608. }
  1609. /*
  1610. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1611. % %
  1612. % %
  1613. % %
  1614. % M a g i c k P r o f i l e I m a g e %
  1615. % %
  1616. % %
  1617. % %
  1618. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1619. %
  1620. % MagickProfileImage() adds or removes a ICC, IPTC, or generic profile
  1621. % from an image. If the profile is NULL, it is removed from the image
  1622. % otherwise added. Use a name of '*' and a profile of NULL to remove all
  1623. % profiles from the image.
  1624. %
  1625. % The format of the MagickProfileImage method is:
  1626. %
  1627. % MagickBooleanType MagickProfileImage(MagickWand *wand,const char *name,
  1628. % const void *profile,const size_t length)
  1629. %
  1630. % A description of each parameter follows:
  1631. %
  1632. % o wand: the magick wand.
  1633. %
  1634. % o name: Name of profile to add or remove: ICC, IPTC, or generic profile.
  1635. %
  1636. % o profile: the profile.
  1637. %
  1638. % o length: the length of the profile.
  1639. %
  1640. */
  1641. WandExport MagickBooleanType MagickProfileImage(MagickWand *wand,
  1642. const char *name,const void *profile,const size_t length)
  1643. {
  1644. assert(wand != (MagickWand *) NULL);
  1645. assert(wand->signature == MagickWandSignature);
  1646. if (wand->debug != MagickFalse)
  1647. (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
  1648. if (wand->images == (Image *) NULL)
  1649. ThrowWandException(WandError,"ContainsNoImages",wand->name);
  1650. return(ProfileImage(wand->images,name,profile,length,wand->exception));
  1651. }
  1652. /*
  1653. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1654. % %
  1655. % %
  1656. % %
  1657. % M a g i c k R e m o v e I m a g e P r o f i l e %
  1658. % %
  1659. % %
  1660. % %
  1661. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1662. %
  1663. % MagickRemoveImageProfile() removes the named image profile and returns it.
  1664. %
  1665. % The format of the MagickRemoveImageProfile method is:
  1666. %
  1667. % unsigned char *MagickRemoveImageProfile(MagickWand *wand,
  1668. % const char *name,size_t *length)
  1669. %
  1670. % A description of each parameter follows:
  1671. %
  1672. % o wand: the magick wand.
  1673. %
  1674. % o name: Name of profile to return: ICC, IPTC, or generic profile.
  1675. %
  1676. % o length: the length of the profile.
  1677. %
  1678. */
  1679. WandExport unsigned char *MagickRemoveImageProfile(MagickWand *wand,
  1680. const char *name,size_t *length)
  1681. {
  1682. StringInfo
  1683. *profile;
  1684. unsigned char
  1685. *datum;
  1686. assert(wand != (MagickWand *) NULL);
  1687. assert(wand->signature == MagickWandSignature);
  1688. if (wand->debug != MagickFalse)
  1689. (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
  1690. if (wand->images == (Image *) NULL)
  1691. {
  1692. (void) ThrowMagickException(wand->exception,GetMagickModule(),WandError,
  1693. "ContainsNoImages","`%s'",wand->name);
  1694. return((unsigned char *) NULL);
  1695. }
  1696. *length=0;
  1697. profile=RemoveImageProfile(wand->images,name);
  1698. if (profile == (StringInfo *) NULL)
  1699. return((unsigned char *) NULL);
  1700. datum=(unsigned char *) AcquireQuantumMemory(GetStringInfoLength(profile),
  1701. sizeof(*datum));
  1702. if (datum == (unsigned char *) NULL)
  1703. return((unsigned char *) NULL);
  1704. (void) memcpy(datum,GetStringInfoDatum(profile),
  1705. GetStringInfoLength(profile));
  1706. *length=GetStringInfoLength(profile);
  1707. profile=DestroyStringInfo(profile);
  1708. return(datum);
  1709. }
  1710. /*
  1711. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1712. % %
  1713. % %
  1714. % %
  1715. % M a g i c k S e t A n t i a l i a s %
  1716. % %
  1717. % %
  1718. % %
  1719. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1720. %
  1721. % MagickSetAntialias() sets the antialias propery of the wand.
  1722. %
  1723. % The format of the MagickSetAntialias method is:
  1724. %
  1725. % MagickBooleanType MagickSetAntialias(MagickWand *wand,
  1726. % const MagickBooleanType antialias)
  1727. %
  1728. % A description of each parameter follows:
  1729. %
  1730. % o wand: the magick wand.
  1731. %
  1732. % o antialias: the antialias property.
  1733. %
  1734. */
  1735. WandExport MagickBooleanType MagickSetAntialias(MagickWand *wand,
  1736. const MagickBooleanType antialias)
  1737. {
  1738. assert(wand != (MagickWand *) NULL);
  1739. assert(wand->signature == MagickWandSignature);
  1740. if (wand->debug != MagickFalse)
  1741. (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
  1742. wand->image_info->antialias=antialias;
  1743. return(MagickTrue);
  1744. }
  1745. /*
  1746. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1747. % %
  1748. % %
  1749. % %
  1750. % M a g i c k S e t B a c k g r o u n d C o l o r %
  1751. % %
  1752. % %
  1753. % %
  1754. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1755. %
  1756. % MagickSetBackgroundColor() sets the wand background color.
  1757. %
  1758. % The format of the MagickSetBackgroundColor method is:
  1759. %
  1760. % MagickBooleanType MagickSetBackgroundColor(MagickWand *wand,
  1761. % const PixelWand *background)
  1762. %
  1763. % A description of each parameter follows:
  1764. %
  1765. % o wand: the magick wand.
  1766. %
  1767. % o background: the background pixel wand.
  1768. %
  1769. */
  1770. WandExport MagickBooleanType MagickSetBackgroundColor(MagickWand *wand,
  1771. const PixelWand *background)
  1772. {
  1773. assert(wand != (MagickWand *) NULL);
  1774. assert(wand->signature == MagickWandSignature);
  1775. if (wand->debug != MagickFalse)
  1776. (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
  1777. PixelGetQuantumPacket(background,&wand->image_info->background_color);
  1778. return(MagickTrue);
  1779. }
  1780. /*
  1781. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1782. % %
  1783. % %
  1784. % %
  1785. % M a g i c k S e t C o l o r s p a c e %
  1786. % %
  1787. % %
  1788. % %
  1789. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1790. %
  1791. % MagickSetColorspace() sets the wand colorspace type.
  1792. %
  1793. % The format of the MagickSetColorspace method is:
  1794. %
  1795. % MagickBooleanType MagickSetColorspace(MagickWand *wand,
  1796. % const ColorspaceType colorspace)
  1797. %
  1798. % A description of each parameter follows:
  1799. %
  1800. % o wand: the magick wand.
  1801. %
  1802. % o colorspace: the wand colorspace.
  1803. %
  1804. */
  1805. WandExport MagickBooleanType MagickSetColorspace(MagickWand *wand,
  1806. const ColorspaceType colorspace)
  1807. {
  1808. assert(wand != (MagickWand *) NULL);
  1809. assert(wand->signature == MagickWandSignature);
  1810. if (wand->debug != MagickFalse)
  1811. (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
  1812. wand->image_info->colorspace=colorspace;
  1813. return(MagickTrue);
  1814. }
  1815. /*
  1816. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1817. % %
  1818. % %
  1819. % %
  1820. % M a g i c k S e t C o m p r e s s i o n %
  1821. % %
  1822. % %
  1823. % %
  1824. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1825. %
  1826. % MagickSetCompression() sets the wand compression type.
  1827. %
  1828. % The format of the MagickSetCompression method is:
  1829. %
  1830. % MagickBooleanType MagickSetCompression(MagickWand *wand,
  1831. % const CompressionType compression)
  1832. %
  1833. % A description of each parameter follows:
  1834. %
  1835. % o wand: the magick wand.
  1836. %
  1837. % o compression: the wand compression.
  1838. %
  1839. */
  1840. WandExport MagickBooleanType MagickSetCompression(MagickWand *wand,
  1841. const CompressionType compression)
  1842. {
  1843. assert(wand != (MagickWand *) NULL);
  1844. assert(wand->signature == MagickWandSignature);
  1845. if (wand->debug != MagickFalse)
  1846. (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
  1847. wand->image_info->compression=compression;
  1848. return(MagickTrue);
  1849. }
  1850. /*
  1851. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1852. % %
  1853. % %
  1854. % %
  1855. % M a g i c k S e t C o m p r e s s i o n Q u a l i t y %
  1856. % %
  1857. % %
  1858. % %
  1859. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1860. %
  1861. % MagickSetCompressionQuality() sets the wand compression quality.
  1862. %
  1863. % The format of the MagickSetCompressionQuality method is:
  1864. %
  1865. % MagickBooleanType MagickSetCompressionQuality(MagickWand *wand,
  1866. % const size_t quality)
  1867. %
  1868. % A description of each parameter follows:
  1869. %
  1870. % o wand: the magick wand.
  1871. %
  1872. % o quality: the wand compression quality.
  1873. %
  1874. */
  1875. WandExport MagickBooleanType MagickSetCompressionQuality(MagickWand *wand,
  1876. const size_t quality)
  1877. {
  1878. assert(wand != (MagickWand *) NULL);
  1879. assert(wand->signature == MagickWandSignature);
  1880. if (wand->debug != MagickFalse)
  1881. (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
  1882. wand->image_info->quality=quality;
  1883. return(MagickTrue);
  1884. }
  1885. /*
  1886. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1887. % %
  1888. % %
  1889. % %
  1890. % M a g i c k S e t D e p t h %
  1891. % %
  1892. % %
  1893. % %
  1894. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1895. %
  1896. % MagickSetDepth() sets the wand pixel depth.
  1897. %
  1898. % The format of the MagickSetDepth method is:
  1899. %
  1900. % MagickBooleanType MagickSetDepth(MagickWand *wand,
  1901. % const size_t depth)
  1902. %
  1903. % A description of each parameter follows:
  1904. %
  1905. % o wand: the magick wand.
  1906. %
  1907. % o depth: the wand pixel depth.
  1908. %
  1909. */
  1910. WandExport MagickBooleanType MagickSetDepth(MagickWand *wand,
  1911. const size_t depth)
  1912. {
  1913. assert(wand != (MagickWand *) NULL);
  1914. assert(wand->signature == MagickWandSignature);
  1915. if (wand->debug != MagickFalse)
  1916. (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
  1917. wand->image_info->depth=depth;
  1918. return(MagickTrue);
  1919. }
  1920. /*
  1921. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1922. % %
  1923. % %
  1924. % %
  1925. % M a g i c k S e t E x t r a c t %
  1926. % %
  1927. % %
  1928. % %
  1929. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1930. %
  1931. % MagickSetExtract() sets the extract geometry before you read or write an
  1932. % image file. Use it for inline cropping (e.g. 200x200+0+0) or resizing
  1933. % (e.g.200x200).
  1934. %
  1935. % The format of the MagickSetExtract method is:
  1936. %
  1937. % MagickBooleanType MagickSetExtract(MagickWand *wand,
  1938. % const char *geometry)
  1939. %
  1940. % A description of each parameter follows:
  1941. %
  1942. % o wand: the magick wand.
  1943. %
  1944. % o geometry: the extract geometry.
  1945. %
  1946. */
  1947. WandExport MagickBooleanType MagickSetExtract(MagickWand *wand,
  1948. const char *geometry)
  1949. {
  1950. assert(wand != (MagickWand *) NULL);
  1951. assert(wand->signature == MagickWandSignature);
  1952. if (wand->debug != MagickFalse)
  1953. (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
  1954. if (wand->image_info->extract != (char *) NULL)
  1955. wand->image_info->extract=DestroyString(wand->image_info->extract);
  1956. if (geometry != (const char *) NULL)
  1957. (void) CloneString(&wand->image_info->extract,geometry);
  1958. return(MagickTrue);
  1959. }
  1960. /*
  1961. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1962. % %
  1963. % %
  1964. % %
  1965. % M a g i c k S e t F i l e n a m e %
  1966. % %
  1967. % %
  1968. % %
  1969. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1970. %
  1971. % MagickSetFilename() sets the filename before you read or write an image file.
  1972. %
  1973. % The format of the MagickSetFilename method is:
  1974. %
  1975. % MagickBooleanType MagickSetFilename(MagickWand *wand,
  1976. % const char *filename)
  1977. %
  1978. % A description of each parameter follows:
  1979. %
  1980. % o wand: the magick wand.
  1981. %
  1982. % o filename: the image filename.
  1983. %
  1984. */
  1985. WandExport MagickBooleanType MagickSetFilename(MagickWand *wand,
  1986. const char *filename)
  1987. {
  1988. assert(wand != (MagickWand *) NULL);
  1989. assert(wand->signature == MagickWandSignature);
  1990. if (wand->debug != MagickFalse)
  1991. (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
  1992. if (filename != (const char *) NULL)
  1993. (void) CopyMagickString(wand->image_info->filename,filename,MagickPathExtent);
  1994. return(MagickTrue);
  1995. }
  1996. /*
  1997. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  1998. % %
  1999. % %
  2000. % %
  2001. % M a g i c k S e t F o n t %
  2002. % %
  2003. % %
  2004. % %
  2005. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2006. %
  2007. % MagickSetFont() sets the font associated with the MagickWand.
  2008. %
  2009. % The format of the MagickSetFont method is:
  2010. %
  2011. % MagickBooleanType MagickSetFont(MagickWand *wand, const char *font)
  2012. %
  2013. % A description of each parameter follows:
  2014. %
  2015. % o wand: the magick wand.
  2016. %
  2017. % o font: the font
  2018. %
  2019. */
  2020. WandExport MagickBooleanType MagickSetFont(MagickWand *wand,const char *font)
  2021. {
  2022. if ((font == (const char *) NULL) || (*font == '\0'))
  2023. return(MagickFalse);
  2024. assert(wand != (MagickWand *) NULL);
  2025. assert(wand->signature == MagickWandSignature);
  2026. if (wand->debug != MagickFalse)
  2027. (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
  2028. (void) CloneString(&wand->image_info->font,font);
  2029. return(MagickTrue);
  2030. }
  2031. /*
  2032. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2033. % %
  2034. % %
  2035. % %
  2036. % M a g i c k S e t F o r m a t %
  2037. % %
  2038. % %
  2039. % %
  2040. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2041. %
  2042. % MagickSetFormat() sets the format of the magick wand.
  2043. %
  2044. % The format of the MagickSetFormat method is:
  2045. %
  2046. % MagickBooleanType MagickSetFormat(MagickWand *wand,const char *format)
  2047. %
  2048. % A description of each parameter follows:
  2049. %
  2050. % o wand: the magick wand.
  2051. %
  2052. % o format: the image format.
  2053. %
  2054. */
  2055. WandExport MagickBooleanType MagickSetFormat(MagickWand *wand,
  2056. const char *format)
  2057. {
  2058. const MagickInfo
  2059. *magick_info;
  2060. assert(wand != (MagickWand *) NULL);
  2061. assert(wand->signature == MagickWandSignature);
  2062. if (wand->debug != MagickFalse)
  2063. (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
  2064. if ((format == (char *) NULL) || (*format == '\0'))
  2065. {
  2066. *wand->image_info->magick='\0';
  2067. return(MagickTrue);
  2068. }
  2069. magick_info=GetMagickInfo(format,wand->exception);
  2070. if (magick_info == (const MagickInfo *) NULL)
  2071. return(MagickFalse);
  2072. ClearMagickException(wand->exception);
  2073. (void) CopyMagickString(wand->image_info->magick,format,MagickPathExtent);
  2074. return(MagickTrue);
  2075. }
  2076. /*
  2077. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2078. % %
  2079. % %
  2080. % %
  2081. % M a g i c k S e t G r a v i t y %
  2082. % %
  2083. % %
  2084. % %
  2085. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2086. %
  2087. % MagickSetGravity() sets the gravity type.
  2088. %
  2089. % The format of the MagickSetGravity type is:
  2090. %
  2091. % MagickBooleanType MagickSetGravity(MagickWand *wand,
  2092. % const GravityType type)
  2093. %
  2094. % A description of each parameter follows:
  2095. %
  2096. % o wand: the magick wand.
  2097. %
  2098. % o type: the gravity type.
  2099. %
  2100. */
  2101. WandExport MagickBooleanType MagickSetGravity(MagickWand *wand,
  2102. const GravityType type)
  2103. {
  2104. MagickBooleanType
  2105. status;
  2106. assert(wand != (MagickWand *) NULL);
  2107. assert(wand->signature == MagickWandSignature);
  2108. if (wand->debug != MagickFalse)
  2109. (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
  2110. status=SetImageOption(wand->image_info,"gravity",CommandOptionToMnemonic(
  2111. MagickGravityOptions,(ssize_t) type));
  2112. return(status);
  2113. }
  2114. /*
  2115. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2116. % %
  2117. % %
  2118. % %
  2119. % M a g i c k S e t I m a g e A r t i f r c t %
  2120. % %
  2121. % %
  2122. % %
  2123. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2124. %
  2125. % MagickSetImageArtifact() associates a artifact with an image.
  2126. %
  2127. % The format of the MagickSetImageArtifact method is:
  2128. %
  2129. % MagickBooleanType MagickSetImageArtifact(MagickWand *wand,
  2130. % const char *artifact,const char *value)
  2131. %
  2132. % A description of each parameter follows:
  2133. %
  2134. % o wand: the magick wand.
  2135. %
  2136. % o artifact: the artifact.
  2137. %
  2138. % o value: the value.
  2139. %
  2140. */
  2141. WandExport MagickBooleanType MagickSetImageArtifact(MagickWand *wand,
  2142. const char *artifact,const char *value)
  2143. {
  2144. assert(wand != (MagickWand *) NULL);
  2145. assert(wand->signature == MagickWandSignature);
  2146. if (wand->debug != MagickFalse)
  2147. (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
  2148. if (wand->images == (Image *) NULL)
  2149. ThrowWandException(WandError,"ContainsNoImages",wand->name);
  2150. return(SetImageArtifact(wand->images,artifact,value));
  2151. }
  2152. /*
  2153. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2154. % %
  2155. % %
  2156. % %
  2157. % M a g i c k S e t P r o f i l e I m a g e %
  2158. % %
  2159. % %
  2160. % %
  2161. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2162. %
  2163. % MagickSetImageProfile() adds a named profile to the magick wand. If a
  2164. % profile with the same name already exists, it is replaced. This method
  2165. % differs from the MagickProfileImage() method in that it does not apply any
  2166. % CMS color profiles.
  2167. %
  2168. % The format of the MagickSetImageProfile method is:
  2169. %
  2170. % MagickBooleanType MagickSetImageProfile(MagickWand *wand,
  2171. % const char *name,const void *profile,const size_t length)
  2172. %
  2173. % A description of each parameter follows:
  2174. %
  2175. % o wand: the magick wand.
  2176. %
  2177. % o name: Name of profile to add or remove: ICC, IPTC, or generic profile.
  2178. %
  2179. % o profile: the profile.
  2180. %
  2181. % o length: the length of the profile.
  2182. %
  2183. */
  2184. WandExport MagickBooleanType MagickSetImageProfile(MagickWand *wand,
  2185. const char *name,const void *profile,const size_t length)
  2186. {
  2187. MagickBooleanType
  2188. status;
  2189. StringInfo
  2190. *profile_info;
  2191. assert(wand != (MagickWand *) NULL);
  2192. assert(wand->signature == MagickWandSignature);
  2193. if (wand->debug != MagickFalse)
  2194. (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
  2195. if (wand->images == (Image *) NULL)
  2196. ThrowWandException(WandError,"ContainsNoImages",wand->name);
  2197. profile_info=AcquireStringInfo((size_t) length);
  2198. SetStringInfoDatum(profile_info,(unsigned char *) profile);
  2199. status=SetImageProfile(wand->images,name,profile_info,wand->exception);
  2200. profile_info=DestroyStringInfo(profile_info);
  2201. return(status);
  2202. }
  2203. /*
  2204. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2205. % %
  2206. % %
  2207. % %
  2208. % M a g i c k S e t I m a g e P r o p e r t y %
  2209. % %
  2210. % %
  2211. % %
  2212. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2213. %
  2214. % MagickSetImageProperty() associates a property with an image.
  2215. %
  2216. % The format of the MagickSetImageProperty method is:
  2217. %
  2218. % MagickBooleanType MagickSetImageProperty(MagickWand *wand,
  2219. % const char *property,const char *value)
  2220. %
  2221. % A description of each parameter follows:
  2222. %
  2223. % o wand: the magick wand.
  2224. %
  2225. % o property: the property.
  2226. %
  2227. % o value: the value.
  2228. %
  2229. */
  2230. WandExport MagickBooleanType MagickSetImageProperty(MagickWand *wand,
  2231. const char *property,const char *value)
  2232. {
  2233. MagickBooleanType
  2234. status;
  2235. assert(wand != (MagickWand *) NULL);
  2236. assert(wand->signature == MagickWandSignature);
  2237. if (wand->debug != MagickFalse)
  2238. (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
  2239. if (wand->images == (Image *) NULL)
  2240. ThrowWandException(WandError,"ContainsNoImages",wand->name);
  2241. status=SetImageProperty(wand->images,property,value,wand->exception);
  2242. return(status);
  2243. }
  2244. /*
  2245. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2246. % %
  2247. % %
  2248. % %
  2249. % M a g i c k S e t I n t e r l a c e S c h e m e %
  2250. % %
  2251. % %
  2252. % %
  2253. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2254. %
  2255. % MagickSetInterlaceScheme() sets the image compression.
  2256. %
  2257. % The format of the MagickSetInterlaceScheme method is:
  2258. %
  2259. % MagickBooleanType MagickSetInterlaceScheme(MagickWand *wand,
  2260. % const InterlaceType interlace_scheme)
  2261. %
  2262. % A description of each parameter follows:
  2263. %
  2264. % o wand: the magick wand.
  2265. %
  2266. % o interlace_scheme: the image interlace scheme: NoInterlace, LineInterlace,
  2267. % PlaneInterlace, PartitionInterlace.
  2268. %
  2269. */
  2270. WandExport MagickBooleanType MagickSetInterlaceScheme(MagickWand *wand,
  2271. const InterlaceType interlace_scheme)
  2272. {
  2273. assert(wand != (MagickWand *) NULL);
  2274. assert(wand->signature == MagickWandSignature);
  2275. if (wand->debug != MagickFalse)
  2276. (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
  2277. wand->image_info->interlace=interlace_scheme;
  2278. return(MagickTrue);
  2279. }
  2280. /*
  2281. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2282. % %
  2283. % %
  2284. % %
  2285. % M a g i c k S e t I n t e r p o l a t e M e t h o d %
  2286. % %
  2287. % %
  2288. % %
  2289. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2290. %
  2291. % MagickSetInterpolateMethod() sets the interpolate pixel method.
  2292. %
  2293. % The format of the MagickSetInterpolateMethod method is:
  2294. %
  2295. % MagickBooleanType MagickSetInterpolateMethod(MagickWand *wand,
  2296. % const InterpolateMethodPixel method)
  2297. %
  2298. % A description of each parameter follows:
  2299. %
  2300. % o wand: the magick wand.
  2301. %
  2302. % o method: the interpolate pixel method.
  2303. %
  2304. */
  2305. WandExport MagickBooleanType MagickSetInterpolateMethod(MagickWand *wand,
  2306. const PixelInterpolateMethod method)
  2307. {
  2308. MagickBooleanType
  2309. status;
  2310. assert(wand != (MagickWand *) NULL);
  2311. assert(wand->signature == MagickWandSignature);
  2312. if (wand->debug != MagickFalse)
  2313. (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
  2314. status=SetImageOption(wand->image_info,"interpolate",
  2315. CommandOptionToMnemonic(MagickInterpolateOptions,(ssize_t) method));
  2316. return(status);
  2317. }
  2318. /*
  2319. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2320. % %
  2321. % %
  2322. % %
  2323. % M a g i c k S e t O p t i o n %
  2324. % %
  2325. % %
  2326. % %
  2327. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2328. %
  2329. % MagickSetOption() associates one or options with the wand (.e.g
  2330. % MagickSetOption(wand,"jpeg:perserve","yes")).
  2331. %
  2332. % The format of the MagickSetOption method is:
  2333. %
  2334. % MagickBooleanType MagickSetOption(MagickWand *wand,const char *key,
  2335. % const char *value)
  2336. %
  2337. % A description of each parameter follows:
  2338. %
  2339. % o wand: the magick wand.
  2340. %
  2341. % o key: The key.
  2342. %
  2343. % o value: The value.
  2344. %
  2345. */
  2346. WandExport MagickBooleanType MagickSetOption(MagickWand *wand,const char *key,
  2347. const char *value)
  2348. {
  2349. assert(wand != (MagickWand *) NULL);
  2350. assert(wand->signature == MagickWandSignature);
  2351. if (wand->debug != MagickFalse)
  2352. (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
  2353. return(SetImageOption(wand->image_info,key,value));
  2354. }
  2355. /*
  2356. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2357. % %
  2358. % %
  2359. % %
  2360. % M a g i c k S e t O r i e n t a t i o n %
  2361. % %
  2362. % %
  2363. % %
  2364. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2365. %
  2366. % MagickSetOrientation() sets the wand orientation type.
  2367. %
  2368. % The format of the MagickSetOrientation method is:
  2369. %
  2370. % MagickBooleanType MagickSetOrientation(MagickWand *wand,
  2371. % const OrientationType orientation)
  2372. %
  2373. % A description of each parameter follows:
  2374. %
  2375. % o wand: the magick wand.
  2376. %
  2377. % o orientation: the wand orientation.
  2378. %
  2379. */
  2380. WandExport MagickBooleanType MagickSetOrientation(MagickWand *wand,
  2381. const OrientationType orientation)
  2382. {
  2383. assert(wand != (MagickWand *) NULL);
  2384. assert(wand->signature == MagickWandSignature);
  2385. if (wand->debug != MagickFalse)
  2386. (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
  2387. wand->image_info->orientation=orientation;
  2388. return(MagickTrue);
  2389. }
  2390. /*
  2391. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2392. % %
  2393. % %
  2394. % %
  2395. % M a g i c k S e t P a g e %
  2396. % %
  2397. % %
  2398. % %
  2399. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2400. %
  2401. % MagickSetPage() sets the page geometry of the magick wand.
  2402. %
  2403. % The format of the MagickSetPage method is:
  2404. %
  2405. % MagickBooleanType MagickSetPage(MagickWand *wand,
  2406. % const size_t width,const size_t height,const ssize_t x,
  2407. % const ssize_t y)
  2408. %
  2409. % A description of each parameter follows:
  2410. %
  2411. % o wand: the magick wand.
  2412. %
  2413. % o width: the page width.
  2414. %
  2415. % o height: the page height.
  2416. %
  2417. % o x: the page x-offset.
  2418. %
  2419. % o y: the page y-offset.
  2420. %
  2421. */
  2422. WandExport MagickBooleanType MagickSetPage(MagickWand *wand,
  2423. const size_t width,const size_t height,const ssize_t x,
  2424. const ssize_t y)
  2425. {
  2426. char
  2427. geometry[MagickPathExtent];
  2428. assert(wand != (MagickWand *) NULL);
  2429. assert(wand->signature == MagickWandSignature);
  2430. if (wand->debug != MagickFalse)
  2431. (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
  2432. (void) FormatLocaleString(geometry,MagickPathExtent,"%.20gx%.20g%+.20g%+.20g",
  2433. (double) width,(double) height,(double) x,(double) y);
  2434. (void) CloneString(&wand->image_info->page,geometry);
  2435. return(MagickTrue);
  2436. }
  2437. /*
  2438. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2439. % %
  2440. % %
  2441. % %
  2442. % M a g i c k S e t P a s s p h r a s e %
  2443. % %
  2444. % %
  2445. % %
  2446. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2447. %
  2448. % MagickSetPassphrase() sets the passphrase.
  2449. %
  2450. % The format of the MagickSetPassphrase method is:
  2451. %
  2452. % MagickBooleanType MagickSetPassphrase(MagickWand *wand,
  2453. % const char *passphrase)
  2454. %
  2455. % A description of each parameter follows:
  2456. %
  2457. % o wand: the magick wand.
  2458. %
  2459. % o passphrase: the passphrase.
  2460. %
  2461. */
  2462. WandExport MagickBooleanType MagickSetPassphrase(MagickWand *wand,
  2463. const char *passphrase)
  2464. {
  2465. assert(wand != (MagickWand *) NULL);
  2466. assert(wand->signature == MagickWandSignature);
  2467. if (wand->debug != MagickFalse)
  2468. (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
  2469. (void) SetImageOption(wand->image_info,"authenticate",passphrase);
  2470. return(MagickTrue);
  2471. }
  2472. /*
  2473. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2474. % %
  2475. % %
  2476. % %
  2477. % M a g i c k S e t P o i n t s i z e %
  2478. % %
  2479. % %
  2480. % %
  2481. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2482. %
  2483. % MagickSetPointsize() sets the font pointsize associated with the MagickWand.
  2484. %
  2485. % The format of the MagickSetPointsize method is:
  2486. %
  2487. % MagickBooleanType MagickSetPointsize(MagickWand *wand,
  2488. % const double pointsize)
  2489. %
  2490. % A description of each parameter follows:
  2491. %
  2492. % o wand: the magick wand.
  2493. %
  2494. % o pointsize: the size of the font
  2495. %
  2496. */
  2497. WandExport MagickBooleanType MagickSetPointsize(MagickWand *wand,
  2498. const double pointsize)
  2499. {
  2500. assert(wand != (MagickWand *) NULL);
  2501. assert(wand->signature == MagickWandSignature);
  2502. if (wand->debug != MagickFalse)
  2503. (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
  2504. wand->image_info->pointsize=pointsize;
  2505. return(MagickTrue);
  2506. }
  2507. /*
  2508. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2509. % %
  2510. % %
  2511. % %
  2512. % M a g i c k S e t P r o g r e s s M o n i t o r %
  2513. % %
  2514. % %
  2515. % %
  2516. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2517. %
  2518. % MagickSetProgressMonitor() sets the wand progress monitor to the specified
  2519. % method and returns the previous progress monitor if any. The progress
  2520. % monitor method looks like this:
  2521. %
  2522. % MagickBooleanType MagickProgressMonitor(const char *text,
  2523. % const MagickOffsetType offset,const MagickSizeType span,
  2524. % void *client_data)
  2525. %
  2526. % If the progress monitor returns MagickFalse, the current operation is
  2527. % interrupted.
  2528. %
  2529. % The format of the MagickSetProgressMonitor method is:
  2530. %
  2531. % MagickProgressMonitor MagickSetProgressMonitor(MagickWand *wand
  2532. % const MagickProgressMonitor progress_monitor,void *client_data)
  2533. %
  2534. % A description of each parameter follows:
  2535. %
  2536. % o wand: the magick wand.
  2537. %
  2538. % o progress_monitor: Specifies a pointer to a method to monitor progress
  2539. % of an image operation.
  2540. %
  2541. % o client_data: Specifies a pointer to any client data.
  2542. %
  2543. */
  2544. WandExport MagickProgressMonitor MagickSetProgressMonitor(MagickWand *wand,
  2545. const MagickProgressMonitor progress_monitor,void *client_data)
  2546. {
  2547. MagickProgressMonitor
  2548. previous_monitor;
  2549. assert(wand != (MagickWand *) NULL);
  2550. assert(wand->signature == MagickWandSignature);
  2551. if (wand->debug != MagickFalse)
  2552. (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
  2553. previous_monitor=SetImageInfoProgressMonitor(wand->image_info,
  2554. progress_monitor,client_data);
  2555. return(previous_monitor);
  2556. }
  2557. /*
  2558. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2559. % %
  2560. % %
  2561. % %
  2562. % M a g i c k S e t R e s o u r c e L i m i t %
  2563. % %
  2564. % %
  2565. % %
  2566. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2567. %
  2568. % MagickSetResourceLimit() sets the limit for a particular resource in
  2569. % megabytes.
  2570. %
  2571. % The format of the MagickSetResourceLimit method is:
  2572. %
  2573. % MagickBooleanType MagickSetResourceLimit(const ResourceType type,
  2574. % const MagickSizeType limit)
  2575. %
  2576. % A description of each parameter follows:
  2577. %
  2578. % o type: the type of resource: AreaResource, MemoryResource, MapResource,
  2579. % DiskResource, FileResource.
  2580. %
  2581. % o The maximum limit for the resource.
  2582. %
  2583. */
  2584. WandExport MagickBooleanType MagickSetResourceLimit(const ResourceType type,
  2585. const MagickSizeType limit)
  2586. {
  2587. return(SetMagickResourceLimit(type,limit));
  2588. }
  2589. /*
  2590. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2591. % %
  2592. % %
  2593. % %
  2594. % M a g i c k S e t R e s o l u t i o n %
  2595. % %
  2596. % %
  2597. % %
  2598. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2599. %
  2600. % MagickSetResolution() sets the image resolution.
  2601. %
  2602. % The format of the MagickSetResolution method is:
  2603. %
  2604. % MagickBooleanType MagickSetResolution(MagickWand *wand,
  2605. % const double x_resolution,const double y_resolution)
  2606. %
  2607. % A description of each parameter follows:
  2608. %
  2609. % o wand: the magick wand.
  2610. %
  2611. % o x_resolution: the image x resolution.
  2612. %
  2613. % o y_resolution: the image y resolution.
  2614. %
  2615. */
  2616. WandExport MagickBooleanType MagickSetResolution(MagickWand *wand,
  2617. const double x_resolution,const double y_resolution)
  2618. {
  2619. char
  2620. density[MagickPathExtent];
  2621. assert(wand != (MagickWand *) NULL);
  2622. assert(wand->signature == MagickWandSignature);
  2623. if (wand->debug != MagickFalse)
  2624. (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
  2625. (void) FormatLocaleString(density,MagickPathExtent,"%gx%g",x_resolution,
  2626. y_resolution);
  2627. (void) CloneString(&wand->image_info->density,density);
  2628. return(MagickTrue);
  2629. }
  2630. /*
  2631. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2632. % %
  2633. % %
  2634. % %
  2635. % M a g i c k S e t S a m p l i n g F a c t o r s %
  2636. % %
  2637. % %
  2638. % %
  2639. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2640. %
  2641. % MagickSetSamplingFactors() sets the image sampling factors.
  2642. %
  2643. % The format of the MagickSetSamplingFactors method is:
  2644. %
  2645. % MagickBooleanType MagickSetSamplingFactors(MagickWand *wand,
  2646. % const size_t number_factors,const double *sampling_factors)
  2647. %
  2648. % A description of each parameter follows:
  2649. %
  2650. % o wand: the magick wand.
  2651. %
  2652. % o number_factoes: the number of factors.
  2653. %
  2654. % o sampling_factors: An array of doubles representing the sampling factor
  2655. % for each color component (in RGB order).
  2656. %
  2657. */
  2658. WandExport MagickBooleanType MagickSetSamplingFactors(MagickWand *wand,
  2659. const size_t number_factors,const double *sampling_factors)
  2660. {
  2661. char
  2662. sampling_factor[MagickPathExtent];
  2663. register ssize_t
  2664. i;
  2665. assert(wand != (MagickWand *) NULL);
  2666. assert(wand->signature == MagickWandSignature);
  2667. if (wand->debug != MagickFalse)
  2668. (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
  2669. if (wand->image_info->sampling_factor != (char *) NULL)
  2670. wand->image_info->sampling_factor=(char *)
  2671. RelinquishMagickMemory(wand->image_info->sampling_factor);
  2672. if (number_factors == 0)
  2673. return(MagickTrue);
  2674. for (i=0; i < (ssize_t) (number_factors-1); i++)
  2675. {
  2676. (void) FormatLocaleString(sampling_factor,MagickPathExtent,"%g,",
  2677. sampling_factors[i]);
  2678. (void) ConcatenateString(&wand->image_info->sampling_factor,
  2679. sampling_factor);
  2680. }
  2681. (void) FormatLocaleString(sampling_factor,MagickPathExtent,"%g",
  2682. sampling_factors[i]);
  2683. (void) ConcatenateString(&wand->image_info->sampling_factor,sampling_factor);
  2684. return(MagickTrue);
  2685. }
  2686. /*
  2687. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2688. % %
  2689. % %
  2690. % %
  2691. % M a g i c k S e t S e e d %
  2692. % %
  2693. % %
  2694. % %
  2695. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2696. %
  2697. % MagickSetSeed() sets the pseudo-random number generator seed. Use it to
  2698. % generate a pedictable sequence of random numbers.
  2699. %
  2700. % The format of the MagickSetSeed method is:
  2701. %
  2702. % void MagickSetSeed(const unsigned long seed)
  2703. %
  2704. % A description of each parameter follows:
  2705. %
  2706. % o seed: the seed.
  2707. %
  2708. */
  2709. WandExport void MagickSetSeed(const unsigned long seed)
  2710. {
  2711. SetRandomSecretKey(seed);
  2712. }
  2713. /*
  2714. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2715. % %
  2716. % %
  2717. % %
  2718. % M a g i c k S e t S e c u r i t y P o l i c y %
  2719. % %
  2720. % %
  2721. % %
  2722. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2723. %
  2724. % MagickSetSecurityPolicy() sets the ImageMagick security policy. It returns
  2725. % MagickFalse if the policy is already set or if the policy does not parse.
  2726. %
  2727. % The format of the MagickSetAntialias method is:
  2728. %
  2729. % MagickBooleanType MagickSetAntialias(MagickWand *wand,
  2730. % const char *policy)
  2731. %
  2732. % A description of each parameter follows:
  2733. %
  2734. % o wand: the magick wand.
  2735. %
  2736. % o policy: the security policy in the XML format.
  2737. %
  2738. */
  2739. WandExport MagickBooleanType MagickSetSecurityPolicy(MagickWand *wand,
  2740. const char *policy)
  2741. {
  2742. assert(wand != (MagickWand *) NULL);
  2743. assert(wand->signature == MagickWandSignature);
  2744. if (wand->debug != MagickFalse)
  2745. (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
  2746. return(SetMagickSecurityPolicy(policy,wand->exception));
  2747. }
  2748. /*
  2749. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2750. % %
  2751. % %
  2752. % %
  2753. % M a g i c k S e t S i z e %
  2754. % %
  2755. % %
  2756. % %
  2757. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2758. %
  2759. % MagickSetSize() sets the size of the magick wand. Set it before you
  2760. % read a raw image format such as RGB, GRAY, or CMYK.
  2761. %
  2762. % The format of the MagickSetSize method is:
  2763. %
  2764. % MagickBooleanType MagickSetSize(MagickWand *wand,
  2765. % const size_t columns,const size_t rows)
  2766. %
  2767. % A description of each parameter follows:
  2768. %
  2769. % o wand: the magick wand.
  2770. %
  2771. % o columns: the width in pixels.
  2772. %
  2773. % o rows: the rows in pixels.
  2774. %
  2775. */
  2776. WandExport MagickBooleanType MagickSetSize(MagickWand *wand,
  2777. const size_t columns,const size_t rows)
  2778. {
  2779. char
  2780. geometry[MagickPathExtent];
  2781. assert(wand != (MagickWand *) NULL);
  2782. assert(wand->signature == MagickWandSignature);
  2783. if (wand->debug != MagickFalse)
  2784. (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
  2785. (void) FormatLocaleString(geometry,MagickPathExtent,"%.20gx%.20g",(double)
  2786. columns,(double) rows);
  2787. (void) CloneString(&wand->image_info->size,geometry);
  2788. return(MagickTrue);
  2789. }
  2790. /*
  2791. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2792. % %
  2793. % %
  2794. % %
  2795. % M a g i c k S e t S i z e O f f s e t %
  2796. % %
  2797. % %
  2798. % %
  2799. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2800. %
  2801. % MagickSetSizeOffset() sets the size and offset of the magick wand. Set it
  2802. % before you read a raw image format such as RGB, GRAY, or CMYK.
  2803. %
  2804. % The format of the MagickSetSizeOffset method is:
  2805. %
  2806. % MagickBooleanType MagickSetSizeOffset(MagickWand *wand,
  2807. % const size_t columns,const size_t rows,
  2808. % const ssize_t offset)
  2809. %
  2810. % A description of each parameter follows:
  2811. %
  2812. % o wand: the magick wand.
  2813. %
  2814. % o columns: the image width in pixels.
  2815. %
  2816. % o rows: the image rows in pixels.
  2817. %
  2818. % o offset: the image offset.
  2819. %
  2820. */
  2821. WandExport MagickBooleanType MagickSetSizeOffset(MagickWand *wand,
  2822. const size_t columns,const size_t rows,const ssize_t offset)
  2823. {
  2824. char
  2825. geometry[MagickPathExtent];
  2826. assert(wand != (MagickWand *) NULL);
  2827. assert(wand->signature == MagickWandSignature);
  2828. if (wand->debug != MagickFalse)
  2829. (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
  2830. (void) FormatLocaleString(geometry,MagickPathExtent,"%.20gx%.20g%+.20g",
  2831. (double) columns,(double) rows,(double) offset);
  2832. (void) CloneString(&wand->image_info->size,geometry);
  2833. return(MagickTrue);
  2834. }
  2835. /*
  2836. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2837. % %
  2838. % %
  2839. % %
  2840. % M a g i c k S e t T y p e %
  2841. % %
  2842. % %
  2843. % %
  2844. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2845. %
  2846. % MagickSetType() sets the image type attribute.
  2847. %
  2848. % The format of the MagickSetType method is:
  2849. %
  2850. % MagickBooleanType MagickSetType(MagickWand *wand,
  2851. % const ImageType image_type)
  2852. %
  2853. % A description of each parameter follows:
  2854. %
  2855. % o wand: the magick wand.
  2856. %
  2857. % o image_type: the image type: UndefinedType, BilevelType, GrayscaleType,
  2858. % GrayscaleAlphaType, PaletteType, PaletteAlphaType, TrueColorType,
  2859. % TrueColorAlphaType, ColorSeparationType, ColorSeparationAlphaType,
  2860. % or OptimizeType.
  2861. %
  2862. */
  2863. WandExport MagickBooleanType MagickSetType(MagickWand *wand,
  2864. const ImageType image_type)
  2865. {
  2866. assert(wand != (MagickWand *) NULL);
  2867. assert(wand->signature == MagickWandSignature);
  2868. if (wand->debug != MagickFalse)
  2869. (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
  2870. wand->image_info->type=image_type;
  2871. return(MagickTrue);
  2872. }