Page 1 of 1

EPS to PNG, with transparency?

Posted: 2009-03-26T01:25:43-07:00
by pezz
Hello all!

I'm very new to IMagick, and have a bit of starter-trouble, as I've already hit a wall. I hope someone here can help me out :)

I've tried for 3 hours now, almost, to convert a standard EPS file to PNG, and I wish for the whiteness in the image to be transparent.
I can convert it fine, and save it as PNG, but the transparency boggles me. I've googled nearly 200 times, and all I've tried has been in vain..

I've attached the EPS file in question (zipped because I couldn't attach .eps)..

Really, really hoping someone can help me!

Kind regards,
Dan

Re: EPS to PNG, with transparency?

Posted: 2010-05-06T13:12:06-07:00
by pezz
Solved this, in case anyone was wondering :) Uses paintopaqueimage to paint the "white" transparent in the EPS.

Code: Select all

	$im = new imagick();
	$im->readImage("somefile.eps");
	$im->setImageColorspace(3);
	$im->setImageMatte (true);	
	$im->PaintOpaqueImage("#ffffff",'transparent',50);	
	$im->setImageFormat( "png8" );
	header('Content-type: image/png');
	echo $im;