如何在PHP中将任何图像文件转换为EPS格式?

时间:2022-09-01 21:22:56

I have an image processing system in PHP with Imagemagick. The existing system will be processing images of EPS format for some process and PNGs for the remaining process. So, I need to upload the same image file in EPS and PNG. I am doing the file upload facility now, which should automate the procedure of converting any format image file into EPS and PNG and should save in corresponding locations.

我用Imagemagick在PHP中有一个图像处理系统。现有系统将处理某些过程的EPS格式图像和剩余过程的PNG图像。所以,我需要在EPS和PNG中上传相同的图像文件。我现在正在进行文件上传工具,它应该自动执行将任何格式图像文件转换为EPS和PNG的过程,并应保存在相应的位置。

What I need now is to be able to convert any image format file into EPS and PNG, so then I can process and save them, but there are some DPI limitations. So I need to save the files into these EPS and PNG formats so that only the existing system can use those files properly.

我现在需要的是能够将任何图像格式文件转换为EPS和PNG,然后我可以处理和保存它们,但是有一些DPI限制。因此,我需要将文件保存为这些EPS和PNG格式,以便只有现有系统才能正确使用这些文件。

Please advice me if there is any way to convert image files into EPS and PNG with PHP and Imagemagick.

如果有任何方法可以使用PHP和Imagemagick将图像文件转换为EPS和PNG,请通知我。

Thanks in advance.

提前致谢。

1 个解决方案

#1


0  

You can convert any image to eps format by following code

您可以通过以下代码将任何图像转换为eps格式

public function convertImageToEps(){
    $imgUrl = WWW_ROOT.'imfcs.jpg';
    $imagic = new Imagick();
    $imagic->readImage($imgUrl);
    $imagic->setImageFormat('eps');
    $imagic->writeImage(WWW_ROOT.'simfcs.eps');
    return true ;
}

#1


0  

You can convert any image to eps format by following code

您可以通过以下代码将任何图像转换为eps格式

public function convertImageToEps(){
    $imgUrl = WWW_ROOT.'imfcs.jpg';
    $imagic = new Imagick();
    $imagic->readImage($imgUrl);
    $imagic->setImageFormat('eps');
    $imagic->writeImage(WWW_ROOT.'simfcs.eps');
    return true ;
}