Page 1 of 1

how can i create a empty image?

Posted: 2008-06-26T04:35:24-07:00
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

Re: how can i create a empty image?

Posted: 2008-06-26T09:28:26-07:00
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

Re: how can i create a empty image?

Posted: 2008-06-26T10:12:03-07:00
by kustom
thanks a lot of pete, it worked :)