Screen capture failed

MagickWand for PHP is an object-oriented PHP interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning MagickWand for PHP.
Post Reply
hatschi
Posts: 3
Joined: 2019-03-14T03:21:14-07:00
Authentication code: 1152

Screen capture failed

Post by hatschi » 2019-03-14T03:39:38-07:00

Hi,

I am a newcommer in Imagemagick. So I have a little problem.

With the script

Code: Select all

<?php
exec('convert -units PixelsPerInch -density 300x300 -quality 98 -colorspace RGB -alpha remove -resize 40% -sharpen 0x0.8 "test.pdf" "test.jpg"');
?> 
I can convert a PDF to JPEG.

Now I will capture the screen from my browser. So I have programmed

Code: Select all

<?php
exec('import screenshot.png');
?> 
and

Code: Select all

<?php
exec('magick import screenshot.png');
?>
But nothing happened. No Error Message. Can you tell me whats wrong? I have the Version:

Code: Select all

Array
(
    [0] => Version: ImageMagick 6.9.7-4 Q16 x86_64 20170114 http://www.imagemagick.org
    [1] => Copyright: © 1999-2017 ImageMagick Studio LLC
    [2] => License: http://www.imagemagick.org/script/license.php
    [3] => Features: Cipher DPC Modules OpenMP
    [4] => Delegates (built-in): bzlib djvu fftw fontconfig freetype jbig jng jp2 jpeg lcms lqr ltdl lzma openexr pangocairo png tiff wmf x xml zlib
)
I have a Domain and I think, my provider have installed Imagemagick in a hidden folder.

Thank you :-))

snibgo
Posts: 11683
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Screen capture failed

Post by snibgo » 2019-03-14T07:39:44-07:00

What is your platform? If Windows, then "import" won't work. Instead, read from "screenshot:".
snibgo's IM pages: im.snibgo.com

hatschi
Posts: 3
Joined: 2019-03-14T03:21:14-07:00
Authentication code: 1152

Re: Screen capture failed

Post by hatschi » 2019-03-14T10:11:03-07:00

The Domain works under Linux (Linux lc0 4.9.0-8-amd64 #1 SMP Debian 4.9.144-3.1 (2019-02-19) x86_64 ). But I will make a screenshot from my Windows 10 Pro Computer. Sorry, but I couldn´t find the right syntax.

Code: Select all

exec('magick screenshot: screenshot.png');
or

Code: Select all

exec('screenshot: screenshot.png');
doesn´t work. No picture was saved!

snibgo
Posts: 11683
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Screen capture failed

Post by snibgo » 2019-03-14T10:32:19-07:00

Your second command ...

Code: Select all

xec('screenshot: screenshot.png');
... doesn't execute any part of ImageMagick.

I suggest you test your installation of ImageMagick at the command line. On Windows, do these work:

Code: Select all

magick rose: r.png

magick screenshot: s.png
If those commands don't work, there is no chance they will work from PHP.

If they do work at the CLI, then there is a PHP problem. I don't use PHP and can't advise, but I understand stderr can be captured, for error messages.
snibgo's IM pages: im.snibgo.com

hatschi
Posts: 3
Joined: 2019-03-14T03:21:14-07:00
Authentication code: 1152

Re: Screen capture failed

Post by hatschi » 2019-03-14T13:30:27-07:00

Thank you for your answear. Actually, I need a script that save any web page as an image file. The page "screenshotmachine.com" offers an API file. This works too. But I would like to do that without an API.

Post Reply