EPS to JPG - some work, some don't? Why?
Posted: 2008-10-30T12:38:23-07:00
Hi All,
I have run into this problem and it is driving me a little crazy.
I am trying to convert EPS images to JPG. I am using this code:
For the most part, this works great with all my test files. However, someone recently began uploading their EPS files and they all failed. I looked into it, and here is what I found:
1) With my EPS files, Unix shows them as having a 'application/octet-stream' mime type. The problem EPS files seem to have a mime of 'application/postscript'.
2) The problem files will not work with MagickReadImageBlob. The script stops there. They will only work with MagickReadImage.
Inversely, my original test images only seem to work with MagickReadImageBlob.
3) Finally, even when using MagickReadImage, the output for the problems images is a blank white jpg image.
I can not see anything noticeably wrong or different with the files, but clearly there is something causing this trouble. Any ideas or suggestions? I am completely stumped.
Thanks!
I have run into this problem and it is driving me a little crazy.
I am trying to convert EPS images to JPG. I am using this code:
Code: Select all
$blob = file_get_contents("test.eps");
$magick_wand=NewMagickWand();
MagickReadImageBlob($magick_wand, $blob);
$wand = NewMagickWand();
MagickSetResolution( $wand, 300, 300 );
MagickReadImageBlob($wand, $blob);
$new_wand = MagickTransformImage($wand, NULL, '3000x');
MagickSetImageFormat($new_wand, 'jpg') ;
MagickWriteImage($new_wand, "file.jpg");
DestroyMagickWand($new_wand);
DestroyMagickWand($wand);
1) With my EPS files, Unix shows them as having a 'application/octet-stream' mime type. The problem EPS files seem to have a mime of 'application/postscript'.
2) The problem files will not work with MagickReadImageBlob. The script stops there. They will only work with MagickReadImage.
Inversely, my original test images only seem to work with MagickReadImageBlob.
3) Finally, even when using MagickReadImage, the output for the problems images is a blank white jpg image.
I can not see anything noticeably wrong or different with the files, but clearly there is something causing this trouble. Any ideas or suggestions? I am completely stumped.
Thanks!