EPS to PNG, with transparency?

IMagick is a native PHP extension to create and modify images using the ImageMagick API. ImageMagick Studio LLC did not write nor does it maintain the IMagick extension, however, IMagick users are welcome to discuss the extension here.
Post Reply
pezz

EPS to PNG, with transparency?

Post 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
Attachments
flame-1004.zip
(14.35 KiB) Downloaded 977 times
pezz

Re: EPS to PNG, with transparency?

Post 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;

Post Reply