ImageMagick 和 mogrify 裁剪
我在图像上进行裁剪时遇到问题(我的调整大小工作正常)
原始图像是 x ,调整大小后:
mogrify -resize x75 /my/path/image.jpg
我可以看到执行 getimagesize 后调整大小工作正常( ):
Array
(
[0] => 148
[1] => 75
[2] => 2
[3] => width="148" height="75"
[bits] => 8
[channels] => 3
[mime] => image/jpeg
)
裁剪命令是:
mogrify -crop 100x75! +0+0 /my/path/image.jpg
完成后,我尝试使用 getimagesize() 确认图像的大小正确,但出现以下错误,并且也无法访问图像。
Warning (2): getimagesize(/my/path/image.jpg) [function.getimagesize]: failed to open stream: No such file or directory
有什么想法吗?我对作物使用了错误的语法吗?
提前致谢!
I have having problems getting a crop to work on an image (I have got the resize working fine)
The orginal image is x
and after a resize:
mogrify -resize x75 /my/path/image.jpg
i can see the resize has worked properly after performing getimagesize():
Array
(
[0] => 148
[1] => 75
[2] => 2
[3] => width="148" height="75"
[bits] => 8
[channels] => 3
[mime] => image/jpeg
)
the crop command is:
mogrify -crop 100x75! +0+0 /my/path/image.jpg
Once this is complete I try and confirm the image is the correct size by using getimagesize()
but i get the following error and I also can't access the image.
Warning (2): getimagesize(/my/path/image.jpg) [function.getimagesize]: failed to open stream: No such file or directory
Any ideas? Am i using the wrong syntax for the crop?
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
看起来错误出在语法中,图像大小和裁剪位置之间没有空格。 它应该看起来像这样:
以下是不正确:
Looks like the error was in the syntax there is no space between the image size and crop position. it should look like this:
the below is incorrect:
我不记得以前使用过哪个路径,但我发现获得图像大小的唯一方法是使用文件的直接链接 http://www.blablabla - 你已经这样做了还是正在使用 PHP 路径?
在旁注中,我认为您应该将文件名设置两次才能打开然后保存文件?
我希望这对你有帮助,伙计......
I can't remember which path I used previously but I found that the only way I could get the image size was to use a direct link to the file http://www.blablabla - Have you done that or are you using the PHP path?
On a sidenote I thought you were meant to set the filename twice for it to open and then save the file?
I hope this helps you out mate...