problems when creating a .png out of a vector file

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
imagemagician
Posts: 1
Joined: 2013-03-22T10:18:23-07:00
Authentication code: 6789

problems when creating a .png out of a vector file

Post by imagemagician »

I want to create a png file out of a vector file (for example an .eps file).
So I wrote this coding:

Code: Select all

			$image = new Imagick();
			$image->readImage(__DIR__ . DIRECTORY_SEPARATOR . $normalfile);
			$image->setImageFormat("png");
                                                $image->resizeImage(100, 100, imagick::FILTER_LANCZOS, 1);
			$image->writeImage(__DIR__ . DIRECTORY_SEPARATOR . $thumbfile. ".png");
It works, but there are several issues:
- The image ain't resized at all (it still has it's original width and height)
- The vector drawing is often not centered (not in the middle of the png file)
- Sometimes a part of the vector drawing isn't in the created png file.

The idea is to create a png file with the whole vector drawing centered in it and that the vector drawing fills up the created png file.


I'm a complete imagemagick noob, so I hope someone can help me out.
Post Reply