how can i create a empty image?

The MagickWand interface is a new high-level C API interface to ImageMagick core methods. We discourage the use of the core methods and encourage the use of this API instead. Post MagickWand questions, bug reports, and suggestions to this forum.
Post Reply
kustom

how can i create a empty image?

Post by kustom »

Hi to all,

i need to do a empty image, i only know how to load one image.... i need to do a empty image of a especific resolution and with a specific background color...

thanks

kustom
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Re: how can i create a empty image?

Post by el_supremo »

i need to do a empty image of a especific resolution and with a specific background color
This code fragment does both:

Code: Select all

	MagickWand *m_wand = NULL;
	PixelWand *p_wand = NULL;

	// "none" makes the background transparent but you can use a colour
	// name such as "red" or an rgb() specification.
	// For details of colour specifications see http://imagemagick.org/script/color.php
	PixelSetColor(p_wand,"none");
	// Create a 640x480 blank image
	MagickNewImage(m_wand,640,480,p_wand);
This alternate, and perhaps better, method is:

Code: Select all

	MagickWand *m_wand = NULL;
	
	MagickSetSize(m_wand,640,480);
	// Other valid names are "xc:red" or "gradient:red-none"
	MagickReadImage(m_wand, "xc:none");
Pete
kustom

Re: how can i create a empty image?

Post by kustom »

thanks a lot of pete, it worked :)
Post Reply